BatBrain -- a central nervous system for consult scripts

Assuming you imported SmartStasis and not SmratStasis, and without double-checking what all those numbers are, I'm going to say yes -- it's a perfect way, and a fine example of the uses to which happenings may be put. :)
 
Well, if I haven't then I've managed to save the script under that odd name as well and we can assume it will work anyway :)

Also, is there a reason why smartstasis decided to banish clingy pirates with a cocktail napkin but before that cast noodles? That seems slightly unnecessary to me since it is a guaranteed 1-round fight-ender.
 
Also, is there a reason why smartstasis decided to banish clingy pirates with a cocktail napkin but before that cast noodles? That seems slightly unnecessary to me since it is a guaranteed 1-round fight-ender.

I've been aware of that "lack of a feature" for a long time, but I haven't said anything since it would be slightly tricky to fix.
 
BB at present has absolutely no knowledge of whether or not an action is guaranteed to end combat. Support for that is not going to be the next feature, or even the next next feature. (You'll note that most free runaway items are not even included in batfactors.) At present, my focus is queue structure, improving predictions, funkslinging, and winning combats efficiently. Walking away from them is down the road a ways.
 
It seems it may be simpler to have your own script that checks against your situation for whether or not you wish to free-run, and if so build your own macro / whatever for it; if not, leverage BatBrain. My 0.03125 cents.
 
I'm getting a new message in my fight:
PHP:
Run SmartStasis! (74 profit to stasis with Suckerpunch -- good enough)
1/5 monsters drop goals here.
This monster is the best source of goals (1)!
The string "5003; skill 5005; skill 5008" does not look like an integer; returning 0 (BatBrain.ash, line 1077)

It then continues on and seems to work OK (it even gets Rave Concentration right after this message)
 
Yeah, it has that problem with trying to figure if it should use mistletoe before disco combos and rave combos. I've noticed it in the past. However that doesn't interfere with anything else.
 
Think I might have tracked down the bug where SS keeps trying to use healing items at full health. This relates to the speculative max being lower than the actual max health.
Code:
float my_stat(string which) {
   switch (which) {
      case "hp": return minmax(my_hp()+adj.hp,0,max(my_maxhp(), numeric_modifier("_spec","Buffed HP Maximum")));
      case "mp": return minmax(my_mp()+adj.mp,0,max(my_maxmp(), numeric_modifier("_spec","Buffed MP Maximum")));
Basically, return whatever is higher for your hp/mp max... either the speculative buffed max, or your actual max. This might screw up poisons and other cases where the actual maxhp drops during a fight, but... least it stops burning 150 mp on saucy salve. :)

Also, another thing that's a bit odd... apparently BB initializes the familiar before it's finished reading the round. With meat familiars like the Cocoabo, there's no sense in stasis-ing if you already have full hp/mp after round 10...
> adventure last

0 29.25
Profit per round: ActionProfitDamageOtherbase; Cocoabo (9.65μ)10.51μ2.39 (-4.03 μ/dmg)Att: -0.77 (0 DPR) Def: -0.77 HP: 2.81 MP: 2.81
Run SmartStasis! (10 profit to stasis with spectre scepter -- low)
Monster: Fudge vulture, ATT: 114, DEF: 101, HP: 51, Value: 590
You will die in 11784 rounds.
Your attack will kill the monster in 2 rounds.
26
This is using DAM... I added this (with proper global definitions above) to famevent:
Code:
if (tempmeat != fam.meat) print_html(round +" "+fam.meat); tempmeat = fam.meat;
Basically, according to BB, it's still round 0 when it's initializing the Cocoabo. DAM knows the round (it's where the "26" came from, I believe) but at the point of familiar benefit, it appears to only initialize once... am I misunderstanding this somehow? I'm trying to figure out why DAM keeps wanting to stasis 28 rounds while I have full health and mp.
 
Last edited:
Familiars are recalculated constantly -- baseround(), which is used for all the calculations where BB wants to include your combat scenario, calls famevent(), which builds your familiar info. I've actually looked into a way to store the familiar data and only update it when the round number changes (to speed things up) but my initial attempt at that was buggy so I reverted it -- so presently your familiar info is rebuilt every single time BB needs to know it.

I suppose now that there are an increasing number of cases where BB is not being called at the beginning of combat, we should move that base profit print statement to a point after the round number has been set.

I'm starting to wonder why only DAM users are reporting this stasis problem. Have any SS-only users encountered same? Or, better, if you switch your CCS to use SS followed by DAM, does the problem occur during both scripts' call to stasis() or only DAM's? I haven't come across this problem even once, so it's hard to debug.
 
I used to encounter it sometimes with SS, but since I never stayed in an ascension with Salve or Bandages for too long and there were better things to perm, it wasn't worth reporting or easily replicable at the time. My usual fix was setting the max round for SS at 15, giving me a guaranteed half-fight to finish up even if SS does go a bit crazy. :)

And from the logging I did, it seems the problem is that the speculative max hp is less than the actual max hp, which means that Smart Stasis always believes that healing is valuable, even when you're already at max hp and they can't hit you without counters. Since the call in BatBrain (to_profit) compares my_maxhp() with my_stat("hp"), which doesn't necessarily have the same max...
 
Last edited:
I have a question, pertinent to a refactor I'm attempting: in combat, are there any circumstances where last_monster() would return $monster[none]? It used to be that mafia would use this value for unknown monsters, but I believe now it parses the monster name and creates a monster value for that session or something like that. For instance, when fighting your shadow last_monster() will return a value which is not actually in $monsters[].

I don't know how to test this and would appreciate insight from someone who can.
 
Well, I can tell you from past experience using DAM that KoLmafia successfully parsed monster names for beecore bees. I'd put in some bee specific code to prevent it from casting entangling noodles against the high level bees. $monsters[bee thoven, Queen Bee, Beebee King] contains foe worked fine for the rest of that session. Then the next day when mafia started it gave me an error because the script contained an invalid value for $monster that was not in the data files. :( Until mafia encountered that bee again the line would cause an error so I ended up using a workaround by converting the monster names to strings $strings[bee thoven, Queen Bee, Beebee King] contains to_string(foe) Fortunately mafia finally added the bees and then I could remove the workaround. Then BatBrain recognized the danger of bees and I didn't need the code at all.

Long story made short: mafia will create a value for the monster you encounter, just as you suspect
 
Last edited:
Great -- I just added a set_monster(monster) to BB, which initializes BB for a certain monster. This ought to start actually making BB predictively useful outside of combat (again, this would be the reason for using _spec).

I also fixed a stupid bug in the attack_action() sort which has made BB start preferring higher-damage actions now.

Added the various candies to Candyblast but forgot to update batfactors until recently. Apologies to those who were trying to farm extra candy with blasts this Crimbo.
 
So scripting newbie, but how would I add Tickle-Me Emilio to batfactors.txt? I don't know his familiar number, I can kind of guess at the other fields though.
 
I don't know how to test this and would appreciate insight from someone who can.

Here's a test:

> ash last_monster()

Returned: the beast with 4,706 eyes
base_hp => 0
base_attack => 0
base_defense => 0
base_initiative => 0
attack_element => none
defense_element => none
min_meat => 0
max_meat => 0
base_mainstat_exp => 0.0
phylum => none
poison => none
 
Chef Rannos, something like this:
fam 157 Tickle-Me Emilio 0.25*(fweight+2) physical rate 0.33, meat 0.25*(60), mp 0.25*(fweight+10), hp 0.25*(fweight+10), att -0.25*(fweight+1)/3, def -0.25*(fweight+1)/3
 
I added that line, but so far calling smart stassis with the Tickle Me Emilio isn't doing anything besides a steal and then attack...and I was level 6 trying to find the encryption key at the knob, so plenty of moxie to survive a ton of rounds worth of waiting for hp/mp and meat.



EDIT: In the friars area, it did toss a saucey salve here and there during combats, but still kept attacking...and I've got sing (AT run) and a seal tooth so I have some options for doing a stassis.
 
Last edited:
Yeah... a heavy Emilio tends for about 29 (for me) meat per round stasis value. A heavy Cocoabo tends for... more. Because meat is based on weight, so a Cocoabo weighing 14 pounds gives better random meat drops than any Emilio will, especially when it's (relatively) easy to maintain 40+ weight. But still, interesting for an extra relatively easy 100% ascension.
 
Back
Top