Calculating how many bander/boots runs are available

So I've used the following for farming Vmask adventures for a while now:

Code:
void vmaskfarm()

{
if (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < 23)
	{
	cli_execute("acquire snow suit");
	cli_execute("familiar stomping boots");
	cli_execute("equip snow suit");
	cli_execute("try; acquire moveable feast");
	cli_execute("try; use moveable feast");
	cli_execute ("autoattack crits");
	cli_execute ("outfit zcrita");
	if(have_effect($effect[super accuracy]) == 0)
		cli_execute ("gap accuracy");
	cli_execute ("use phial of sleaziness");
	while (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < 18 )
		adv1($location[Frat House (Stone Age)], -1, "");
	cli_execute ("outfit zcritb");
	if (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < 20 )
		adv1($location[Frat House (Stone Age)], -1, "");
	cli_execute ("outfit zcritc");
	if (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < 21 )
		adv1($location[Frat House (Stone Age)], -1, "");
	cli_execute ("outfit zcritd");
	if (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < 22 )
		adv1($location[Frat House (Stone Age)], -1, "");
	cli_execute ("outfit zcrite");
	if (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < 23 )
		adv1($location[Frat House (Stone Age)], -1, "");
	cli_execute ("remedy sleazeform");
	}
}

The outfit changes gradually increase familiar weight, at the expense of +crit%. The runaway numbers assume a bunch of once a day buffs being in place. Predictably, something finally went wrong and caused me to keep running away, wasting turns until I was out of adventures, because I was unable to reach 22 runaways. The only surprise is that it took a couple months of working fine for this to happen. :D I'm hitting a conceptual roadbloack, and have no idea how to proceed. I could change all instances of

Code:
if (get_property("_vmaskAdv") !="10" && to_int( get_property( "_banderRunaways")) < number )

to

Code:
if (get_property("_vmaskAdv") !="10" && remainingRuns > 0 )

But I have no idea how I'd create remainingRuns, which would just be an int for how many boots runs I have left, recalculated based on current gear.
 

lostcalpolydude

Developer
Staff member
PHP:
remainingRuns = familiar_weight( my_familiar() )/5 - get_property( "_banderRunaways" );

That doesn't check that you have the right familiar out, but you probably want to abort in that case anyway.

Also, some ways you can replace cli_execute() in the script.
PHP:
	#cli_execute("acquire snow suit"); // remove completely because equip will handle that anyway
	use_familiar( $familiar[stomping boots] ); #cli_execute("familiar stomping boots");
	equip( $item[snow suit] ); #cli_execute("equip snow suit");
	#cli_execute("try; acquire moveable feast"); // remove completely because using it will take care of that
	boolean temp = use( 1, $item[moveable feast] ); #cli_execute("try; use moveable feast");
	cli_execute ("autoattack crits"); // there's no replacement for this
	outfit( "zcrita" ); #cli_execute ("outfit zcrita");
 
Code:
 remainingRuns = familiar_weight( my_familiar() )/5 - get_property( "_banderRunaways" );

Does that recalculate automatically as weight changes? If not, do I insert the line after each outfit change to update it? Thanks so much!
 

slyz

Developer
You should make a function that returns the current remaining runs:
PHP:
int remainingRuns()
{
    return familiar_weight( my_familiar() ) / 5 - get_property( "_banderRunaways" ).to_int();
}
Then simply use remainingRuns() instead of remainingRuns in the rest of your script.
 
Alrighty, I've gotten around to trying this out again, and I've tried slyz's solution exactly as posted, but it seems to be giving up far too early. After 4 runaways, I see it then cycle through all subsequent outfits without adventuring in them. I had leash, empathy, and much more running, so I'm not sure why it thought I was out of runaways at that point, as it should have been able to get to 18 or so before switching outfits.
 

slyz

Developer
Sorry, my snippet only used your familiar's base weight, without taking into account other weight modifiers. This should work:
PHP:
int fam_weight()
{
	return familiar_weight( my_familiar() ) + numeric_modifier("familiar weight") ;
}

int remainingRuns()
{
    return fam_weight() / 5 - get_property( "_banderRunaways" ).to_int();
}
 
So I adapted the script to farm c.h.u.m. chums while going through the sewers in Hobopolis runs. Or at least I thought I did, I never actually ended up testing Slyz's fix above with Vmask adventure farming, but in principle this is the exact same thing:

Code:
void sewerfarm()
{
if (get_property("_vmaskBanisherUsed") =="false")
{

if (to_int( get_property( "_navelRunaways")) < 3 )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("acquire snow suit");
	cli_execute ("equip snow suit");
	cli_execute("try; acquire moveable feast");
	cli_execute ("try; use moveable feast");
	cli_execute ("familiar penguin goodfella");
	cli_execute ("try; equip tasteful black bow tie");
	cli_execute ("outfit zsewera");
	cli_execute ("autoattack zsewera");
	}
while (get_property("_stinkyCheeseBanisherUsed") =="false" && to_int( get_property( "_navelRunaways")) < 3 )
	{
	adv1($location[a maze of sewer tunnels], -1, "");
	cli_execute ("display put * goodfella contract");
	}
if (get_property("_vmaskBanisherUsed") =="false" && to_int( get_property( "_navelRunaways")) < 3 )
	{
	cli_execute ("outfit zsewerb");
	cli_execute ("autoattack zsewerb");
	}
while (get_property("_vmaskBanisherUsed") =="false" && to_int( get_property( "_navelRunaways")) < 3 )
	{
	adv1($location[a maze of sewer tunnels], -1, "");
	cli_execute ("display put * goodfella contract");
	}
if (to_int( get_property( "_navelRunaways")) < 3 )
	cli_execute ("autoattack zsewerc");
while (to_int( get_property( "_navelRunaways")) < 3 )
	{
	adv1($location[a maze of sewer tunnels], -1, "");
	cli_execute ("display put * goodfella contract");
	}
if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false")
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerc");
	cli_execute ("autoattack zsewera");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false")
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerd");
	cli_execute ("autoattack zsewerb");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3)
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerd");
	cli_execute ("autoattack zsewerc");
	while (to_int( get_property( "_navelRunaways")) >= 3 && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false")
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewere");
	cli_execute ("autoattack zsewera");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false")
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerf");
	cli_execute ("autoattack zsewerb");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3)
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerf");
	cli_execute ("autoattack zsewerc");
	while (to_int( get_property( "_navelRunaways")) >= 3 && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false" )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerg");
	cli_execute ("autoattack zsewera");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false" )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerh");
	cli_execute ("autoattack zsewerb");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerh");
	cli_execute ("autoattack zsewerc");
	while (to_int( get_property( "_navelRunaways")) >= 3 && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false" )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zseweri");
	cli_execute ("autoattack zsewera");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_stinkyCheeseBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false" )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerj");
	cli_execute ("autoattack zsewerb");
	while (to_int( get_property( "_navelRunaways")) >= 3 && get_property("_vmaskBanisherUsed") =="false" && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerj");
	cli_execute ("autoattack zsewerc");
	while (to_int( get_property( "_navelRunaways")) >= 3 && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}

if (to_int( get_property( "_navelRunaways")) >= 3 )
	{
	cli_execute ("familiar stomping boots");
	cli_execute ("outfit zsewerk");
	cli_execute ("autoattack zsewerc");
	while (to_int( get_property( "_navelRunaways")) >= 3 && remainingRuns() > 0)
		adv1($location[a maze of sewer tunnels], -1, "");
	}
}
}

It's generally working fine, but it's not using all the runs it has available before moving on to the next step. For instance, if 20 runs are available, it will move to the next step once it's at 18 runs (I didn't catch exact numbers while it was running, but I can parse the logs and calculate this if necessary). I posted the entire script for completeness sake, hopefully its fiddliness doesn't get in the way of diagnosing the problem. It's stinkeye banishing the first gold fish or gator it sees, then Vmask banishing the next so that only C.H.U.M.s remain.
 

Theraze

Active member
Well, you're always checking for >= 3, not >= 1 or > 0. Doesn't it make sense that if you're only adventuring with 3 or more runaways left, it would stop with 2 remaining?
 
I think all instances of >=3 are check for navel runs, so that the script knows it's time to switch to bander/boots runs. At least, I think, I don't see how the _navelRunaways >=3 cold be the cause? remainingRuns() is pegged to familiar weight, which is what's leaving off two runs. IE, I'll watch it go to 18/20 runs with the first outfit, then switch outfits to increase the cap to 21 runs, it'll do a 19th run, switch to an outfit that increase the cap to 22 runs, and so forth, such that it's switching too early and ultimately not using 2 runaway.
 

Theraze

Active member
Wait, you're trying to look up vmask stuff? Or bander runaways? Because you only have the single _vmaskBanisherUsed property being checked.

And what exactly are you using for your functions and so on, because it's not fully contained in your problematic script posting. If your problem is with the remainingRuns function, it would help to actually see your version of it...
 
My guess would be that fam_weight() is missing the feast buff.

How could that be? The weight displays correctly in the left column of mafia, why would the function exclude a portion of the weight? Though if this is something that it'll consistently do I suppose a workaround would be to just add+2 to all things that look at remaining boots/bander runs. Though I'm concerned that at some point that'll backfire and cause an infinite loop, if for some reason the feast doesn't fire, perhaps because it's on loan to someone, or who knows.

Wait, you're trying to look up vmask stuff? Or bander runaways? Because you only have the single _vmaskBanisherUsed property being checked.

And what exactly are you using for your functions and so on, because it's not fully contained in your problematic script posting. If your problem is with the remainingRuns function, it would help to actually see your version of it...

The script equips an outfit with a stinky cheese eye, banishes the first goldfish or gator it encounters (using the macro zsewera), then switches to outfits with the Vmask to banishes the one that wasn't encountered first with macro zsewerb. Once both those are banished, it switches to macro zsewerc. While this is going on, the script is cycling through free runaways. First it uses GAP/navel runs, then boots/bander runs. The fiddly and annoying thing is that there's a chance that after you've used up your navel/GAP runs, you might not have banished the gator and goldfish. The extra fiddly thing is that in order to maintain a Vmask banish, you need to still be wearing the Vmask. Basically, every time the script exhausts navel/GAP and boots/bander runaways during its current step, it needs to evaluate what banish skills have been used so it knows what outfit and what macro to use next.
 

Theraze

Active member
I recall there was something special you had to do to detect feasted familiars, but... can't remember it offhand. But I believe it wasn't just the regular function. Might be hidden familiar weight or something like that in the numeric_modifiers?
 
Does anybody know if that's true, and if so, how to properly detect well fed? If that's what's going on it would perfectly explain the 2 run discrepancy, and it's an odd effect, so it's very plausible.
 
Top