help with semi-rares / set_property

Deraj

New member
Does anyone know how I can keep "relayCounters" from halting my ASH scripts?

I'm trying to write a simple ASH script that adventures for semi-rares without halting when "relayCounters" hits my turn count. I found some posts on this forum that talked about this, but nothing seems to work.

I've tried the command:

set_property("relayCounters", $string[my_turncount() + 250]);

to stop the script from halting, but as soon as I've adventured once, "relayCounters" goes back to what it was before I used set_property.

Any help would be much appreciated.
 

Veracity

Developer
Staff member
Wherever you simply say "adventure(1, location)" you need to capture the result of the adventure function with something like "boolean result = adventure(1, location)".
 

Deraj

New member
Thanks for the help Veracity. I'm still, however, not quite getting it...

I just ran the following script (after eating 2 fortune cookies):

string foo = "";
int bar = -1;
string result = "";
int resnum = -1;
int togo = 250;

foo = get_property("relayCounters");
bar = index_of(foo,":Fortune");
result = substring(foo,0,bar);
resnum = to_int(result);
togo = resnum-my_turncount();

boolean result = adventure(togo,$location[fantasy airship]);
result = adventure(1,$location[Outskirts of The Knob]);
result = adventure(10,$location[fantasy airship]);

...and then I ran into the same problem. As soon as I hit zero turns until the semi-rare, I got the error message "Fortune Cookie counter expired" and my script halted.

Any ideas? thanks!
 

Veracity

Developer
Staff member
That should have worked. I'll have to look at it.

Edit: OK, I have a fix. We were generating a hard abort, not a soft, continuable error. I'll submit it by and by, but the following script got me a lunchbox...

Code:
string foo = get_property("relayCounters");
int bar = index_of(foo,":Fortune");
int resnum = to_int( substring(foo,0,bar) );
int togo = resnum - my_turncount();

print( "about to adventure for " + togo + " turns");

boolean result = adventure(togo,$location[giant's castle]);
result = adventure(1,$location[Outskirts of The Knob]);
if ( result == false )
 result = adventure(1,$location[Outskirts of The Knob]);
result = adventure(10,$location[giant's castle]);
 

Deraj

New member
I tried your ASH script and still got the same error. :(

I think the script halted just before it got to the line:

if ( result == false )
result = adventure(1,$location[Outskirts of The Knob]);

I can't figure out why the script would work for you but not for me...

On a mildly related note, my newbie self wonders how you make that nice box to display your code.
 

Veracity

Developer
Staff member
[quote author=Deraj link=topic=2123.msg10845#msg10845 date=1230861171]
I can't figure out why the script would work for you but not for me...[/quote]
It could be because I am a KoLmafia developer and fixed the source code. That's why I said "I have a fix and will submit it, by and by." :D

On a mildly related note, my newbie self wonders how you make that nice box to display your code.
Like this:

[...code...]your code here[/...code...]

(without the ...)
 
Top