How does adv1 work/semi-rare get

ereinion

Member
This is really a question that cropped up in another thread I made, but since this question wasn't really the topic of that thread, it was suggested that I probably should start a new thread for this. My question is this: From the documentation of the function adv1 on the mafia wiki, it seems that if I call adv1 when my semi-rare counter is up, it should override that counter as long as the second argument I provide the function is 0. However, when I tried doing this in a script I'm working on, automation aborted once I reached the counter, with a message of a semi-rare coming up, are you sure you wanna adventure here...

In the other thread it was suggested that there was no way to avoid mafia aborting for semi-rare counters, unless I use a counter-script. Is this really the case? I kinda want my script to be a standalone turn-burning script, so if there's any way to avoid having to use another one for semi-rares, that would be quite nice :p

Hope you don't mind all these questions from a scripting noob too much :) And thanks for taking the time to have a look at my ramblings :)
 

slyz

Developer
I added some debug loggin in TurnCounter.getExpiredCounter(), and here is what I get:
Code:
> ashq adv1( $location[ outskirts of the knob ], 0, "");

Visit to Knob: Outskirts of The Knob in progress...
getExpiredCounter( adventure.php?snarfblat=114 )
adventureId = 114
turnsUsed = 1
getExpiredCounter( adventure.php?snarfblat=114 )
adventureId = 114
turnsUsed = 1
getExpiredCounter( adventure.php?snarfblat=114 )
adventureId = 114
turnsUsed = 1
[color=red]Fortune Cookie counter expired. Last semirare found 1811 turns ago (on turn 17867) in The Heap[/color]
It looks like something is resetting AdventureRequest.override. I'll try to investigate some more.
 

slyz

Developer
It looks like r9418 added this line in AdventureRequest.run(), just before super.run():
PHP:
this.override = -1;
From the change log, I guess it has to do with
If an AdventureRequest fails to adventure, do not refresh charpane
but I don't really understand why that line was necessary.

EDIT: removing that line restores adv1()'s functionality.
 
Last edited:

Veracity

Developer
Staff member
Revision 10331 removes that line. I have no memory of why I put it in. If it breaks adv1, it is clearly not the correct solution to what I thought I was fixing. If I notice something is un-fixed, we'll fix it a different way.
 
Top