Excavator - gausie's spading script

Veracity

Developer
Staff member
I think it is time for the person who added our git support to make it the feature-for-feature equivalent of our svn support and fully integrate it into our Sctipt Manager, so the we can publish either svn or git scripts and the user will not have to know there is a difference.
 

fronobulax

Developer
Staff member
I am sad to report that the most recent update has broken many things for me. KoLmafia's git was unable to update my local copy. Uninstalling and reinstalling via KoLmafia did not seem to change anything in the scripts directory. There seem to be no ash files in git\gausie-excavator. The apparent restructuring of the code seems to have broken the techniques by which local changes can be preserved across updates, a SVN capability that is desired for KoLmafia's git.

My local changes were the addition of a strictly local project (which logged beaten up events to a file in data so that possible omissions or errors in BatBrain could be detected and investigated) and it is not clear that local changes are currently supported.

I understand that I am not entitled to anything but since this script can be installed from the Script menu and is a dependency for at least one other script the current state should be noted so KoLmafia users can manage their expectations.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
There won't be any ash files anywhere anymore as I have moved the project to JS, though I appreciate and apologise that your scripts will no longer trivially work. You could still make your own spadingScript and proxy to excavator where appropriate.

Also great point - the script now deploys a little differently than before. I have made a PR to kolmafia to reflect that, and will put a short script in the relevant directory to automigrate people.
 

Ryo_Sangnoir

Developer
Staff member
You can still make strictly local changes, it's just going to be harder due to the bundling. I'm not aware whether simply transpiling the TS to JS (translating for rhino) and keeping the files separate is feasible.

You could also, as gausie says, make a script which does want you want and then calls excavator for the other cases.
 

fronobulax

Developer
Staff member
Random, bordering on philosophical, comments that might be of interest.

I needed local changes to excavator because the project list was static and embedded in code. If excavator had augmented its own list of projects with entries from a user controlled file then I could have managed my project regardless of when or how excavator was updated.

It is not clear how I would reimplement or replace my functionality and I confess that doing so is not a personal high priority. I "registered" my project by adding it to a list and excavator worried about detecting events in KoLmafia and firing projects. I have not tried to figure out the register and fire portions although I could probably replace the previous functionality by refactoring the ash version of excavator.

".ts" is an ambiguous extension on Windows and most of my tools think it is a video format. Just an observation since it is a solved problem.

I assume I can create TypeScript files with a basic text editor and invoke them as a KoLmafia script. If a minimal toolset requires something else then it might be worth a conversation about what it means for KoLmafia to support a scripting language. Philosophically a script that I can read and modify is different from something I can run but need assistance to understand and perhaps modify. The trust requirements are also different.

I understand I am probably the only person who modified excavator rather than propose a project to the developers :)
 

Veracity

Developer
Staff member
You can create Javascript files and invoke them directly as a KoLmafia script.
You need to install some sort of development environment and process TypeScript files into some sort of packaged Javascript in order to use scripts written in that language.

I'm sure it's nice for the original script author, but it's not exactly user friendly for script users who are used to being able to go in and make little customizations.
 

fronobulax

Developer
Staff member
You can create Javascript files and invoke them directly as a KoLmafia script.
You need to install some sort of development environment and process TypeScript files into some sort of packaged Javascript in order to use scripts written in that language.

I'm sure it's nice for the original script author, but it's not exactly user friendly for script users who are used to being able to go in and make little customizations.

I had figured out that TypeScript was compiled into JavaScript which KoLmafia can execute but since the files in the git repository are TypeScript I was not sure at which point the compilation actually occurred. Thanks.
 

heeheehee

Developer
Staff member
I had figured out that TypeScript was compiled into JavaScript which KoLmafia can execute but since the files in the git repository are TypeScript I was not sure at which point the compilation actually occurred. Thanks.
Github Actions compile that into JS on the `release` branch after each commit that's pushed to `main`.


If you want to compile this yourself, you'll have to install one of the various TS -> JS transpilers (either directly or as part of an IDE like Veracity suggests).
 

fronobulax

Developer
Staff member
Several of my observations were based upon the state of the repository (and what was actually checked out via KoLmafia) and that changed significantly with the most recent update. I still had to uninstall, delete some residue and reinstall but the state of what is on my machine makes a bit more sense.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
I do lament that TS makes it harder for tinkering, but it really does make it so much easier for me as an author. I do tinker with a lot of plain JS scripts when I write little scripts, and have a nice workflow for getting the TypeScript Language Server to give me type hinting and the like regardless!

For excavator, I now have a monorepo that hosts both the script and the source for the website (https://excavator.loathers.net) which works well with my eventual plan to have a library shared between both of them providing customisation for the way each project is displayed.
 

fronobulax

Developer
Staff member
My logout script has the following because the previous iteration of Excavator would not automagically submit spading data.

Code:
if (get_property("spadingData") != ""){
    cli_execute("try; ash import excavator; flush_spading_data()");
}

Do I still have to submit data (manually or via script) or does Excavator now do that?

If I need to implement something what should my code look like?

Thanks.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
You can of course run spade but that will make you approve each submission. Best bet is to just remove that entirely, Excavator will flush its data when it can. If you have a Fresh Coat of Paint it'll do it first thing when you log in.

I could expose an excavator_flush.js that does this I suppose, but it doesn't seem strictly necessary.
 
Top