BatBrain -- a central nervous system for consult scripts

Just added initial support for Snake-Eyes Glenn. Two successful fights in BatMan RE shows it correctly adjusting for the dice he rolls.

Had a look at adding some kind of support for the unusual construct, but since presently BatBrain doesn't consider funkslinging combos as actions, and mafia already populates your item dropdown with the necessary discs, there's not really anything to be done.
 
Just ascended into a Cow Puncher run and BatBrain is estimating that my unarmed attack will deal 1 damage at 62 muscle vs. a stronger foe. This is clearly wrong, since attacking actually deals around 64 damage.

Even after hardcoding the +30 from steel knuckles (which is evidently not automatically added to the Weapon Damage modifier -- perhaps I should freqreq that), the attack is estimated to be right around 30. That's a bit over 30 more damage un-accounted-for. Where is it coming from? I have no other sources of weapon damage. Is the Wiki formula that BatBrain uses outdated?

EDIT: Was adding improved support for Cowboy Kick (including boot customizations) and discovered a moronic copy/paste bug -- the "monsterdefense" fvar was being set to the monster's attack instead of the monster's defense. Obviously not a massive error since the script has been functional like that for who knows how long, but definitely not a small one.

So, we have r93. Also included: the aforementioned support for Cowboy Kick (incidentally, the batfactors formula had a min that should have been a max which was keeping damage at 1), support for steel knuckles (which evidently count as weapon damage for purposes of bonus weapon damage percent), and support for cow pokers (some parenthetical statement related to cow pokers).

Enjoy!
 
Last edited:
So /something/ is causing Mafia to automatically cast Sing while fighting Somerset Lopez, Demon Mariachi in the relay browser, and as best I can tell BatBrain is the root of it. I do have BatMan RE installed, and am also using WHAM, but for both fights I was using the buttons at the top of the fight page rather than any scripts. The first time around, I got earworm at the beginning of the fight and it proceeded to hit the round limit without any input from me. The second time, I was able to go 8 rounds before it started auto-casting, and only managed to win because KoL was still accepting my periodic input from the browser. Of course, this means I can't reproduce the issue with more verbose messages for quite some time, but I can provide the logs I have.

Code:
[1335] The Nemesis' Lair
Encounter: Somerset Lopez, Demon Mariachi WITH SCIENCE!
Round 0: Laserrobotics loses initiative!
You acquire an effect: Earworm (1)
Round 1: You lose 15 hit points
Round 1: Laserrobotics casts SING!
Round 2: You lose 15 hit points
Round 2: Laserrobotics casts SING!
Round 3: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 3: You lose 14 hit points
Round 3: Laserrobotics casts SING!
Round 4: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 4: You lose 15 hit points
Round 4: Laserrobotics casts SING!
Round 5: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 5: Laserrobotics casts SING!
Round 6: You lose 13 hit points
Round 6: Laserrobotics casts SING!
Round 7: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 7: You lose 13 hit points
Round 7: Laserrobotics casts SING!
Round 8: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 8: Laserrobotics casts SING!
Round 9: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 9: You lose 13 hit points
Round 9: Laserrobotics casts SING!
Round 10: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 10: You lose 14 hit points
Round 10: Laserrobotics casts SING!
Round 11: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 11: Laserrobotics casts SING!
Round 12: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 12: You lose 14 hit points
Round 12: Laserrobotics casts SING!
Round 13: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 13: Laserrobotics casts SING!
Round 14: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 14: You lose 15 hit points
Round 14: Laserrobotics casts SING!
Round 15: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 15: You lose 15 hit points
Round 15: Laserrobotics casts SING!
Round 16: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 16: Laserrobotics casts SING!
Round 17: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 17: Laserrobotics casts SING!
Round 18: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 18: You lose 15 hit points
Round 18: Laserrobotics casts SING!
Round 19: Laserrobotics casts SING!
Round 20: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 20: You lose 14 hit points
Round 20: Laserrobotics casts SING!
Round 21: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 21: You lose 13 hit points
Round 21: Laserrobotics casts SING!
Round 22: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 22: Laserrobotics casts SING!
Round 23: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 23: Laserrobotics casts SING!
Round 24: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 24: Laserrobotics casts SING!
Round 25: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 25: You lose 14 hit points
Round 25: Laserrobotics casts SING!
Round 26: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 26: Laserrobotics casts SING!
Round 27: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 27: Laserrobotics casts SING!
Round 28: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 28: You lose 15 hit points
Round 28: Laserrobotics casts SING!
Round 29: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 29: Laserrobotics casts SING!
Round 30: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 30: You lose 14 hit points
Round 30: Laserrobotics casts SING!
Round 31: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 31: You lose 14 hit points
Round 31: Laserrobotics casts SING!
Round 0: Laserrobotics attacks!
> Restoring HP! Currently at 317 of 498 HP, 140 of 193 MP, current meat: 2031817 ... Target HP = 474.

cast 5 Tongue of the Walrus
You gain 169 hit points

Visiting the lava maze
> Restoring MP! Currently at 486 of 498 HP, 90 of 193 MP, current meat: 2031817 ... Target MP = 155.

use 1 carbonated water lily
You gain 62 Mojo Points

use 1 carbonated water lily
You gain 60 Mojo Points

Visiting Stradella, the Accordion Thief

Visiting Duncan Drisorderly, the Disco Bandit

Visiting the lava maze

volcanoisland.php?
volcanoisland.php?pwd&action=tniat

[1336] The Nemesis' Lair
Encounter: ELDRITCH HORROR Somerset Lopez, Demon Mariachi
Round 0: Laserrobotics wins initiative!
Round 1: Laserrobotics casts ENTANGLING NOODLES!
Round 2: Somerset Lopez, Demon Mariachi drops 10 attack power.
Round 2: Somerset Lopez, Demon Mariachi drops 10 defense.
Round 2: Laserrobotics executes a macro!
Round 2: Laserrobotics uses the HOA citation pad!
Round 3: Somerset Lopez, Demon Mariachi drops 26 attack power.
Round 3: Somerset Lopez, Demon Mariachi drops 21 defense.
You acquire an effect: Earworm (1)
Round 3: You lose 15 hit points
Round 3: Laserrobotics casts SING!
Round 4: Laserrobotics executes a macro!
Round 4: Laserrobotics casts OFFENSIVE JOKE!
Round 5: Somerset Lopez, Demon Mariachi takes 22 damage.
Round 5: Somerset Lopez, Demon Mariachi drops 20 attack power.
Round 5: Somerset Lopez, Demon Mariachi drops 20 defense.
Round 5: You lose 14 hit points
Round 5: Laserrobotics executes a macro!
Round 5: Laserrobotics casts CADENZA!
Round 6: Somerset Lopez, Demon Mariachi takes 48 damage.
Round 6: Somerset Lopez, Demon Mariachi drops 20 attack power.
Round 6: Somerset Lopez, Demon Mariachi drops 18 defense.
Round 6: Laserrobotics executes a macro!
Round 6: Laserrobotics uses the fabric softener!
Round 7: Somerset Lopez, Demon Mariachi drops 26 attack power.
Round 7: Somerset Lopez, Demon Mariachi drops 29 defense.
Round 7: Laserrobotics attacks!
Round 8: Somerset Lopez, Demon Mariachi takes 110 damage.
Round 8: You lose 15 hit points
Round 8: Laserrobotics attacks!
Round 9: Somerset Lopez, Demon Mariachi takes 110 damage.
You acquire an effect: Earworm (1)
Round 9: Laserrobotics casts SING!
You acquire an effect: Earworm (1)
Round 10: You lose 15 hit points
Round 10: Laserrobotics casts SING!
Round 11: You lose 13 hit points
Round 11: Laserrobotics casts SING!
Round 12: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 12: You lose 15 hit points
Round 12: Laserrobotics casts SING!
Round 13: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 13: You lose 13 hit points
Round 13: Laserrobotics casts SING!
Round 13: Laserrobotics attacks!
Round 14: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 14: Laserrobotics casts SING!
Round 15: Somerset Lopez, Demon Mariachi takes 109 damage.
Round 15: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 15: You lose 12 hit points
Round 16: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 16: You lose 15 hit points
Round 16: Laserrobotics casts SING!
Round 17: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 17: You lose 15 hit points
Round 17: Laserrobotics casts SING!
Round 18: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 18: You lose 15 hit points
Round 18: Laserrobotics casts SING!
Round 19: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 19: You lose 14 hit points
Round 19: Laserrobotics casts SING!
Round 20: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 20: You lose 15 hit points
Round 20: Laserrobotics casts SING!
Round 20: Laserrobotics attacks!
Round 21: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 21: You lose 12 hit points
Round 21: Laserrobotics casts SING!
Round 22: Somerset Lopez, Demon Mariachi takes 108 damage.
Round 22: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 22: You lose 14 hit points
Round 23: Somerset Lopez, Demon Mariachi takes 2 damage.
Round 23: Laserrobotics casts SING!
Round 24: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 24: You lose 15 hit points
Round 24: Laserrobotics casts SING!
Round 25: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 25: You lose 12 hit points
Round 25: Laserrobotics casts SING!
Round 26: Somerset Lopez, Demon Mariachi takes 2 damage.
You acquire an effect: Earworm (1)
Round 26: You lose 14 hit points
Round 26: Laserrobotics casts SING!
Round 27: Laserrobotics wins the fight!
After Battle: Wunderson does a strange, angry-looking stompy sort of dance, while shouting "DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS".
You acquire an item: La Hebilla del Cinturón de Lopez
You acquire an item: Instant Karma
You acquire an item: heart of the volcano
After Battle: Wunderson gives you a thin black candle with "Team Edward" painted on the side.
You acquire an item: thin black candle
You acquire an item: BACON
After Battle: You gain 18 Strongness
After Battle: You gain 8 Wizardliness
After Battle: You gain 41 Cheek
 
Casting sing when you have the earworm effect is certainly a good idea. What I don't see in your log is that effect being removed by sing. If mafia was still telling BatBrain you had it, then that would explain casting sing when it wasn't needed.
 
Ok, but here's the deal: as I said, it was doing it automatically in the relay browser. Nothing should be happening automatically in combat in the relay browser outside of what vanilla KoL does as far as first hit goes. I am all for mafia recognizing and reacting to combat situations when I tell it to do the fight itself, but if I'm manually fighting? It should be informational only until I tell it otherwise.
 
Last edited:
I'm looking for a way to let BatBrain know that Bacon monsters drop extra bacon depending on how long you fight them and let it use that to help make decisions for Stasising, but I haven't the foggiest idea how to go about that.
 
Under the random modifiers handling, BatBrain should have something like:

case "bacon": base.meat += sell_val($item[bacon item]) / 5.0;

I'm out of the house at the moment and may be misremembering the exact code needed. Will add actual support for that soon.
 
And r94 adds the bacon support (untested) as well as a few other tweaks.

@Laser: That could happen with BatMan RE installed, as it performs automatic responses to certain things before rendering the page. I've never seen a case where someone gets Earworms every single round though, so either you were extremely unlucky or there's something else going on, such as what Crowther suggested.
 
Would it be feasible for you to make that behavior a preference? As much as I support the idea of extra convenience, if I'm fighting in the relay browser I would like to perform the fight manually without any hidden surprises. Informational stuff is great, but doing it for me is a big no when I haven't asked it to.
 
Don't think the latest BACON addition is working 100%, my ccs is simply 'consult wham.ash' and instead of getting a lot of BACON (5) drops, which is the max, I got zero in 450 advs. Combats generally ending with a mainweapon attack by me on the 3rd round, so maxing at BACON (3)
 
Latest couple updates should fix BACON, as well as add some support for Extract Oil and Source Agents. For the Agents, all I did was filter out skills that aren't Source. Removing attack, items, and familiar can be done in batfactors. The multiattack I saw mentioned on the Wiki remains as a possible issue, as well as the variable elemental resistance penetration, but this should at least make BatBrain-powered scripts not completely bork on Agents.
 
I've just added combat skills from The Source to batfactors. If anyone sees an error, please tell me!

Code:
skill	21000	Source Punch	max(20,30+buffedmus-monsterdefense)	0	
skill	21005	Disarmament	0	0	stun, once
skill	21006	Big Guns	300	0	stun, once
skill	21007	Humiliating Hack	0	0	att -(50.0*monsterattack), def -(50.0*monsterdefense), stun, once
skill	21008	Source Kick	max(50,100+buffedmus-monsterdefense)	0	
skill	21009	Reboot	0	0	stun, once
skill	21010	Restore	0	0	stun, once

I'm not entirely sure how to add a full heal to Restore or removing Latency as a power of Reboot. At least the killing skills are there now.
 
Thanks. Scented massage oil is -maxhp. I've updated the map manager with that info.

Sometimes I think that you, Winterbay and I are the only ones who care about updating batfactors.

Am I the only one who writes their own consult script importing BatBrain instead of using WHAM?
 
Last edited:
Thanks. Scented massage oil is -maxhp. I've updated the map manager with that info.

Sometimes I think that you, Winterbay and I are the only ones who care about updating batfactors.

Am I the only one who writes their own consult script importing BatBrain instead of using WHAM?

I use WHAM. I care about BatBrain because it effects WHAM. But I have limited time and would rather thank someone (this means you Bale, and Winterbay) for their work than do it myself.
 
Right now I'm using a, slightly modified, version of zarqon's SimpleSmack consult script.

@zarqon - I keep forgetting to mention this but Batbrain/Smartstasis never seems to use Curse of Weaksauce when a Sauceror. The potential MP gain is worth the MP to cast the curse and prolong the combat for a round. My CCS handles the situation but I wish Batbrain/Smartstatsis would do so. I don't understand why it isn't.

@Bale - yours, and others, updates to Batfactors are very much appreciated.
 
Last edited:
Whoa. I didn't mean to slam anyone. I was just thinking that whenever I see an update to batfactors its just a few people involved. Mostly it just led me to my next thought that other people don't make use of BatBrain as a library to use in their own scripts. That seems unfortunate since BatBrain is so neat that other people should play with it.

PS. Thanks Crowther and heeheehee for occasional batfactor work.
 
Back
Top