Bug - Cannot Reproduce Starting script with Dance Card counters

When I start my script with a dance card counter already active, it gives me this error:
Code:
> call scripts\ballroom.ash

Visit to Manor2: Haunted Ballroom in progress...
Validating adventure sequence...
No location selected.
Then it proceeds to do one adventure... then it halts.

If the dance card counter becomes active during the execution of the script (which it does frequently) it continues to work undisturbed. The script is very basic and only has 1 call to adventure() in it, so I can't seem to figure this out.
 

Theraze

Active member
Feel like posting the script? My ballroom.ash script works fine whether the counter is on or not, so my assumption is that the problem is in how you've done it...
 

Theraze

Active member
So, my ballroom code is this:
Code:
while (my_adventures() > 2 && have_effect($effect[beaten up]) == 0)
{
    if(get_counters("dance card", 0, 4) == "" && item_amount($item[dance card]) > 0) use( 1, $item[dance card] );
    (!adv1($location[haunted ballroom],-1,""));
    if (have_effect($effect[beaten up]) > 0) cli_execute ("uneffect beaten up");
}

To replicate your behaviour, could do like this...
Code:
void main(int x){
 if (x==0) x=my_adventures();
 x=my_adventures()-x;
 int cc=0;
while (my_adventures() > x && have_effect($effect[beaten up]) == 0 && my_basestat($stat[moxie]) < 640)
{
    if(get_counters("dance card", 0, 4) == "") {
      if (item_amount($item[dance card]) < 1) {
        retrieve_item(1, $item[dance card]);
        cc+=1;
      }
      use( 1, $item[dance card] );
    }
    (!adv1($location[haunted ballroom],-1,""));
    if (have_effect($effect[beaten up]) > 0) cli_execute ("uneffect beaten up");
}
 cli_execute("autosell 0 ballroom blintz, 0 dehydrated caviar, 0 desiccated apricot, 0 flute of flat champagne, 0 tap shoes, 0 worn tophat");
 print("Purchases: "+cc.to_string(),"red");
}

That being said... I just like the short version myself. Never had a problem with it. :)
 
The only real difference I see is the change from adventure to !adv1...

I'm still not sure -why- I'm getting the error I'm getting, but I will try the ! to see if avoiding the false will keep the script going regardless.
 

Theraze

Active member
Well, the ! means if you don't meet the condition, don't abort... that should only matter though if you have a condition set. If you're running your ballroom script to level up in the middle of another script though, and don't do a "condition clear" between script executions... yes, that will definitely help. :)
 
Hrm.. I don't have any goals set though. I never use mafia's goal feature in script, as I have yet to learn how to use it.

And I thought that certain boolean functions halted on false, and that's what the bang was for. Must have misunderstood.
 

Theraze

Active member
The
Code:
(!adventure(<whatever>))
or
Code:
(!adv1(<whatever>))
is as a simpler replacement for
Code:
if (adventure(<whatever>)) {}
Basically, if adventure (or adv1) was going to a abort based on something, don't. The usual reason for aborting is conditions, but it's possible that something else is causing your problems. Try it out though and see if it helps.

My guess though is that it's not a mafia bug...
 
My guess though is that it's not a mafia bug...

While I might be able to avoid the issue with something simple like a bang, I'd still say it's some sort of bug. Right? Why would
Code:
adventure($location[Haunted Ballroom]);
drop the line "No Location Selected"?
 
Last edited:

Theraze

Active member
Well, "No location selected" only shows up a single time in the code, in swingui/panel/AdventureSelectPanel.java... that means that the location validation failed to find the location you requested, if I'm reading it properly. It runs a locationSelect.getSelectedValue() and returns your error if the response is null...

Next step would be actually generating a debug log when the error happens. Because if $location[Haunted Ballroom] is evaluating as not being a valid location, that's... odd.

Edit: Actually, if you gave what you did in code above, then your scripting bug is that you're only giving it a location, not a count of how many adventures to spend there... that's not valid ASH. adventure() is a 2 or 3 variable ASH command, not a 1 variable...
 
OH. Weird.

I'm surprised it works at all then. I will dutifully add the missing 1. Thanks!

EDIT: disregard, looking at my original code I do indeed have the 1. Back to square one.
 

Theraze

Active member
Yeah... but something LIKE that is getting passed along for some reason. For paranoia's sake, I'd suggest adding in the space after the comma in the "adventure(1,$location[Haunted Ballroom])" to make it "adventure(1, $location[Haunted Ballroom])" ...not that it should really matter, but it reduces one potential fail-point in case it's getting parsed as a single unit for some bizarre reason. If you can replicate it, then you can run a debug log and get it fixed. Otherwise... eh. :)
 
Okay, assuming the bang doesn't fix it, what do I do to force a debug log?
I'm fairly certain I can replicate this reliably (when I have turns)
 

roippi

Developer
My guess is a bad counterScript interaction here? Marking can't reproduce in lieu of more info.
 
Top