Excavator - gausie's spading script

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
[size=+2]Excavator[/size]

I recently added a new type of script to KoLmafia - spadingScript. At certain points in the game, a spadingScript will be triggered with the name of the event, the contents of the page, and any other important information. I've now written a script that can use that new functionality to passively collect data for ongoing spading projects. It collects and sends data via kmail to the player Excavator when possible (i.e. when you're not in an encounter), otherwise it is cached in the spadingData property. The cache can be processed by running the spade command in the CLI.

Only data pertinent to the current projects are reported (outcomes from combats, state of flags or counters on your player etc) and each packet of data can be reviewed and approved before it is sent. No personal information will ever be transmitted.

These data are pulled every 15 minutes to a Google Sheet for anyone to review and process.

It is very new so there may be some small bugs so please do report them here, on GitHub, or on the Discord channel.

[size=+1]Installation and Usage[/size]

Install the script using the KoLmafia CLI:

Code:
svn checkout https://github.com/gausie/excavator/trunk/RELEASE/

Set up KoLmafia to use excavator.ash as your spadingScript:

Code:
set spadingScript = excavator.ash

Data will be automatically submitted when possible, but if you want to manually clear the cache in the spadingData prop, you can do so using the spade command:

Code:
spade

A reminder to do so appears on login and in the Daily Deeds panel.

[size=+1]Further information[/size]

You can find a list of active projects on the GitHub repository for the code. I've also set up a dedicated channel on the Ascension Speed Society Discord server if you want to talk more about it or get involved.
 
Last edited:

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Based on overwhelming feedback, I'm now sending the data directly via kmail rather than relying on the spade command. Any data collected when kmails can't be sent (i.e. during an encounter) are still persisted to spadingData and thus can still be submitted with spade, but the cache is also flushed automatically when possible.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Thanks V <3
 

fronobulax

Developer
Staff member
Installed. So far effortless on my part which addresses any of the curmudgeonly misgivings I might have had about it. Thanks.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
New project added!

  • Genie - Determine which monsters and effects can be fought/acquired with the Genie

I know there's already a built in warning for these effects (I added it!) but I decided to implement this in excavator by watching the choice adventure page. Effects are simple enough, but based on these data we might want to add a wishable attribute alongside copyable to the monster proxy record because they are not related.
 

Ryo_Sangnoir

Developer
Staff member
It looks like "I wish to be fighting X" no longer works, but "I wish I was fighting X" does.

"I wish to be fighting a cowskeleton" lead to the error message, while "I wish I was fighting a cowskeleton" lead to the fight.

This might mean some of the data collected is incorrect.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
It looks like "I wish to be fighting X" no longer works, but "I wish I was fighting X" does.

"I wish to be fighting a cowskeleton" lead to the error message, while "I wish I was fighting a cowskeleton" lead to the fight.

This might mean some of the data collected is incorrect.

I'll have to discount previous data. That's a shame. Here's the fix anyway

https://github.com/gausie/excavator/pull/14
 

fronobulax

Developer
Staff member
As I logged in today I saw some messages about spading data available and wouldn't I like to share it? I was surprised since excavator is installed and up to date. I typed "spade" into the gCLI and it appeared to send three hookah related reports.

I see this as an interesting observation and not an issue to be fixed but I was surprised that things were queued and not fired off.

My recollection is that the character did a Goo run, ascend into a softcore seal clubber and yesterday finished the run and went into aftercore. When the session started the character did not have the hookah but had and used it towards the end of the session. Maybe something that is done at login also needs to be done when the prism is broken?

Unrelated probably but...

I use other people's combat scripts, usually SimpleSmack. I get frustrated when SimpleSmack allows me to be beaten up or doesn't kill the monster within the round limit. I can at least detect this happened after the fact by putting an abort when beaten up into my mood. But then I have to manually examine and collect whatever data I need to figure out why SimpleSmack did what it was told as opposed to what I wanted :)

Since this appears to be a way to specify an event in mafia, gather data when it occurs and then share that data, is it possible for me to do that without having any access to GitHub at all? Can I write and deploy my own script and perhaps do something besides kmail the data? If so is there documentation or how to pointers you could point me to?

Thanks.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
As I logged in today I saw some messages about spading data available and wouldn't I like to share it? I was surprised since excavator is installed and up to date. I typed "spade" into the gCLI and it appeared to send three hookah related reports.

I see this as an interesting observation and not an issue to be fixed but I was surprised that things were queued and not fired off.

My recollection is that the character did a Goo run, ascend into a softcore seal clubber and yesterday finished the run and went into aftercore. When the session started the character did not have the hookah but had and used it towards the end of the session. Maybe something that is done at login also needs to be done when the prism is broken?

I do the following check to see if your character is unable to send a kmail

Code:
    if (
        // In a fight
        current_round() > 0 ||
        // In a choice
        handling_choice() ||
        // Was in a choice, gonna be in a fight
        fight_follows_choice() ||
        // Was in a fight, gonna be in a choice
        choice_follows_fight() ||
        // Was in a fight, gonna be in another fight
        in_multi_fight()
    )

If not, I put the data into the spadingData pref. Whenever excavator next tries to send data and the above check passes, it sends all the old stuff too. So the idea is that it won't sit around there too long, but that you will get a native mafia reminder if you log in with some cached spading data.

Unrelated probably but...

I use other people's combat scripts, usually SimpleSmack. I get frustrated when SimpleSmack allows me to be beaten up or doesn't kill the monster within the round limit. I can at least detect this happened after the fact by putting an abort when beaten up into my mood. But then I have to manually examine and collect whatever data I need to figure out why SimpleSmack did what it was told as opposed to what I wanted :)

Since this appears to be a way to specify an event in mafia, gather data when it occurs and then share that data, is it possible for me to do that without having any access to GitHub at all? Can I write and deploy my own script and perhaps do something besides kmail the data? If so is there documentation or how to pointers you could point me to?

I put up some documentation on the wiki back in June. You could write your own spading script that does whatever you like, and get it to pass on to Excavator if you like. Something like

Code:
import <excavator.ash>;

void main( string event, string meta, string page )
{
  fronos_cool_code( event, meta, page );
  excavator@main( event, meta, page );
}
 

fronobulax

Developer
Staff member
Thanks.

I guess if the hookah data was discovered while in a fight and the script did not check for unsent reports to send until the next login that would explain it.
 

Rinn

Developer
I added something like this to my logout script just to make sure any pending data was sent automatically
Code:
if (get_property("spadingData") != ""){
	cli_execute("try; ash import excavator; flush_spading_data()");
}
 

fronobulax

Developer
Staff member
Saw the send spade? text on login again. Same character. Not sure why but if it is repeatable I can start paying more attention :)

Got my own spade script to work - it just writes data to a local file - so thanks again.
 

fronobulax

Developer
Staff member
OK. It appears than neither of the two characters with hookah spading data are sending it. That would appear to be by design since Excavator doesn't send during a fight and shouldn't try. But the existing mechanic to send the data next chance Excavator gets does not seem to be working. If it were I don't think I would be getting nagged about sharing when logging in. Don't know whether that is a bug or just a side effect of the hookah being the only project those characters have data for.

Now I have opted in to Excavator by installing it, allowing it to be SVN updated automatically and not picking and choosing which projects are allowed to collect data. So not only am I comfortable with having spading data sent automagically when ever it is available. I prefer that to having to watch messages scroll and type "spade" by or change my login or logout to do that.

I'd be happy with any solution that gets the data sent and does not require me to type spade or change a script.

If the nag comes from mafia I can understand wanting it, so maybe adding a data collection hook to logout that flushed everything? Adding the hook would be mafia but using it could be a registered script, right?
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I don't really want to hack into having a logout script when the user hasn't specified Excavator as their logout script - I think for now I will officially endorse Rinn's solution above, and maybe even go so far as to add it to the project's README
 

fronobulax

Developer
Staff member
I don't really want to hack into having a logout script when the user hasn't specified Excavator as their logout script - I think for now I will officially endorse Rinn's solution above, and maybe even go so far as to add it to the project's README

Given that the user experience for this feature was once advertised as "set a preference to excavator and your're done" there is an aspect of not keeping promises to endorsing Rinn's solution rather than making it not necessary.

Given that it only seems to be the Hookah data that remains unsent for me, it feels like a design or implementation problem that could be addressed by someone with access to both mafia code and the script.

Given that the current situation doesn't hurt me nearly as much as the spader I admit I am behaving somewhat like a troll or maybe even a sealion.

So I will let this go and either have unsent spading data, implement a logout send, or provide a patch that fixes the flaw as I see it.

:)
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Given that the user experience for this feature was once advertised as "set a preference to excavator and your're done" there is an aspect of not keeping promises to endorsing Rinn's solution rather than making it not necessary.

Given that it only seems to be the Hookah data that remains unsent for me, it feels like a design or implementation problem that could be addressed by someone with access to both mafia code and the script.

Given that the current situation doesn't hurt me nearly as much as the spader I admit I am behaving somewhat like a troll or maybe even a sealion.

So I will let this go and either have unsent spading data, implement a logout send, or provide a patch that fixes the flaw as I see it.

:)

I'm glad we're on the same wavelength :p

Perhaps the best patch for mafia here is to consolidate the dialogues produced by `spade` into a single confirmation. Or to add an "always send spading data" preference.
 

Ryo_Sangnoir

Developer
Staff member
On the monster parts project, certain submissions seem a lot more like Anatomical Injuries than Monster Parts. In particular, looking at "giblets", "kidney", "solar plexus", "throat"...

I expect the wiki is wrong about one of the things we thought were monster parts (or one of the regexes is catching too much).
 
Top