How can I script free fights?

Is there a straightforward way to tell Mafia to run through X fights, when those fights don't consume adventures?

The X-32-F Combat Training Snowman makes me want to do this. The snowman offers free fights every day; can I tell Mafia "fight the snowman 10 times" in a way that won't consume adventures? Using adventure(1, $location[The X-32-F Combat Training Snowman]) seems to fight until it's spent 10 turns.
 

matt.chugg

Moderator
The number of free turns spent against the snowman is stored in a preference called _snojoFreeFights

Basically, fight the snowman until that == 10,

not got anyway to test this, but basic CLI execution of ash commands should do it:

Code:
     ash while(get_property("_snojoFreeFights") < 10) {adventure(1,$location[X-32-F Combat Training Snowman]);}

theres no error checking or anything, so if you repeatedly lose, that will probably never complete, but should get you started

[ninja'd by heeheehee.. see above]
 

ckb

Minion
Staff member
Combine both the above posts to make this:
Code:
while (get_property("_snojoFreeFights").to_int()<10) {
	adv1($location[The X-32-F Combat Training Snowman],-1,"");
}
 

Bale

Minion
ckb wins. If someone wants to to see an alias made from that...


Code:
alias snotrain => ashq while(get_property("_snojoFreeFights").to_int()<10) { adv1($location[The X-32-F Combat Training Snowman],-1,""); print("Training fights completed: " + get_property("_snojoFreeFights"), "blue"); }
 

matt.chugg

Moderator
ckb wins. If someone wants to to see an alias made from that...


Code:
alias snotrain => ashq while(get_property("_snojoFreeFights").to_int()<10) { adv1($location[The X-32-F Combat Training Snowman],-1,""); print("Training fights completed: " + get_property("_snojoFreeFights"), "blue"); }

ewwwwww snot rain!
 
Perfect - thanks, all. I was looking for a preference matching "snow", and was surprised not to find one. Didn't think to look for "snojo".
 
I only got around to testing this today, and I'm stumped.

This adventures exactly once, not repeating until _snojoFreeFights == 10:
Code:
while(get_property("_snojoFreeFights").to_int() < 10) {adv1($location[The X-32-F Combat Training Snowman], -1, "");}

Put another way, when _snojoFreeFights==0, and I run that, it adventures once, then aborts with Conditions not satisfied after 1 adventure. Now _snojoFreeFights==1. When I run it again, it adventures once, then aborts. Etc.

Given the abort message, maybe I'm accidentally setting a goal somehow? But the checkbox underneath the location-selector pane on the Adventure tab isn't checked, and the associated goal-input box is greyed out.
 

lostcalpolydude

Developer
Staff member
That message shows up exactly once in mafia's source, and can only trigger if you have a goal set. You can use "condition check" to look at existing goals, or "condition clear" to just make sure there aren't any set.
 
Weird. Mafia didn't seem to want to give me any information about existing goals, but clearing them seemed to solve the issue. So I'm still not sure what the problem was, but at least now I know how to work around it in the future.

> condition check

Conditions list validated against available items.

> condition clear

Conditions list cleared.

> condition check

Conditions list validated against available items.

ash while(get_property("_snojoFreeFights").to_int() < 10) {adv1($location[The X-32-F Combat Training Snowman], -1, "");}
[worked as expected]
 

Theraze

Active member
Uh, no. condition check means to check if you have gotten an item that's in a goal and if you now have it due to something that mafia missed. You can validate this with something like having exactly 1 tatter available (validate with available_amount first), setting a goal for 10 tatters, and running condition check 5 times. You will now have a goal for 5 tatters.

To see your goals/conditions, just type goals or condition. You should get the full list of what you are currently waiting for. Alternatively, in ASH, you can use get_goals() to see the list. To see if you have any goals currently set and not clear them when it isn't needed, you can use:
if (count(get_goals()) > 0) cli_execute("conditions clear");
 
Oh. Hmm. Thanks for the explanation - now I know what to check if this happens again. Sadly, it's too late to debug the original issue :(
 
Top