Catching "Stop after"

digitrev

Member
Is there any way to tell - through preferences or a function, perhaps? - if the user has pressed "Stop after"?
 

Bale

Minion
I don't know any way to tell that, but you can catch an abort with try-finally and then add some checks to figure out what might have gone wrong... probably not what you're looking for since you know about try-finally.

Perhaps if you explained why you have a problem, one of our devs would be moved by your plight to figure out how a solution can be created.
 

digitrev

Member
I don't know any way to tell that, but you can catch an abort with try-finally and then add some checks to figure out what might have gone wrong... probably not what you're looking for since you know about try-finally.

Perhaps if you explained why you have a problem, one of our devs would be moved by your plight to figure out how a solution can be created.

It's mostly just about me wanting to interrupt scripts in the same way that I can interrupt automated adventuring called through cli adventure command. I know that cheesecookie has used the parallel nature of relay scripts to set a preference, catch it in the script & exit, but I was wondering if there was any way to catch when someone hits the "Stop after" button, and use that instead.
 

Theraze

Active member
Sounds like what you need to do is run in a try/finally loop, setting your execution to a boolean at the beginning of your try and disabling it at the end, and checking for the boolean in your finally block.

If you actually want to catch aborts.
 

Bale

Minion
Maybe you didn't know as much about try-finally as I thought.

Code:
try {
   boolean running = true;
   do_stuff();
   running = false;
} finally {
   if(running)
      print("This was aborted in the middle of execution", "red");
}

Note that the boolean works in the finally after being defined in the try.
 
Top