BatBrain -- a central nervous system for consult scripts

You can, in ASH, catch Mafia errors with the "catch" keyword, so

Code:
catch map_to_file(happenings,"BatMan_happenings_"+replace_string(my_name()," ","_")+".txt");

is perhaps the simplest fix.
 
I will observe that my use of BatBrain is indirect, via SimpleSmack or BatmanRE but I have not seen this problem. My batfactors.txt is dated 06/22/2022 so maybe I'm not getting updates that expose the issue. (If true that would be a problem with the scripts update code, but...)
 
gCLI said:
> ashq int[monster] all_monsters; foreach m in $monsters[] all_monsters[m] = 1; map_to_file(all_monsters, "all_monsters.txt")

()
Script execution aborted (java.lang.NullPointerException: Cannot invoke "net.sourceforge.kolmafia.textui.parsetree.Value.dump(java.io.PrintStream, String, boolean)" because "value" is null): ()

It sure looks like there's some monster that no longer deserializes / serializes cleanly. Digging deeper...
 
Yet... writing single-entry maps with each monster does not cause issues.

> ashq int[monster] all_monsters; foreach m in $monsters[] { clear(all_monsters); all_monsters[m] = 1; map_to_file(all_monsters, "all_monsters.txt"); }
 
Hm. I don't think that's quite it, since manually adding the entry to the map (either before or after the loop) makes it crash elsewhere. But, it's clear that Map.aref is returning null (possibly because the comparison contract is breaking?).
 
There are some monsters with identical names (9x Jerry Bradford, 2x Bowser). However, the actual issue seems to be Ed the Undying (1-7), which all have ID 0.
 
Okay. I think the core problem is that we're breaking transitivity.

the darkness (blind) > fired-up Knob Goblin King (string comparison)
the darkness (blind) < zombie waltzers (string comparison)
...
zombie waltzers < fired-up Knob Goblin King (id comparison)
 
I will observe that my use of BatBrain is indirect, via SimpleSmack or BatmanRE but I have not seen this problem. My batfactors.txt is dated 06/22/2022 so maybe I'm not getting updates that expose the issue. (If true that would be a problem with the scripts update code, but...)
I use BatBrain in the same way and it hit me immediately after updating KoLmafia to any release later than r26738. The first thing I, normally, do after logging in is to complete the Daily Dungeon and in every combat I get the error described.

I will check r26759 this morning.

Edit: Tested with r26761 and ran 90+ turns on an alt, most of them combats, with no errors. Ran another 354 turns on my main, via VMF with no errors. All combats were via SimpleSmack. Thank you!
 
Last edited:
I think r26759 fixes this, but please let us know if that's not the case.

I've played my turns for today already, but I'll check this out tomorrow. My experience matches Magus's (all combats generated the error) so if I have no issues I'd be confident in calling the issue fixed. Thanks very much for your effort regardless.
 
I've played my turns for today already, but I'll check this out tomorrow. My experience matches Magus's (all combats generated the error) so if I have no issues I'd be confident in calling the issue fixed. Thanks very much for your effort regardless.
How odd - I had it happen sometimes but couldn't get it to happen when I actually sat down to debug
 
I'm not sure why but Batbrain, via Simplesmack, is failing every time against "an undercover prohibition agent" one of the new monsters in "Oliver's Place":
[25976] An Unusually Quiet Barroom Brawl
Encounter: undercover prohibition agent
Round 0: Arbos wins initiative!
Round 1: Arbos executes a macro!
KoLmafia thinks it is round 2 but KoL thinks it is round 1
You're on your own, partner. (Macro Aborted ("abort "KoLmafia CCS abort""))
Click here to continue in the relay browser.
 
I'm getting Beaten Up a lot in AOSOL. Is this because KoLmafia's data on monsters and skills is wrong or incomplete or does the community need to edit and upload BatFactors? My version is dated 06/22/2022.
 
So, I'm doing AOSOL now. Because of the lack of updates to batfactors.txt, it won't use any of the combat skills. I did some Pig Skinner runs, and just attacking with my June cleaver was good enough, but now I'm playing as Cheese Wizard and do want to use the skills. I looked at the wiki pages and translated it into this:
Code:
skill    28000    Tackle    (1+0.25*skill(28008))*10    0   
skill    28013    Ball Throw    (1+0.25*skill(28008))*buffedmus    0    once
skill    28014    Noogie    0    0    att -0.2*monsterattack, def -0.2*monsterdefense, stun
skill    28015    Hot Foot    (1+0.25*skill(28008))*buffedmys hot    0    once, !! ongoing damage for next two rounds
skill    28016    Second Wind    0    -0.5*maxhp    once
skill    28017    Stop Hitting Yourself    (1+0.25*skill(28008))*buffedmox    0    stun
skill    29000    Caseus Vamprius    (1+0.5*skill(29008))*5    -5   
skill    29013    Parmesan Missile    (1+0.5*skill(29008))*buffedmys stench,hot,none    0   
skill    29014    Gather Cheese-Chi    0    -30    stun
skill    29015    Crack Knuckles    buffedmus    0    att -12.5, def -12.5, once
skill    29016    Mind Melt    (1+0.5*skill(29008))*buffedmys hot    0    stun
skill    29017    Emmental Elemental    (1+0.5*skill(29008))*buffedmox cold    -buffedmox    once
skill    29019    Stilton Splatter    (1+0.5*skill(29008))*buffedmys    0   
skill    29021    Fondeluge    0    0    custom yellow, once, endscombat
skill    30000    Demoralizing Toot    7    0    att -7, def -7
skill    30013    Orchestra Strike    (1-0.67*skill(30008))*buffedmox    0    att -0.05*monsterattack, def -0.05*monsterdefense
skill    30014    Knife In The Darkness    0.5*monsterhp    0    once, !! gain noncombat buff
skill    30015    Venomous Riff    (1+0.33*skill(30008))*buffedmys    0    once, !! ongoing poison
skill    30016    Drum Roll    0    0    stun 4.5, once
skill    30017    Sax of Violence    (1+0.33*skill(30008))*buffedmus sleaze    0   
skill    30019    Grit Teeth    0    -20   
skill    30021    Motif    0    -20    custom attract

This is just quick dirty, with the idea that considering the skills at all is hopefully an improvement over ignoring them. I'm largely guessing at how both the skills and the file format work, though, so there are almost certainly a lot of mistakes. I'm just assuming here that everything works on buffed stats, without caps, and without being affected by bonuses beyond the class's passive (and I may be wrong about what all those apply to). Some things, like Free-for-All's free instant kill that only works if you don't have Everything Looks Red, need handling in the script itself.

There are some other skills that haven't been implemented (the non-class ones stop at skill 7408, and we're up to 7487 now).

I do think that, if zarqon is no longer updating this, a community-driven effort would be useful. And if there is one, I could offer contributions to it.
 
Last edited:
Back
Top