BatBrain -- a central nervous system for consult scripts

Ah ha. You obviously typed "update data" into the CLI at some point, which downloaded ALL the data file - current as of when you did it. My advice?

Don't Do That.
 
Updates mixed with assorted responses.

I added Theraze's changes to hitchance for those additional skills, with a few tiny tweaks. Thanks! While I was at it, I made fumbles only apply to actual attacks with your weapon, and slightly altered the attack line to account for the attack chance being a percent of non-criticals, as xKiv mentioned. Moved the booty crab to the 25% resistance section. Didn't add elemental resistance for top-tier bees yet since the Wiki only mentions elemental "spell resistance", not vanilla "resistance."

@Theraze: BatBrain does not consider bonus turtlegear damage for the various butts. I remember thinking about that for 0.11 seconds before immediately getting a headache and deciding to postpone that for another day -- but that was back before the data files had all been consolidated into batfactors. If this can't be added programmatically, it's another good thing to add to batfactors.

You're mostly right about checking stats against ML adjustment to determine unknown stats. It's not needed anymore -- except for basement monsters, which still have their stats equal to ML adjustment. However, since presently consult scripts don't even work in the basement, I removed those checks.

Are the top-tier bees the only known monsters with delevel resistance? This isn't difficult to add.

@Winterbay: Re: Harpoon! Thanks for fleshing out that placeholder formula. I'm reluctant to add so many fvars just for a single skill, so instead I hardcoded Harpoon a la Clobber. Consider that skills are completely rebuilt between each server hit -- and the entire map of fvars is submitted to eval() for every formula evaluated, even if the formula is as simple as "10".

Re: Spiciness. Thanks for bringing this up again, it reminded me to look into this. Your solution isn't quite correct, since Spiciness doesn't actually add a flat 10 damage at lower levels. So instead I accounted for Spiciness by moving the assignment of that particular fvar into the skills-building loop; it should do nicely, without requiring a separate fvar:

PHP:
      fvars["spelldmg"] = numeric_modifier("Spell Damage");
      if (have_skill($skill[intrinsic spiciness]) && to_class(to_skill(sk).class) != $class[sauceror]) fvars["spelldmg"] -= min(my_level(),10);

Aside: Evidently the 'class' field for skills returns a string. Not sure if this is an oversight or not, so I mentioned it in my latest bug report.

@garjon: Quite the opposite, actually. The "break" command means that the following code in the switch statement will not be executed.

@xKiv: Thanks, but that's a lots-of-server-hits method. Right now this works:

PHP:
boolean is_spell(skill s) {
   if ($classes[pastamancer,sauceror] contains to_class(s.class)) return true;
   if (s.to_int() > 27 && s.to_int() < 44) return true;   // hobopolis spells
   return ($skills[lasagna bandages,volcanometeor showeruption] contains s);
}

But I'm considering just adding this as a keyword in batfactors instead. I guess I'll start figuring out which monsters have spell resistance/immunity. So far, all I've done with this is add the Beer Golem's spell blocking, but that doesn't work yet since mafia can't recognize that monster. Others to follow.

I also accounted for the Clockwork Apparatus transforming fumbles into various beneficial effects.

I'll be starting my first Beecore run tomorrow, so more likely than not I'll finally get more aggressive about support for bees. :)

Enjoy!
 
Last edited:
Looking forwards to the inevitable tweaks and upgrades that will come from your new fun challenge fun. At least, I hope it's a fun challenge run. :)

Regarding the basement monsters... they're not supposed to be unknown anymore. They had placeholder stats since the scaling monster code was added, and with Veracity rolling in the rest of my monsters.txt updates yesterday, they should now have Darzil's actually spaded stats in. That should mean that they provide the proper stat, not just ML, and that consult scripts SHOULD work against them...
 
I added Theraze's changes to hitchance for those additional skills, with a few tiny tweaks.
How come I always see that word as "hitch-ance"? As in "observ-ance" or "reflect-ance" or the like.
Now you have to see it that way, too. >:-)
 
Not sure why, but with the latest version, it's not calculating get_action("attack") very well...
You will die in 9782 rounds.
Your attack will kill the monster in 480000 rounds.
That'd be on a Knob Goblin Bean Counter while I'm level 13, the message SmartStasis gives when the fight starts...
 
After updating BatBrain, SmartStasis seems to have started spamming LTS until I either run out of MP or I manage to finally get critical hit (I'm running enough ML to always miss without a crit). When I equip a ranged weapon, it apparently still tries to use LTS, since it aborts with "This skill is useless with ranged weapons."
 
LTS shouldn't ever get used by SmartStasis, since it's a, well, stasis script. What else do you have in your CCS?
 
@garjon: Quite the opposite, actually. The "break" command means that the following code in the switch statement will not be executed.

I'm watching it execute, actually...

Code:
Monster: The Axe Wound, ATT: 227, DEF: 205, HP: 214, Value: 944.73
Profit per round: ActionProfitDamageOtherbase; Slimeling (-30.0μ)117.6μ18.45 (1.63 μ/dmg)MP: 18.45
Your slimeling needs sating.
slimelingFullness => 0.0
You will die in 15 rounds.
Your attack will kill the monster in 2140000 rounds.
You have the latest use_for_items.txt.  Will not check again today.
19/19 monsters drop goals here.
Custom action: use 2405 (no stun)
Round 1: garjon executes a macro!
Round 1: garjon uses the rock band flyers!
Round 2: FridgeRaider leaps on your opponent, sliming it for 41 damage.  It's inspiring!
Round 2: the axe wound takes 41 damage.
You gain 41 Muscularity Points
You lose 20 hit points
Round 2: garjon casts ENTANGLING NOODLES!
Round 3: FridgeRaider paces around aimlessly, making wet squishy noises.
Round 3: garjon casts SHIELDBUTT!
Round 4: the axe wound takes 8 damage.
Round 4: the axe wound takes 16 damage.
Round 4: the axe wound drops 5 attack power.
Round 4: FridgeRaider sniffs around, looking for something to absorb.
Round 4: garjon casts SHIELDBUTT!
Round 5: the axe wound takes 10 damage.
Round 5: the axe wound takes 24 damage.
Round 5: the axe wound drops 5 attack power.
Round 5: FridgeRaider leaps on your opponent, sliming it for 36 damage.  It's inspiring!
Round 5: the axe wound takes 36 damage.
You gain 36 Muscularity Points
You lose 12 hit points
Round 5: garjon casts SHIELDBUTT!
Round 6: the axe wound takes 9 damage.
Round 6: the axe wound takes 19 damage.
Round 6: the axe wound drops 5 attack power.
Round 6: FridgeRaider leaps on your opponent, sliming it for 25 damage.  It's inspiring!
Round 6: the axe wound takes 25 damage.
You gain 25 Muscularity Points
You lose 11 hit points
Round 6: garjon casts SHIELDBUTT!
Round 7: the axe wound takes 8 damage.
Round 7: the axe wound takes 25 damage.
Round 7: the axe wound drops 5 attack power.
Round 7: FridgeRaider sniffs around, looking for something to absorb.
Round 7: garjon wins the fight!
After Battle: FridgeRaider hops around, dancing a jig accompanied by wet squelching noises.
You acquire an item: line
You acquire an item: line
You gain 41 Strengthliness
You gain 15 Enchantedness
You gain 9 Chutzpah
 
Last edited:
Might need to have "You twiddle your thumbs" added or any other such pages, regarding garjon's bug? Since similar to "You get the jump" it means that there's currently a non-action fight.php page.
 
@adeyke: SmartStasis will prolong combat using any profitable low-damage skill available to you, including LTS. If you have a ranged weapon equipped and KoL itself gives an abort error there without consuming a round, then the error is in BatBrain for considering the skill available. If on the KoL side it just spends a round without doing anything (the goal of stasis) and the abort is generated by mafia, the error is in mafia. Probably the error is in BatBrain -- although why the skill appears in your drop-down menu in KoL is a mystery if it's just going to result in an error.

@garjon: Slimeling fullness detection evidently still needs a little work. The code is correct, but evidently another case has arisen, such as Theraze mentioned. A lot of things are getting broken by macrofication these days. It's really annoying to debug macro/ASH interaction problems since it silently aborts without giving us a clue what happened and we have no feedback without turning on debug logging and then painstakingly searching through the debug log for instances where the problem occurred, so this might take some time to fix. If you would like to post a debug log from a combat where the problem occurred, it could speed things along. In the meantime, you could remove that command which adjusts the preference, since it's a feature which has evidently become a bug.
 
Why lts though? I have every skill permed and I just noticed it's using lts to stasis (also headbutt sometimes?). Wouldn't something cheaper be way more effective, like the 0mp class combat skill or a seal tooth or spices or something else?

Also I noticed it was spending a ton of mp on salve to cap off my hp, but it seemed to only be draining my mp reserves when I could just cast cocoon when the combat finished for cheaper. It's just once I started using smartstasis I feel like it's actually using more mp then its generating. I'm doing a 100% hipster run in beecore and I'm really feeling the mp drain even with a spring raindrop attack firing every turn, and when my ccs was just using "entangling noodles, spring raindrop attack, shieldbutt", I feel like I had consistently had more mp.
 
Last edited:
If it aborts as non-functional, doesn't it abort with a 0 actual mp cost? Or does it still use the mp, despite failing to execute?

Edit:
Bizarre twist on the attack kill_rounds thing... apparently mysticality classes have proper kill_rounds, muscle classes it expects tens of thousands ranging up to millions of rounds to finish off weak treasury mobs...
 
Last edited:
I'm at a loss for why it thinks prolonging combat is a good idea in my situation. I don't think I was wearing anything with a chance of good things happening per round, and I was just using a purse rat as familiar. So no Crown of Thrones and no stasis familiar. What was happening is that each round, it would use LTS and miss and the opponents would just bash themselves against my saucespheres. This continued until I either got the crit and killed them, or I ran out of MP and had to finish the combat in the relay browser.

This behavior really perplexes me. If it was trying to prolong combat, it could have used a cheaper skill, normal attack, or a facsimile dictionary. Those would have less cost and less chance of ending combat prematurely. On the other hand, if it was trying to end the combat, it could have used shieldbutt or a spell. Sometimes it did use headbutt (that matches Rinn's observation), but that's hardly a big improvement.

As for the ranged weapon, I think SmartStasis is generating a macro with a melee skill and KoL is then giving an error about the macro not working because of the ranged weapon.
 
Found the kill_rounds error -- we shouldn't name the fumble event or it adds to the ID of attack, meaning that get_action() won't find it anymore.

I also think I figured the LTS thing out. Factoring all options by hitchance is also factoring the MP cost of skills. Will have to rework -- or unwork -- how that's done. Will post an update as soon as I have that sorted.

In the case of restoring in combat when you have better out-of-combat options, you're probably not using Bale's UR, so the script is not very informed about the value of HP/MP. If you're not using UR, your HP value is based on your cheapest NPC restore, or a scroll of drastic healing, whichever gives the best rate. MP is calculated based on your cheapest NPC restore. So in mid-run levels, it's understandable that Salve would be seen as profitable. For better results, either use UR or trick SS by setting your own values for _meatpermp and _meatperhp (these are daily properties which SS reads using get_property()).
 
Good enough... commenting out the fumble merge line fixes my problem for now, though it does mean that fumbles aren't taken into account. Not a major issue when you're mostly dealing with easy kills though. :)
 
In the case of restoring in combat when you have better out-of-combat options, you're probably not using Bale's UR, so the script is not very informed about the value of HP/MP. If you're not using UR, your HP value is based on your cheapest NPC restore, or a scroll of drastic healing, whichever gives the best rate. MP is calculated based on your cheapest NPC restore. So in mid-run levels, it's understandable that Salve would be seen as profitable. For better results, either use UR or trick SS by setting your own values for _meatpermp and _meatperhp (these are daily properties which SS reads using get_property()).
I've been using universal recovery for years now.

Code:
_meatperhp=0.84577113
_meatpermp=17.0

That seems about right in a bees run without access to any decent mp restores.
 
Last edited:
Found the kill_rounds error -- we shouldn't name the fumble event or it adds to the ID of attack, meaning that get_action() won't find it anymore.

That was privately driving me crazy! Thank you! I made the change to fumble() and it works like a charm.
 
@Rinn: Huh. At those values Salve is definitely not profitable, so I can't say why SS is casting it. Perhaps fixing this hitch-ance business will sort it out.

@Theraze: Just change the "fumble" to a "" and you'll be accounting for fumbles again. I'll try to get an update done in the next hour before work starts, but I'm also in the middle of trying to fix some Ubuntu issues that sometimes make the computer unusable. We'll see.

I should mention, all of this get_action() business is not the ideal use of BatBrain. Ideally, scripters would sort opts[] based on the criteria they want and then enqueue the first acceptable match -- like stasis_action() and stun_action() do. That is the reason for opts being indexed by an integer rather than the ID itself. Knowing the action name is unimportant. But old habits die hard, and we've been writing CCS's and scripts using action names for quite a while.

EDIT: And done. Should be fixed, and hopefully stable for a while. Too many updates lately.
 
Last edited:
Back
Top