BatBrain -- a central nervous system for consult scripts

I just found another BatBrain bug. This one is irksome because it means you'll have to add special case handling.

I was adventuring in the Orc Chasm today and BatBrain told me that the dictionary was a wonderful weapon to use against a buzzerker. I'm sure that the same problem would occur against Feast of Boris monsters, hipster monster or any other wandering monsters that appeared while in the Orc Chasm. If there is special handling against the Adding Machine I could not find it. Important: The Adding Machine will not take damage from the dictionary.

That's the fourth bug I found since the last BatBrain release. I'll let zarqon solve this one since I'm not sure how he wants to handle it. Anyway, I'll be out of the Orc Chasm soon and then this will cease to trouble me.

PS. Using BatBrain is fun!
 
Seems like that's another good case (much like using items that lead to combats) for mafia to consider my_location() equal to $location[none].

Let's see, we have hipster monsters, Nemesis assassins, bees, and holiday monsters. Any other location-independent monsters which come along to interrupt normal location-based adventuring? Would like to make a feature request that did its homework.
 
You can't simply say $location[none] for any of those, though. If you're in the sea, pressure penalties still matter. If someone wants to track how much delay/floor they've burned in the zone, the location matters.

That's different than using an item leading to a combat, which by all definitions (outside of mafia's code, since I have no idea how it works there) does not occur in any zone.
 
Seems like that's another good case (much like using items that lead to combats) for mafia to consider my_location() equal to $location[none].

I'm afraid that I agree with lostcalpolydude. The location is still relevant. It was pretty funny once when I had teleportitis and looking for the Oracle with my hipster equipped. Suddenly I was fighting an evil ex-girlfriend in haiku. I was all like WTF just happened?! Then I realized where I'd teleported to and it was a minute before I could pick myself up off the ground.

Not as important as pressure penalties of course, but still an interesting example.

Finally, that still won't adjust the damage for the Addding Machine. Since that monster is native to the chasm and still requires a special case, just suck it up and check if $monsters[1335 HaXx0r, Anime Smiley, Flaming Troll, Lamz0r N00b, Me4t BegZ0r, Spam Witch, XXX pr0n, Some Bad ASCII Art] contains m
 
So, KoL itself considers wandering monsters to occur in those zones. (Really? Do pressure penalties apply vs. hipster monsters if you're underwater?)

I guess the dictionary's formula has to be reworked, tying it to ALL chasm monsters rather than just the chasm itself. Annoying.

EDIT: semi-ninja'd by Mr. 50%-of-The-Posts-in-This-Thread. However, I'd prefer a solution which works in batfactors, not in ASH. I'll look into expanding the existing "monster" flag to accept multiple monsters.
 
Last edited:
Cool! Is there a way to see that by volume (word count, presumably) rather than number of posts? I bet your percentage is higher that way.
 
So. Debugging slimelingFullness resetting. I really like that feature, but it's broken in some macroified combats. Non-macroified combats work fine.

Code:
case $familiar[slimeling]: if (contains_text(lastaction,"/slimeling.gif") || contains_text(lastaction,"You get the jump") ||
         contains_text(lastaction,"You quickly conjure a saucy salve") ) break;
            print("Your slimeling needs sating.","olive"); set_happened("famspent"); set_property("slimelingFullness","0.0"); break;

My first thought was that since I'm using spamattack, I'm receiving some "twiddle" messages which aren't caught by the above. So, added contains_text(lastaction,"twiddle") to it, and it might help, but I'm still getting sporadic erroneous resets of my slimelingFullness. I think it's only when I do a stasis loop now.

Code:
[754] Battlefield (Frat Uniform)
Encounter: War Hippy Homeopath
Round 0: roippi wins initiative!
Profit per round: ActionProfitDamageOtherbase; Slimeling (-25μ)41μ8.25 (3.03 μ/dmg)MP: 8.25
Monster: War Hippy Homeopath, ATT: 180, DEF: 167, HP: 210, Value: 1279.9
You will die in 279 rounds.
Your attack will kill the monster in 3 rounds.
Round 1: roippi executes a macro!
Round 1: roippi tries to steal an item!
You acquire an item: filthy poultice
Round 2: Ecto Cooler paces around aimlessly, making wet squishy noises.
You snatched a filthy poultice (295μ)!
Revised monster value: 1192.14
Round 2: roippi executes a macro!
Round 2: roippi uses the spectre scepter!
You gain 5 hit points
Round 3: Ecto Cooler leaps on your opponent, sliming her for 22 damage. It's inspiring!
Round 3: war hippy homeopath takes 22 damage.
You gain 22 Mojo Points
Round 3: roippi uses the spectre scepter!
Round 4: war hippy homeopath takes 8 damage.
Round 4: Ecto Cooler paces around aimlessly, making wet squishy noises.
Round 4: roippi uses the spectre scepter!
Round 5: war hippy homeopath takes 8 damage.
Round 5: Ecto Cooler sniffs around, looking for something to absorb.
You lose 9 hit points
Round 5: roippi executes a macro!
Round 5: roippi uses the spectre scepter!
Round 6: war hippy homeopath takes 9 damage.
Round 6: Ecto Cooler leaps on your opponent, sliming her for 20 damage. It's inspiring!
Round 6: war hippy homeopath takes 20 damage.
You gain 20 Mojo Points
Round 6: roippi uses the spectre scepter!
Round 7: war hippy homeopath takes 9 damage.
Round 7: Ecto Cooler paces around aimlessly, making wet squishy noises.
Round 7: roippi uses the spectre scepter!
You gain 5 hit points
Round 8: Ecto Cooler leaps on your opponent, sliming her for 16 damage. It's inspiring!
Round 8: war hippy homeopath takes 16 damage.
You gain 16 Mojo Points
Round 8: roippi uses the spectre scepter!
Round 9: war hippy homeopath takes 10 damage.
Round 9: Ecto Cooler paces around aimlessly, making wet squishy noises.
Round 9: roippi uses the spectre scepter!
Round 10: war hippy homeopath drops 2 attack power.
Round 10: war hippy homeopath drops 2 defense.
Round 10: Ecto Cooler paces around aimlessly, making wet squishy noises.
Round 10: roippi uses the spectre scepter!
You gain 4 hit points
Round 11: Ecto Cooler paces around aimlessly, making wet squishy noises.
Round 11: roippi uses the spectre scepter!
Round 12: war hippy homeopath takes 10 damage.
Round 12: Ecto Cooler paces around aimlessly, making wet squishy noises.
Round 12: roippi uses the spectre scepter!
Round 13: war hippy homeopath takes 10 damage.
Round 13: Ecto Cooler leaps on your opponent, sliming her for 20 damage. It's inspiring!
Round 13: war hippy homeopath takes 20 damage.
You gain 20 Mojo Points
Round 13: roippi uses the spectre scepter!
Round 14: war hippy homeopath takes 9 damage.
Round 14: Ecto Cooler sniffs around, looking for something to absorb.
Round 14: roippi uses the spectre scepter!
Round 15: war hippy homeopath takes 10 damage.
Round 15: Ecto Cooler sniffs around, looking for something to absorb.
Round 15: roippi uses the spectre scepter!
Round 16: war hippy homeopath takes 10 damage.
Round 16: Ecto Cooler sniffs around, looking for something to absorb.
Round 16: roippi uses the spectre scepter!
Round 17: war hippy homeopath takes 8 damage.
Round 17: Ecto Cooler sniffs around, looking for something to absorb.
Round 17: roippi uses the spectre scepter!
You gain 4 hit points
Round 18: Ecto Cooler sniffs around, looking for something to absorb.
Round 18: roippi uses the spectre scepter!
Round 19: war hippy homeopath drops 3 attack power.
Round 19: war hippy homeopath drops 3 defense.
Round 19: Ecto Cooler leaps on your opponent, sliming her for 18 damage. It's inspiring!
Round 19: war hippy homeopath takes 18 damage.
You gain 18 Mojo Points
Round 19: Ecto Cooler's starting to look a little thin.
Round 19: roippi uses the spectre scepter!
Round 20: war hippy homeopath drops 3 attack power.
Round 20: war hippy homeopath drops 1 defense.
Round 20: Ecto Cooler leaps on your opponent, sliming her for 17 damage. It's inspiring!
Round 20: war hippy homeopath takes 17 damage.
You gain 17 Mojo Points
Round 20: Ecto Cooler's starting to look a little thin.
Round 20: roippi wins the fight!
After Battle: Ecto Cooler hops around, dancing a jig accompanied by wet squelching noises.
You gain 11 Strongness
You gain 15 Enchantedness
You gain a Mysticality point!
You gain 31 Smarm
16 hippies defeated; 128 down, 872 left.
Your slimeling needs sating.
slimelingFullness => 0.0

So then I took a look at what the offending lastaction was that caused the reset:

HTML:
bgcolor=blue><b>The Kingdom of Loathing</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><table cellpadding=0 cellspacing=0><tr><td colspan=5><img src="/images/otherimages/main/maintop.gif" width=350 height=50 alt="Top Edge" title="Top Edge"></td></tr><tr><td rowspan=3><img src="/images/otherimages/main/mainleft.gif" width=25 height=300 alt="Left Edge" title="Left Edge"></td><td width=100 height=100><a href="town.php"><img src="/images/otherimages/main/newmap1.gif" width=100 height=100 border=0 alt="Seaside Town" title="Seaside Town"></a></td><td width=100 height=100><a href="campground.php"><img src="/images/otherimages/main/map2.gif" width=100 height=100 border=0 alt="The Campground" title="The Campground"></a></td><td width=100 height=100><a href="mountains.php"><img src="/images/otherimages/main/map3.gif" width=100 height=100 border=0 alt="The Big Mountains" title="The Big Mountains"></a></td><td rowspan=3><img src="/images/otherimages/main/mainright.gif" width=25 height=300 alt="Right Edge" title="Right Edge"></td></tr><tr><td width=100 height=11><img src="/images/otherimages/main/map4.gif" width=100 height=100 alt="Nothing" title="Nothing"></td><td width=100 height=100><a href="plains.php"><img src="/images/otherimages/main/map5.gif" width=100 height=100 border=0 alt="The Nearby Plains" title="The Nearby Plains"></a></td><td width=100 height=100><img src="/images/otherimages/main/map6blank.gif" width=100 height=100 alt="Nothing" title="Nothing"></td></tr><tr><td width=100 height=100><a href="beach.php"><img src="/images/otherimages/main/map7beach.gif" width=100 height=100 border=0 alt="Desert Beach" title="Desert Beach"></td><td width=100 height=100><a href="woods.php"><img src="/images/otherimages/main/map8.gif" width=100 height=100 border=0 alt="The Distant Woods" title="The Distant Woods"></a></td><td width=100 height=100><a href="island.php"><img src="/images/otherimages/main/island.gif" width=100 height=100 border=0 alt="The Mysterious Island of Mystery" title="The Mysterious Island of Mystery"></a></td></tr><tr><td colspan=5><img src="/images/otherimages/main/mainbottom.gif" width=350 height=50 border=0 alt="Bottom Edge" title="Bottom Edge"></td></tr></table></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center></body><script src="/onfocus.js"></script></html>

So, yeah. That's a chunk of main.php. I guess that macroified fight.php is getting redirected to main.php after the fight is done, somehow. That in turn is doing bad things to slimeling detection, since main.php doesn't have slimeling.gif on it. Aaand I don't know enough about macros to debug further.
 
@roippi: Evidently SS submitted a macro after the combat was over, which redirects to main.php.

Rather than checking for fast rounds such as jump/salve/twiddling, is there some other text that always appears on fight pages, but not for a fast action? Something about the monster's action perhaps? I wish KoL added more comments like the <!--WINWINWIN--> one, to indicate various sections. Like <!--familiar action--> or <!--monster attack/fumble/critical-->. Would be a huge help to both spaders and scripters. Oh well.

I'll remove the "overly helpful" slimelingFullness reset for now, since it seems to be doing more harm than good.

Working on BB at the moment -- actually have some time for once! I'm aiming for an update today.
 
Rather than checking for fast rounds such as jump/salve/twiddling, is there some other text that always appears on fight pages, but not for a fast action? Something about the monster's action perhaps? I wish KoL added more comments like the <!--WINWINWIN--> one, to indicate various sections. Like <!--familiar action--> or <!--monster attack/fumble/critical-->. Would be a huge help to both spaders and scripters. Oh well..

If such a thing exists, I'll gladly add the necessary native functionality to mafia.
 
The answer is a few pages back now, but change that line to say "Demon of New Wave" instead since the name changed in Mafia's internal database.
 
I finally figured out the problem with my plinking function: Another BatBrain bug!

BatBrain will automatically cast Stealth Mistletoe before a DB deleving skill, but unfortunately it doesn't know thathappened("mistletoed") means that a.att and a.def are doubled! (It also doesn't recognize plurality effects.)

I think that we need a function that reports how much actual deleving will happen against a given monster based on mistletoe and monster plurality.


Edit: In the meantime I think I'll build this into my script, rather than modify BatBrain. It seems easier.
 
Last edited:
From BatBrain, in the mistletoe code

PHP:
      set_happened("mistletoed");    // TODO: reset this when resetting the queue!

Actually, thinking about this, I don't believe that is the best way to handle the problem. I think you'd be better off if there was a global variable containing the current queued status of mistletoe. You'd replace that line with...

PHP:
      mistletoed = true;    // reset this when resetting the queue!

And in reset_queue...

PHP:
boolean mistletoed;
void reset_queue() {
   mistletoed = happened("mistletoed");

When mistletoe is queued mistletoed is set to TRUE. Then when reset_queue() is called, mistletoed would be restored to happening("mistletoed"). You check the value of mistletoed rather than happening() if you need to know the currently queued value.



Lately I've been playing with my combat script more than I've been playing with KoL. That's both fun and annoying at the same time.
 
Last edited:
It's been six whole days since I posted in this thread. Is that a record for me? Anyway, I thought I'd share this little function that filters out all skills that cannot be used with my current equipment and also removes all skills that will cause me to get Cunctatitis. I hate Cunctatitis. The reason that I use a matcher is because BatBrain appends #bander when I'm using a bandersnatch. Is that a good thing?

PHP:
boolean ok(advevent a) {
	matcher aid = create_matcher("(skill |use |attack|jiggle)(?:(\\d+),?(\\d+)?)?",a.id);
	if(aid.find())
		switch(aid.group(1)+aid.group(2)) {
		case "skill 2005": //Shieldbutt
		case "skill 2105": //Head + Shield Combo
		case "skill 2106": //Knee + Shield Combo
		case "skill 2107": //Head + Knee + Shield Combo
			if(item_type(equipped_item($slot[off-hand])) != "shield") return false;
		case "skill 1003": //Thrust-Smack
		case "skill 1004": //Lunge-Smack
		case "skill 1005": //Lunging Thrust-Smack
		case "skill 2003": //Headbutt
		case "skill 2015": //Kneebutt
		case "skill 2103": //Head + Knee Combo
			if(weapon_type(equipped_item($slot[weapon])) == $stat[Moxie]) return false;
		case "attack":
			if(m == $monster[Procrastination Giant] && weapon_type(equipped_item($slot[weapon])) != $stat[Moxie]) return false;
		}
	return true;
}
 
I had to make some additions to batfactors so that my combat script would work. (I admit to having made a few approximations in the absence of spading.) Unfortunately I cannot add it to the map manager since that isn't fully working. Could you update the map manager yourself?

Code:
skill	66	Flying Fire Fist	51	hot	
skill	67	Stinkpalm	51	stench	
skill	68	Seven-Finger Strike	pref(fistSkillsKnown)*7	physical	
skill	69	Knuckle Sandwich	51	physical	att -3*pref(fistSkillsKnown)
skill	70	Chilled Monkey Brain Technique	48	cold	stun 1
skill	71	Drunken Baby Style	70+(5*D)	physical	
skill	73	Zendo Kobushi Kancho	51	sleaze	def -3*pref(fistSkillsKnown)

The biggest problems with that is that I don't know how to adjust the damage for Flying Fire Fist to + 5*(turns of Salamanderenity) or adding 70 to the damage for Seven-Finger Strike if the Earthen Fist effect is active. Is there any way to include effects in a damage calculation?

Finally, Drunken Baby Style's damage is different depending on knowing another skill. I'm not sure how to add that into the calculation either.
 
I believe that you wpuld either have to hard code the damage formulae in batbrain or create new fvars to be set to the correct values depending on what it is that controls them.
 
Hi guys,

I'm using the current versions of batbrain and smartstasis but I'm seeing error messages in the gCLI......
PHP:
The string "5003; skill 5005; skill 5008" does not look like an integer; returning 0 (BatBrain.ash, line 984)
I then goes on to do the disco concentration combo anyway.

....which brings me to a suggestion:

If I don't care about getting a drop from a monster and display my disinterest by not equipping a fairy, would it be possible for SS not to identify this and not use Disco Concentration?
 
Back
Top