There are two ways for a script to exit.
The first is on their own terms, the second is by aborting (Esc / Abort) which may leave the account in a bad state.
But a lot of scripts are something that can exit midway gracefully, yet there's no actual way for the user to do this. Even with autoscend, it requires you to go into the relay browser and run a relay page.
My thoughts are that it would be nice to have either a preference, or a new ash function in which a script can check if it should exit early, or continue.
After a fight, and before a fight. It checks the value, then continues.
The most obvious thing that comes to mind is the CLI command "stop", as well as a button to stop. The button could be located next to the "refresh" button beneath the GUI's charsheet.
There are several things that come to mind.
What happens if we're running multiple scripts?
Given that "stop" means we want to abort, but in a graceful way. I think it should clear the queue if any are queued.
The next is how we should request a stop, and check if a stop is requested.
A preference is one way to go, however we don't actually care about the stop state when there's no script running. It could also persist if something goes wrong.
So storing it internally that we wish to stop, sounds better.
Preferences would provide more backwards compatibility, but they can just remain on older versions of scripts if they insist on older versions of mafia.
stopping() : boolean - Has a stop been requested
(stop_requested(), is_stopping(), requested_stop()) - Potential names
stop(boolean) : boolean - Returns false if a stop was already requested
(request_stop) - Potential name
The first is on their own terms, the second is by aborting (Esc / Abort) which may leave the account in a bad state.
But a lot of scripts are something that can exit midway gracefully, yet there's no actual way for the user to do this. Even with autoscend, it requires you to go into the relay browser and run a relay page.
My thoughts are that it would be nice to have either a preference, or a new ash function in which a script can check if it should exit early, or continue.
After a fight, and before a fight. It checks the value, then continues.
The most obvious thing that comes to mind is the CLI command "stop", as well as a button to stop. The button could be located next to the "refresh" button beneath the GUI's charsheet.
There are several things that come to mind.
What happens if we're running multiple scripts?
Given that "stop" means we want to abort, but in a graceful way. I think it should clear the queue if any are queued.
The next is how we should request a stop, and check if a stop is requested.
A preference is one way to go, however we don't actually care about the stop state when there's no script running. It could also persist if something goes wrong.
So storing it internally that we wish to stop, sounds better.
Preferences would provide more backwards compatibility, but they can just remain on older versions of scripts if they insist on older versions of mafia.
stopping() : boolean - Has a stop been requested
(stop_requested(), is_stopping(), requested_stop()) - Potential names
stop(boolean) : boolean - Returns false if a stop was already requested
(request_stop) - Potential name
Last edited: