ziz
Member
I ran into an issue where I expected my JS preAscensionScript script to stop my jumping into the gash, because I called
(Using KoLmafia r27844 // Build main-3261eb6 17.0.10 (Eclipse Adoptium 17.0.10+7) Linux amd64 6.5.0-1015-azure)
The pre-ascension script call (defined here, called here) says (in the source) "If script aborts, we will not jump." If I'm reading the source correctly, JS scripts never "abort" - they either set the state to ERROR or to EXIT.
Here is a no-ascending-required demonstration, which I think is fairly comparable to the preAscensionScript failure, of how this produces different behavior between JS
But the JS version only stops the current command, which suggests to me a state other than ABORT:
Obviously I can work around this with an ASH wrapper to my JS pre-ascension script, but it seems like consistent
abort()
, but it did not, in fact, prevent the gash-jumping.(Using KoLmafia r27844 // Build main-3261eb6 17.0.10 (Eclipse Adoptium 17.0.10+7) Linux amd64 6.5.0-1015-azure)
The pre-ascension script call (defined here, called here) says (in the source) "If script aborts, we will not jump." If I'm reading the source correctly, JS scripts never "abort" - they either set the state to ERROR or to EXIT.
Here is a no-ascending-required demonstration, which I think is fairly comparable to the preAscensionScript failure, of how this produces different behavior between JS
abort()
and ASH abort()
using trivial print-wait-abort scripts (attached). In both cases I ran the first cli commaand, The ASH version stops both the current command and queued commands, which I understand to be indicative of an ABORT state:
Code:
> test_abort.ash; print first post-abort print
Waiting for 5 seconds...
Countdown: 5 seconds...
> CURRENT: test_abort.ash; print first post-abort print
> QUEUED 1: print second post-abort print
Countdown: 4 seconds...
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Aborting...
This is a test of the abort function in ASH.
But the JS version only stops the current command, which suggests to me a state other than ABORT:
Code:
> test_abort.js; print first post-abort print
Waiting for 5 seconds...
Countdown: 5 seconds...
> CURRENT: test_abort.js; print first post-abort print
> QUEUED 1: print second post-abort print
Countdown: 4 seconds...
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Aborting...
This is a test of the abort function in JS.
JavaScript exception: KoLmafia error: This is a test of the abort function in JS.
at file:/Users/seposLibrary/Application%20Support/KoLmafia/scripts/test_abort.js:7 (main)
> print second post-abort print
second post-abort print
Obviously I can work around this with an ASH wrapper to my JS pre-ascension script, but it seems like consistent
abort
behavior would be beneficial and desirable.