continue after error in GCLI script

zekaonar

Member
I'm heading to Vegas for the weekend and I'm trying to set up some automation so I don't waste too many adventures. I think I have a pretty good simple GCLI script, but I'm trying to make it less error prone. For example during testing I found that if I execute the command "create 5 raspberry" and I have no still uses remaining, the script will error and it will not continue with the rest. Are there any ways to tell it it's ok, just continue with the next line?
 

Theraze

Active member
Using try; <command> should work. Like try; create 5 raspberry. Though I don't tend to ever actually use gCLI scripts, so... someone for verification?
 

Bale

Minion
Though I don't tend to ever actually use gCLI scripts, so... someone for verification?

I cannot verify since I also prefer the greater functionality I gain from ASH. So I probably shouldn't post just to say I cannot help... I am a bad person.
 

Theraze

Active member
Speaking of which, if you want to do it in ASH, you'd use try{} finally{} to do the same thing. Try something. Whether or not it aborts, run finally. It usually works, though some errors will still break it.
 

Bale

Minion
Speaking of which, if you want to do it in ASH, you'd use try{} finally{} to do the same thing.

No, I would not do that in ASH. Even though it would work I would not do that. That is bad. I'd do this:

Code:
if(stills_available() > 0) {
   retrieve_item(stills_available(), $item[strawberry]);
   create(stills_available(), $item[raspberry]);
}

Which could be included in a CLI script if you formatted it like this:

Code:
ashq if(stills_available() > 0) {retrieve_item(stills_available(), $item[strawberry]); create(stills_available(), $item[raspberry]);}

zekaonar, you could use that last line in your CLI script. By prefacing a single line of ash code with the keyword "ashq" it can be included in a CLI script.
 
Last edited:

Theraze

Active member
I was more referring to running code that aborts. Like adventuring past an auto-stop, or casting throw party, which will abort if you don't have a cast available, or other such items. In this case, as you point out, it's better to use the limits. Though you probably want to do min(5, stills_available()) rather than just stills_available() since the goal is to create (up to) 5.
 
Top