BatBrain -- a central nervous system for consult scripts

zarqon

Well-known member
Haha! Unfortunately the "item" keyword doesn't support multiple items at the moment.

If you chose dried face because it had to be 7 meat, the new hack could use dwarf bread, big dribbly candle, or soup-chucks, all of which autosell for 21 meat. :)

As of my just-now check, I got these results:

Cold Hots (50)
daffy taffy (30)
Mr. Mediocrebar (50)
senior mints (50)
wint-o-fresh mint (50)​

for an average of 46 meat -- times 0.33, gives us 15.18. Still high. Three of those have an autosell price of 0. If we valued those as worthless rather than minvaluing them at 50, we'd get:

Cold Hots (0)
daffy taffy (30)
Mr. Mediocrebar (50)
senior mints (0)
wint-o-fresh mint (0)​

for an average of 16, times 0.33 is 5.28. This would solve our issue but would create others, as BatBrain would start treating similarly-situated items in your inventory as "free". Ewww.

The fix is probably to simply adjust Batbrain's multiplier, which while less accurate, is more accurate than using a completely different item. I'm thinking 0.13, since that would make Candyblast's item yield profit to be 6, nicely between the above number and a dried face. :)

That fix will be in r7.

By the way, the r6 update was nonfunctional changes paving the way for some goodness, also to come in r7. Will explain in the r7 notes.
 

Crowther

Active member
Cold Hots (0)wint-o-fresh mint (0)​

Candyblast's item yield profit to be 6, nicely between the above number and a dried face. :)
Wint-o-fresh mint will be used by UR for 2-3MP. That's why my estimate of meat returned per Candyblast was slightly higher than yours. That's not really important.

Sigh. I do wish there was a cleaner fix, but at least that will work.
 

Bale

Minion
Wint-o-fresh mint will be used by UR for 2-3MP. That's why my estimate of meat returned per Candyblast was slightly higher than yours. That's not really important.

Heh. Maybe we should fix it by not having a list of items. Instead of listing the actual items dropped, we could list the VALUE of all drops. It would solve this and all future problems. Even though we might argue over specifics such as the price of a wint-o-fresh-mint we'll still have a way to express it. It's all about the meat. Even better, we could add an evaluable expression which causes Cold Hots and senior mints to be worth 0 meat in hardcore, but mall value in aftercore. Add up all autosale values for hardcore, mall values for softcore and let modifier_eval() sort out which value is used.

This would also allow you to remove the special handling for candyblast!
 

zarqon

Well-known member
r7 Update!

The updates are flowing like honey here in BatBrain-land. Or actually, like superfluid helium, which has a viscosity of 0! And you, the user or interested party perusing this post, have no inconvenience as a result! I also got new vanity plates on my car: LUV4SVN

This update finally unlocks the door which was keeping out all the custom actions from BatBrain's internal options list (opts). Now opts contains all the custom actions which are present in batfactors.

Isn't that dangerous? you ask. Weren't custom actions flagged as such because BatBrain doesn't understand their results, or because it's undesirable for BatBrain to use them? you ask. Wouldn't allowing them into opts be like letting little aliens onto the playground with our children? you ask.

Yes. But that's why BatBrain (and WHAM) now filter out custom actions from their recommended action sorts, so they will never be used in ordinary automation despite being in the mix with all the other actions. This means that we can have the benefits of custom actions being present in opts:

  • Calling scripts can access these actions using get_action() rather than using a constructor to build the event in-script.
  • Since the action is loaded just like regular actions, the formulas/results are now publicly editable in batfactors.
  • Custom actions will be present in your Actions Table in BatMan RE, which means you can easily submit it macro-fied (and thus tracked) without needing to switch to the KoL tab to find and submit a non-tracked version.
  • Limited-use Jarlsberg chefstaves can be flagged as "custom" meaning that we don't have to go all-or-nothing by blacklisting "jiggle" itself.

without the obvious disadvantage of BatBrain recommending, say, Spooky Putty as a stasis option.

The other change in this update is the aforepromised Candyblast hack. I believe we have seen the end of the flurries, if not the discussion.

Enjoy!

@Bale: Actually, I'd like to keep lists of items -- I have plans to integrate has_goal() into SmartStasis, so if you were going into a fight with a goal of Cold Hots, SmartStasis would use Candyblast if possible until the Cold Hots drop. Or likewise, with a Crimbo Elf enthroned, it would stasis until Cold Hots drop.

This does present a very interesting possibility: ZLib's sell_val() could share UR's data file and consider HP/MP gain from using an item in its calculations. The profit from MP/HP gain is fairly straightforward whereas sometimes the value of an item is not, as with wint-o-fresh mints. When evaluating said mints, it could first check mall price and return that unless it's at minimum, in which case it could return whichever is higher: autosell value, or profit from HP/MP gain. The only problem I can see this possibly causing is circular logic if UR is using sell_val() to evaluate restorative items. The downside is an additional data file loaded per BatBrain instance (although only if there are items being evaluated, which isn't quite every combat). What do you think?
 

roippi

Developer
r7 Update!

The updates are flowing like honey here in BatBrain-land. Or actually, like superfluid helium, which has a viscosity of 0! And you, the user or interested party perusing this post, have no inconvenience as a result! I also got new vanity plates on my car: LUV4SVN

:D
 

Winterbay

Active member
That's a good idea. But let's add it to the monster event instead, that's a better place for it. r4.

Also moved the list of monsters that always hit from m_hitchance() into set_monster(). I'm trying to consolidate most of the monster attributes that might require large lists there, setting global flags which can then be efficiently and quickly checked by functions elsewhere.

Now that updates aren't an annoyance for users, I don't need to wait until I have a big batch of updates to release all at once. SVN FTW!

ETA: r5 starts to address the recent flurry of Candyblast reports by letting BatBrain know the candy drop rate is only 33%, not 100%.

The pufferfish change works great, now instead of throwing all the rave and disco combos and killing me WHAM throws some of them leaving enough rounds left for me to kill the pufferfish. Nice!
 

zarqon

Well-known member
r8 Update!

I finally realized the best way to deal with all these monster lists for stun immunity, always hitting, resistances, plural monsters, etc. Since there are actually quite a few of these attributes that are not known to mafia, I added a new "monster" category to batfactors, and painstakingly moved the vast majority of special monster attribute information there!

BatBrain is now more than 100 lines shorter.

We take more of a hit loading the data file now, because batfactors is bigger by about the same amount that BatBrain is smaller. It's worsened by the fact that we still traverse the entire data file to collapse ranges and normalize damage types, and we can't skip any monsters since our monster is still unknown at that point (a calling script may also want to simulate combat with a variety of monsters sequentially). However, there are two big wins: 1) we no longer need to load pluralMonsters.txt, and 2) soft damage caps are loaded in set_monster(), so dmg_dealt() can now just use the new global damage cap variables rather than switching on a list of monsters every time. Considering that set_monster() is typically called once, whereas dmg_dealt() is called hundreds or even thousands of times depending on the calling script and the number of options the player has, that makes for a pretty big win. There are several other performance wins, such as presence-only information rather than presence/absence checks in all cases, or checking variables rather than lists, but those aren't as big a deal.

I've updated the batfactors Wiki page with information about the new category and available keywords. It should be much easier now to add most of the special attributes of new monsters, without needing to edit the script. Yay!

One other update which will hopefully address an issue I spotted on the WHAM thread. Evidently some users had blacklisted actions with a value of -1. The blacklist should not contain negative values, but in the event that it does, it makes sense to treat those as 0 rather than start manifesting bizarre errors due to trying to keep -1 of an item in reserve (what?) or somesuch. So this update also makes BatBrain robust against blacklist user input error.

Enjoy!

@Frono and Winterbay: Thanks very much for the positive comments! The ratio of encouragement to pointing out problems seems to have shrunk over the last several years, somehow, and your encouraging words thawed the cockles of my heart. It makes me miss Dangerpin -- he was a veritable font of encouragement, he was.
 

Magus_Prime

Well-known member
The combination of Batbrain, Smart Stasis, and WHAM have done more to decrease the fiddly annoyances and increase the enjoyment I get from KoL than anything except the existence of KoLMafia itself.
 

Palinathas

New member
I think Magus speaks for many of us. I played KoL off and on, discovered greasemonkey scripts, and then finally found Mafia. I tried it out, said "hmm this is cool, but it doesn't really DO much except give me some extra info, I thought it was supposed to actively help me" Then I found these wonderful scripts that DO something, and that something is make my enjoyment of KoL greater. No longer am I blindly bumbling, I am instead strategically planning, and then having fun, letting the hard work of those who have created these scripts do the actual dirty work.

In short, Thank you!
 

Crowther

Active member
I think UR was the first script that really made me say, "Wow, now I can stop sweating this piddly stuff." I'm not sure I'd be playing without these scripts. You can decide if that's a good or a bad thing. ;)
 

fronobulax

Developer
Staff member
The combination of Batbrain, Smart Stasis, and WHAM have done more to decrease the fiddly annoyances and increase the enjoyment I get from KoL than anything except the existence of KoLMafia itself.

I second that and would add EatDrink, Universal Recovery and BCCAscend to the list.

I hope my comments continue to thaw the cockles of your heart. I'd rather be part of the solution than the problem.
 

Winterbay

Active member
I'd like to request the addition of a "noskills" field for monsters in batfactors and also it appears that at least some of the bosses in the suburbs of dis are not intended to use funkslinging against. So it appears it would be a good idea to have a way of indicating that we do not want to funksling.
 

Darzil

Developer
I'd like to request the addition of a "noskills" field for monsters in batfactors and also it appears that at least some of the bosses in the suburbs of dis are not intended to use funkslinging against. So it appears it would be a good idea to have a way of indicating that we do not want to funksling.

One of the Dis monsters, The Thorax. Rest are fine to funksling against.
 

zarqon

Well-known member
r9 Update

BatBrain now supports both "noitems" and "noskills" keywords in batfactors. They can also include an optional float value, which represents the monster's chance of blocking the action.

For instance, I added The Bat in Spats to batfactors, specifying "noskills". That means he prevents all skill use. I also added the Bonerdagon, specifying "noskills 0.25", meaning he blocks skills 25% of the time. In making this transition I updated batfactors for the Naughty Sorceress's forms as well (and discovered in the process that BatBrain didn't know about her soft damage cap, so added that in as well).

I also started adding support for other Dis mechanics, as I could find on the Wiki and in the WHAM thread:

  • Mammon does not have a regular attack. Instead, his damage formula is 2^(round - 1). I also specified in batfactors that he always hits. This doesn't properly account for stunning (that would require a counter of some sort -- could probably be accomplished with happenings) but it's much better than what was there.
  • Don't auto-funk vs. The Thorax, since it would waste clumsiness bark.
  • Regular attacks that are not criticals always miss The Bat in Spats.

I didn't account for the Dis demons' resistances yet -- evidently some/all of them have something but it is not listed on the Wiki -- but it does present a problem as adding universal resistances would make it impossible to specify the greater damage from our custom items. I still think adding it would be better than not, since in that case BatBrain won't think it can easily kill them with regular actions, but I haven't done that yet. Most of them seem to be especially damaged by certain items -- do they resist all damage not from those items?

While I was making this change (I converted other skills/items-blocking monsters to use the new keywords rather than checks in the script), I noted that the Bonerdagon no longer destroys blocked items, and so removed that check from BatBrain. Did that change affect the Sorceress too? Wiki mentions nothing.

Enjoy this partial update! hehehe
 
Last edited:

Winterbay

Active member
While I was making this change (I converted other skills/items-blocking monsters to use the new keywords rather than checks in the script), I noted that the Bonerdagon no longer destroys blocked items, and so removed that check from BatBrain. Did that change affect the Sorceress too? Wiki mentions nothing.

It does. I think it's also true for the black cat, but I'm less sure there.

Edit: Also, what does the first and second field of the monster-part in batfactors actually mean? And man is it annoying to add a new monster when they are sorted alphabetically, meaning you need to update all the index numbers after the one you're adding... (I intended to add the bat in the spat which is why the noskills predicate came up)
 
Last edited:

lostcalpolydude

Developer
Staff member
While I was making this change (I converted other skills/items-blocking monsters to use the new keywords rather than checks in the script), I noted that the Bonerdagon no longer destroys blocked items, and so removed that check from BatBrain. Did that change affect the Sorceress too? Wiki mentions nothing.

Yes. TPTB probably got tired of dealing with bug reports from people losing Mr. Store items.

I think it's also true for the black cat, but I'm less sure there.
You never lost those items.
 

Bale

Minion
Correct. Monster drops that you might have found get knocked into the sewer and were lost forever. Combat items you attempted to use were batted under the couch and got retrieved.
 
Top