Best Between Battle Script Ever -- formerly AutoMCD

zarqon

Well-known member
You could put something in your mood:

ashq if (get_property("_lastfamiliaritemforyoupersonally") == "5") use_familiar($familiar[your preferred familiar]);

Moods are checkpointed, but I think mafia got smarter a while ago about checkpointing familiar gear so it shouldn't have problems. But, I've been wrong before. (twice!)
 

Aankhen

Member
I’m not really one for using it, but the familiar cycling seems like a neat addition. One question: have you considered going 1-1-1-1-1, 2-2-2-2-2 etc.? That is to say, swap in familiar 1 till you get drop 1; then familiar 2 until you get drop 1; and so on until familiar 5 is done, at which point you start all over for drop 2. It wouldn’t matter to someone who generates enough turns to get all 5 drops from all 5 familiars every day, but it’d likely increase the number of actual drops received for someone doesn’t. It does sound like a pain in the neck to write, and I don’t expect to use it much myself… as such, I suppose this isn’t a feature request so much as something I’d like to hear someone else’s thoughts on. :)
 

slyz

Developer
If you want to implement Aankhen's suggestion, you can steal the choose_fam() function in this script (it's not hard to code, this is just in case you feel lazy :) ).
 

adeyke

Member
I'd been meaning to bring this up but just kept forgetting about it.

There's one place where I find the automatic choice-adventures work against me: the library. If I'm not a muscle class, I really don't care about the gallery unlock. I'd rather use that choiceadv to unlock the second floor. Is there any chance of either making the gallery unlock only happen to muscle classes, or of using a bbb_unlock_gallery variable?
 

zarqon

Well-known member
That sounds like a good deal. I tweaked it to unlock the gallery only if you're a muscle class OR if you're hunting non-Euclidean hooves OR you're > level 13. You're right; aside from possible bounty hunting there's really no reason for non-muscle classes to unlock the gallery during their run.

Updated in the first post, but didn't bump the version number.
 

Theraze

Active member
Put in a check to see which script is calling an extra fortune-cookie eating. Turns out it's BBB...
PHP:
Request 2 of 4 (Farm: Barn) in progress...
Checking for updates (running CounterChecker ver. 1.4)...
_version_BaleCC => 1.4
You have a current version of CounterChecker.
Checking counters now.
Checking resistance to stench...
Searching items for stench resistance...
Resistance-granting item found: Knob Goblin harem veil
Getting a Dogsgotnonoz pills which is currently selling in the mall for 18,800 meat.
Internal checkpoint created.
 
BBB is to blame!
Since you are not in a Mysticality sign, you may not visit the restaurant.
Searching for "fortune cookie"...
Purchasing fortune cookie (1 @ 40)...
You acquire an item: fortune cookie
You spent 40 Meat
Purchases complete.
Eating 1 fortune cookie...
You gain 1 Adventure
Lucky numbers: 194, 198, 89
Finished eating 1 fortune cookie.
 
Visit to BatHole: Batrat and Ratbat Burrow in progress...
 
[2751] Batrat and Ratbat Burrow
Encounter: How Does He Smell?
You acquire an item: Dogsgotnonoz pills

Using BBB with the always option set, as timely wasn't triggering properly. Put the message into the top of the case always, like this:
PHP:
            print("BBB is to blame!", "red");
            if (my_fullness() == fullness_limit()) return true;
            if (!eatsilent(1,$item[fortune cookie])) return false;
 

zarqon

Well-known member
That may be fixed with the previous upload. I'm not really able to test right now, but I bumped the counter checks from starting at 0 to -1, which may help. Grab it again from the first post and see if the problem persists.
 

Theraze

Active member
Nope, using that already. Added some extra logging, so here's what I'm running now. Won't get more semirares until tomorrow though, so can't check just yet.
PHP:
      case "always": case "true":
         while (get_counters("Fortune Cookie",-1,200) == "" ||
                (to_int(cooks.group(2)) > 0 && count(split_string(get_counters("Fortune Cookie",-1,200),"\t")) > to_int(cooks.group(2)))) {
 print(get_counters("Fortune Cookie",-1,200), "red");
 print(get_counters("Semirare window begin",1,200), "red");
 print(count(split_string(get_counters("Fortune Cookie",-1,200),"\t")), "red");
 print(split_string(get_counters("Fortune Cookie",-1,200),"\t"), "red");
            if (my_fullness() == fullness_limit()) return true;
            if (!eatsilent(1,$item[fortune cookie])) return false;
         }
 

Theraze

Active member
Tweaked the display as I went through today to try to figure out what was going on. Here's the final logging section:
PHP:
 print("FCF:" + get_counters("Fortune Cookie",-1,200), "red");
 print("FCC:" + count(split_string(get_counters("Fortune Cookie",-1,200),"\t")), "red");
 print("FCS:" + split_string(get_counters("Fortune Cookie",-1,200),"\t"), "red");
 print("SRF:" + get_counters("Semirare window begin",1,200), "red");
 print("SRC:" + count(split_string(get_counters("Semirare window begin",1,200),"\t")), "red");
 print("SRS:" + split_string(get_counters("Semirare window begin",1,200),"\t"), "red");

This returned the following:
Request 11 of 50 (Mountain: Barrel full of Barrels) in progress...
Checking for updates (running CounterChecker ver. 1.4)...
_version_BaleCC => 1.4
You have a current version of CounterChecker.
Checking counters now.
Searching for "dogsgotnonoz pills"...
Checking resistance to stench...
Searching items for stench resistance...
Resistance-granting item found: Knob Goblin harem veil
Getting a Dogsgotnonoz pills which is currently selling in the mall for 18,800 meat.
Internal checkpoint created.

FCF:
FCC:1
FCS:aggregate string [1]
SRF:
SRC:1
SRS:aggregate string [1]
Visiting Hell's Kitchen...
Menu retrieved.
Since you are not in a Mysticality sign, you may not visit the restaurant.
Searching for "fortune cookie"...
Purchasing fortune cookie (1 @ 40)...
You acquire an item: fortune cookie
You spent 40 Meat
Purchases complete.
Eating 1 fortune cookie...
You gain 1 Adventure
Lucky numbers: 32, 108, 210
Lucky number 210 ignored - too large to be a semirare.
Finished eating 1 fortune cookie.

Visit to BatHole: Batrat and Ratbat Burrow in progress...

[2915] Batrat and Ratbat Burrow
Encounter: How Does He Smell?
You acquire an item: Dogsgotnonoz pills

Counter checker is to blame!

[2916] Barrel Full of Barrels
Encounter: Barrel Smash
You acquire an item: shot of tomato schnapps

FCF:
FCC:1
FCS:aggregate string [1]
SRF:Semirare window begin
SRC:1
SRS:aggregate string [1]
Since you are not in a Mysticality sign, you may not visit the restaurant.
Using cached search results for fortune cookie...
Purchasing fortune cookie (1 @ 40)...
You acquire an item: fortune cookie
You spent 40 Meat
Purchases complete.
Eating 1 fortune cookie...
You gain 1 Adventure
Lucky numbers: 179, 49, 174
Lucky number 49 ignored - too soon to be a semirare.
Finished eating 1 fortune cookie.

Basically, it's not finding any FC counter either time, but there's a SR counter when it's actually time.

My current workaround was deleting the "Semirare window begin" counter check from timely. A range of 40 adventures isn't especially useful... Gives me my goal result (eating after semirare, not before) properly. Still not sure why Always wants to try to eat before as well as after... I do want it to eat regardless of location, but... eh.
 
Last edited:

jwylot

Member
Libram summoning possible?

Thank you for an awesome script. The familiar switching is terrific addition. Just one question - is there an easy way to incorporate libram summoning maybe by importing one of the existing libram scripts?
 

zarqon

Well-known member
Yes -- click the "Cast summoning skills during buff balancing" option in mafia's preferences.
 

Theraze

Active member
Okay, so managed to get BBB and CC to play nicely together by doing the following. I'll post the solutions in both threads, as both need some tweaking. This version does post updates, since it uses a mafia variable, but it could be converted to use a zlib variable for silence if preferred.

To CC, where it sets the locale, like so:
PHP:
 string last_rare = get_property("semirareLocation");
 location locale = expensive_semi(last_rare);
 string billiard = "2";
add a line for setting what that locale is:
PHP:
 string last_rare = get_property("semirareLocation");
 location locale = expensive_semi(last_rare);
 set_property("nextSemirareLocation", locale);
 string billiard = "2";

Then, after it's done with the turn, clean up the setting...
PHP:
 eat_cookie();
}
becomes
PHP:
 eat_cookie();
 set_property("nextSemirareLocation", "");
}


BBB then needs to be modified to respect that if nextSemirareLocation happens to be the place where we're going next, don't try to eat cookies, regardless of whether or not it's on the good cookie list. Change the following:
PHP:
      case "always": case "true":
         while (get_counters("Fortune Cookie",-1,200) == "" ||
                (to_int(cooks.group(2)) > 0 && count(split_string(get_counters("Fortune Cookie",0,200),"\t")) > to_int(cooks.group(2)))) {
to this:
PHP:
      case "always": case "true":
         while (my_location() != to_location(get_property("nextSemirareLocation")) && (get_counters("Fortune Cookie",-1,200) == "" ||
                (to_int(cooks.group(2)) > 0 && count(split_string(get_counters("Fortune Cookie",0,200),"\t")) > to_int(cooks.group(2))))) {

Basically, encapsulating the current check with a validation that we don't have a nextSemirareLocation active and that it isn't set to our current location. By doing it as a check instead of being a boolean, if something crashes out we don't completely break BBB's ability to re-cookie us, since CC will only cookie us if it's doing it in conjunction with one of the counters ticking off.
 

Theraze

Active member
Okay, got it worked out.
Request 10 of 45 (Mountain: Barrel full of Barrels) in progress...
Checking for updates (running CounterChecker ver. 1.4)...
_version_BaleCC => 1.4
You have a current version of CounterChecker.
Checking counters now.
You need a 'map to Vanya's Castle' to adventure here.
You need a 'dingy dinghy' to adventure here.
You need to be level 8 or higher to adventure at Goatlet.
Checking resistance to stench...
Searching items for stench resistance...
Unable to resist stench!
unlockedLocations => 6-- Haunted Kitchen Haunted Billiards Room
Searching for "cube of billiard chalk"...
You need a 'Spookyraven library key' to adventure here.
Searching for "tasty tart"...
You need to be level 11 or higher to adventure at Hidden City.
You need a 'dingy dinghy' to adventure here.
unlockedLocations => 6-- Haunted Kitchen Haunted Billiards Room Knob Goblin Harem
You need a 'Cobb's Knob lab key' to adventure here.
You need a 'Cobb's Knob lab key' to adventure here.
You need to be level 8 or higher to adventure at Ninja Snowmen.
You need to be level 9 or higher to adventure at Orc Chasm.
You need a 'dingy dinghy' to adventure here.
You need at least 40 Mysticality to adventure at Post-Cyrpt Cemetary.
Searching for "distilled fortified wine"...
You need to be level 7 or higher to adventure at Whitey's Grove.
Getting 3 bottles of distilled fortified wine which are currently selling in the mall for 5690 meat each.
New ZLib location setting: BaleCC_nextSemirareLocation => Sleazy Back Alley
Internal checkpoint created.

Restoring HP! Currently at 3 of 31 HP, 21 of 51 MP, current meat: 24 ... Target HP = 30.
Insufficient meat to fully restore HP without wasting restoratives!
Did not fully restore HP for some reason.

Visit to Town: Sleazy Back Alley in progress...

[244] Sleazy Back Alley
Encounter: In the Still of the Alley
You acquire distilled fortified wine (3)

Visiting Hell's Kitchen...
Menu retrieved.
Since you are not in a Mysticality sign, you may not visit the restaurant.
You need 1 more fortune cookie to continue.
Fortune Cookie counter expired. Last semirare found 0 turns ago (on turn 244) in Sleazy Back Alley
Suppose I'll just paste in the modified bits... Basically, the 'always' section becomes this:
PHP:
      case "always": case "true":
         while (my_location() != to_location(vars["BaleCC_nextSemirareLocation"]) && (get_counters("Fortune Cookie",-1,200) == "" ||
                (to_int(cooks.group(2)) > 0 && count(split_string(get_counters("Fortune Cookie",0,200),"\t")) > to_int(cooks.group(2))))) {
            if (my_fullness() == fullness_limit()) return true;
            if (!eatsilent(1,$item[fortune cookie])) return false;
         }
The only difference is that it checks that my_location is not equal to BaleCC_nextSemirareLocation. If we're good there, it runs the rest of the check. If we're adventuring in the SR location? That means we're adventuring ON the SR adventure, as the SR value is only set for that one turn, and turns itself off as soon as the adventure completes.
 

zarqon

Well-known member
Thanks for working that out, Theraze. I wouldn't be able to do any testing on that for a while, so I'm glad you did it. I'll add your changes for the next update.

I'm not sure Bale will want to include CanAdv -- he's reluctant to use that for a script which only needs to check a few locations. But setting the property is probably something he'll agree to. Either way, the change to BBB is harmless, and if he edits CC to set the property, helpful.
 

Theraze

Active member
Yes... he doesn't have to add that. I personally like it, because I wasted somewhere in the range of 6 semirares having it try to send me to the Harem or other places that weren't actually possible yet at my level. I included the code for that, but the only thing it actually NEEDS to work is setting the value before the !adventure 1 is sent, and removing it after.
 

roippi

Developer
Here's something I recently thought of, and here's as good of a place to ask it as any.

Does mafia currently track sugar item durability? I can't tell you the number of times I've intended to take my sugar shield off when it has, say, 5 adventures left on it, and have just completely forgotten about it. Poof go the runaways.

I'd love a way to either prompt or automatically remove a sugar item at an arbitrary durability threshold. Or, heck, a relay counter that gives me a countdown to breakage.
 

Winterbay

Active member
Yes. They are stored under a preference for each item as such:
Code:
sugarCounter4178 (user, now '0', default 0)
sugarCounter4179 (user, now '0', default 0)
sugarCounter4180 (user, now '0', default 0)
sugarCounter4181 (user, now '0', default 0)
sugarCounter4182 (user, now '0', default 0)
sugarCounter4183 (user, now '0', default 0)
sugarCounter4191 (user, now '0', default 0)

You'll have to know which item is which number yourself though.
 

slyz

Developer
This alias is useful:
Code:
[B]alias sug[/B] => ashq record{int it;string n;}[int]sc;int ind=0;for i from 4178 to 4183{sc[ind].it=i;sc[ind].n=get_property("sugarCounter"+i);ind+=1;}sc[ind].it=4191;sc[ind].n=get_property("sugarCounter4191");sort sc by value.n.to_int();foreach num,rec in sc{if(rec.n>0)print(rec.it.to_item()+": "+rec.n);}

Code:
> sug

sugar shield: 2
sugar shirt: 29

Implementing this in BBB shouldn't be too hard.
 
Top