BatBrain -- a central nervous system for consult scripts

Another option:
Code:
> ash import <zlib.ash> rnum(10000).replace_string(",","").to_string();

Returned: 10000

> ash import <zlib.ash> rnum(10000);

Returned: 10,000
Using replace_string to excise the commas. Considering making a rnumb (for bare, or just a continuation of the number word) in zlib and changing the BatBrain calls to use rnumb instead of rnum. With rnumb being:
Code:
string rnumb(int n) {
   return to_string(n,"%,d").replace_string(",","");
}
string rnumb(float n, int place) {
   if (place < 1 || to_float(round(n)) == to_float(to_string(n,"%,."+place+"f"))) return rnumb(round(n));
   return replace_all(create_matcher("0+$", to_string(n,"%,."+place+"f")),"");
}
string rnumb(float n) { return rnumb(n,2); }
 
Last edited:
Getting the following (verbosity = 10):
> ashq run_combat();

1 HP costs 0.129μ. ( 456 / 495 )
1 MP costs 2.615μ. ( 403 / 439 )
WHAM: We currently think that the round number is: 0 and that the turn number is 7256.
WHAM: Checking to see if WHAM sould adjust the unknown_ml for pygmy headhunter.
WHAM: No need to do anything with pygmy headhunter.
WHAM: Setting up variables via BatBrain
Setting monster to pygmy headhunter...
briefcase (60.0 @ +128.9): 228μ * 100% = 228
headhunter necktie (5.0 @ +128.9): 340μ * 11.45% = 38.91
pointed stick (10.0 @ +128.9): 350μ * 22.89% = 80.12
world's smallest violin (5.0 @ +128.9): 210μ * 11.45% = 24.03
pygmy papers (20.0 @ +128.9): 5μ * 45.78% = 2.29
Value of stat gain: 575.21μ
Loading batfactors...
Updating batfactors.txt to '2014-11-29T01:41:03-06:00'...
...batfactors.txt updated.
Processing batfactors...
Factoring in Jalapeño Saucesphere: 3 damage, retal
Factoring in Scarysauce: (6) damage, retal
Events created: Jalapeño Saucesphere, Scarysauce
Base round: damage, player damage, 0 meat
ATT: 135 (6% × (10.28), death in 456)
DEF: 125 (95.45% × 603.9, win in 1)
HP: 153, Value: 2,106.73 μ, RES: 0 (-1) (1) (-1)
Parsed round number: 3
Building options...
Events created: attack, (blank)
Evaluating '-(300+zone(sea)*(495.0-456.0))'...
Evaluating '-min(0.25*495.0,0.5*(495.0-456.0))'...
Events created: use 2, use 27, use 181, use 185, use 234, use 344, use 345, use 347, use 353, use 357, use 452, use 465, use 466, use 469, use 474, use 518, use 546, use 547, use 548, use 549, use 550, use 559, use 563, use 610, use 613, use 630, use 747, use 819, use 820, use 821, use 822, use 823, use 824, use 825, use 826, use 827, use 829, use 1159, use 1316, use 1334, use 1335, use 1336, use 1704, use 1705, use 1777, use 1788, use 1965, use 2091, use 2237, use 2341, use 2396, use 2402, use 2437, use 2438, use 2492, use 2538, use 2562, use 2563, use 2565, use 2575, use 2606, use 2617, use 2678, use 2704, use 2848, use 2947, use 2966, use 3039, use 3040, use 3403, use 3480, use 3594, use 3726, use 3729, use 3734, use 3741, use 3744, use 3809, use 3923, use 3977, use 3985, use 4011, use 4012, use 4013, use 4014, use 4016, use 4084, use 4198, use 4208, use 4251, use 4454, use 4582, use 4586, use 4594, use 4595, use 4598, use 4603, use 4698, use 4948, use 5370, use 5528, use 5531, use 5532, use 5678, use 5980, use 5983, use 5988, use 5989, use 5997, use 5999, use 6027, use 6028, use 6029, use 6043, use 6135, use 6414, use 6711, use 6738, use 6832, use 6864, use 6865, use 6866, use 7013, use 7014, use 7015, use 7099, use 7260, use 7266, use 7383, use 7513, use 7518
Evaluating '1.0*3+max(0,songduration-10)/3'...
Expression syntax errors for 'modifier_eval()':
Can't understand songduration-10)/3
Expected ), found (zlib.ash, line 186)
You're on your own, partner.
Click here to continue in the relay browser.

I assume it is probably a "batfactors.txt" related issue but I don't really understand that file enough to feel comfortable poking to much. The only line that looked relevant is "skill 6032 Accordion Bash 0 0 once, stun accordion*3+max(0,songduration-10)/3". What do I need to change to fix this?

Edit: Is there supposed to be a space or a tab between the words "stun" and "accordion"? Because it looks like it should probably be a tab but it seems to be a space.
 
Last edited:
No, the space is right. Zlib should not be seeing "songduration" that should have been replaced by a value, just like "accordion" was replaced by 1.0. This line sets that up:
Code:
   if (have_skill($skill[accordion bash]) && item_type(equipped_item($slot[weapon])) == "accordion") fvars["songduration"] = numeric_modifier(equipped_item($slot[weapon]), "Song Duration");
I don't see anything wrong with it. I assume you have the skill accordion bash and you are wearing an accordion.
 
No, the space is right. Zlib should not be seeing "songduration" that should have been replaced by a value, just like "accordion" was replaced by 1.0. This line sets that up:
Code:
   if (have_skill($skill[accordion bash]) && item_type(equipped_item($slot[weapon])) == "accordion") fvars["songduration"] = numeric_modifier(equipped_item($slot[weapon]), "Song Duration");
I don't see anything wrong with it. I assume you have the skill accordion bash and you are wearing an accordion.

Yes. AT in aftercore wielding a Shakespeare's Sister's Accordion.
 
Is there a way to inject a skill to the combat queue to be fired before any others? Basically I need Toss to fire before any other class skill so the Nanorhino will triggers it's buff effect, in this case Nanobrawny. However just adding Toss to the custom[] array doesn't seem to be the answer as other skills are always chosen first. Maybe a direct call to macro() or something will circumvent it somehow?
 
I seem to be getting errors in the basement against the Ghost of the Grandfather. It is inside to_spread, the damage string being passed in is "3,445 hot,cold,spooky,sleaze,stench". I'm guessing that is just a high damage number and should have the comma removed:

Code:
      matcher decomma = create_matcher("(\\d+),(\\d+)", bittles.group(1));
      float thisd = eval(decomma.replace_all("$1$2"),fvars);
 
There's lots of similar bits... anything that uses rnum will have this issue. It was discussed in posts 1537-1541.
 
Weird thing going on. I think that BatBrain is the issue. When I have either Takin' it Greasy or Intimidating Mien as an active effect, I get the following error when using WHAM. I've done a very terrible hack to zlib's eval function, adding in the following line: if (b.to_string() == "greasy)" || b.to_string() == "mien)") return 0;

I suspect the actual problem is the following lines of batfactors.txt:
Code:
skill	7204	Unleash the Greash	25+5.5*effect(takin' it greasy) sleaze	0	once
skill	7211	Thousand-Yard Stare	35+5*effect(intimidating mien) spooky	0	once



Code:
BatMan RE disabled for this character, skipping enhancements.
1 HP costs 0.12μ. ( 1,067 / 1212 )
1 MP costs 2.74μ. ( 1,451 / 2280 )
WHAM: We currently think that the round number is: 0 and that the turn number is 2151.
WHAM: Checking to see if WHAM sould adjust the unknown_ml for hot werewolf.
WHAM: No need to do anything with hot werewolf.
WHAM: Setting up variables via BatBrain
Setting monster to hot werewolf...
Dreadsylvanian Almanac page (0.01 @ +169.63): 3μ * 0.03% = 0
Freddy Kruegerand (0.01 @ +169.63): 50μ * 0.03% = 0.01
accidental mutton (0.01 @ +169.63): 116,999μ * 0.03% = 31.55
Value of stat gain: 1,111.64μ
Loading batfactors...
Processing batfactors...
Factoring in Jalapeño Saucesphere: 3 damage, retal
Factoring in Scarysauce: (6) damage, retal
Events created: Jalapeño Saucesphere, Scarysauce
Events created: companion Scary Death Orb
Base round: 0 damage, 0 player damage, 5.5 MP, 0 meat
ATT: 459 (94% × (18.43), death in 1067)
DEF: 459 (18.14% × 213.09 (50) (15) (40), win in 9)
HP: 567, Value: 1,143.2 μ, RES: 0 (1) (-1) (-1)
Parsed round number: 1
Building options...
Events created: attack, (blank)
Evaluating 'floor(50+10*52.0^0.7)'...
Evaluating '-min(100,ceil(5*sqrt(max(0,min(359.0,567.0)))))'...
Evaluating 'min(50,ceil(5*sqrt(max(0,min(704.0,567.0)))))'...
Evaluating '-(300+zone(sea)*(1212.0-1067.0))'...
Evaluating '15*loc(convention hall lobby)'...
Evaluating '15+10*min(1,effect(sugar rush))'...
Events created: use 2, use 185, use 344, use 345, use 518, use 536, use 547, use 549, use 550, use 563, use 829, use 1316, use 1922, use 1959, use 1965, use 2092, use 2114, use 2131, use 2440, use 2606, use 2678, use 3098, use 3099, use 3101, use 3102, use 3121, use 3388, use 3665, use 3754, use 3755, use 3756, use 3757, use 3758, use 3759, use 3809, use 3898, use 4198, use 4330, use 4331, use 4583, use 5445, use 5447, use 5678, use 5719, use 6452, use 6459, use 6467, use 6502, use 6711, use 6832, use 6853, use 7014, use 7015, use 7099, use 7199, use 7383, use 7518
Events created: skill 15, skill 19, skill 28, skill 30, skill 36, skill 32, skill 42, skill 117, skill 92, skill 93, skill 94, skill 97, skill 99, companion Scary Death Orb
Base round: 0 damage, 0 player damage, 5.5 MP, 0 meat
Evaluating 'min(4,0.0+1)'...
Evaluating '1+2*effect(Blessing of the Storm Tortoise)+3*effect(Grand Blessing of the Storm Tortoise)+4*effect(Glorious Blessing of the Storm Tortoise)'...
Evaluating '1.4*(12+min(0.15*704.0,20)+min(40.0,40)+25.0)'...
Evaluating '1.4*(28+min(0.25*704.0,30)+min(40.0,60)+25.0)'...
Evaluating '1.4*min(2.5+50.0+0.0,8)'...
Evaluating '2*1.4*min(22+0.2*704.0+50.0+0.0,50)'...
Evaluating '-min(1,effect(jalape))*1.12*6.0'...
Evaluating 'max(1,min(1,effect(jabanero))*0.29*6.0)'...
Evaluating '-min(1,effect(jalape))*1.12*24.0'...
Evaluating 'max(1,min(1,effect(jabanero))*0.29*24.0)'...
Evaluating 'greasy)'...
Expression syntax errors for 'modifier_eval()':
Can't understand greasy) (zlib.ash, line 194) OR Can't understand mien) (zlib.ash, line 194)
You're on your own, partner.
 
Been trying to catch this script up again. Went through recently and added a pile of skills and items. Just today got caught up on the thread and fixing the issues reported.

One issue that's not fixed which has been in the to-do list for a while: when SS chooses a stasis item, it builds the macro with repeat conditions even for items specified as "once". This is a fairly tricky problem to solve, but it's probably the source of the Indigo cup issue reported above.

Fixes include:

  • Since $elements[] now includes slime and supercold, which are superfluous to BatBrain, we explicitly list the five main elements within the brackets. Thanks Bale for finding/fixing this bug.
  • As Crowther correctly mentioned, there's no good reason to use rnum() for data being sent to setmatt(). I just automatically use it in place of to_string(), which in this case introduced errors. Those rnum() calls have been changed to use to_string() instead, which ought to solve issues introduced by polluting the numbers with human-readable aids.
  • BatBrain/batfactors now supports roughly a boatload of new combat skills and items. I'm not feeling like listing them all individually, but I feel like the number of things I added was between 50 and 100.
  • In the process of supporting all the new things, I ended up adding a new keyword for use in batfactors: "itemcost". If you specify "itemcost volcanic ash", it means the action requires you have a volcanic ash and will consume one. There were enough of these things that a keyword became the preferred solution.
  • Wall of bones can only be affected by AoE attacks (and the electric boning knife).
  • Remove any code dealing with tower items. ZLib will be removing its tower_items() function soon too.
  • Fix longstanding bug with Unleash Nanites that would cause it to be skipped even when it was available. Fxer should be happy about this.
  • PADL phones and windchimes were fixed as discussed several pages back.
I also removed all the old tower monster code from SS, and added the custom items for the walls of skin and bone, respectively.

My combat suite should now be up to date again. Someday I'll be able to work on actually developing it instead of just catching it up. Someday.

Enjoy!

@digitrev: Aha, yep that's because the effect names have spaces in them. Can we use effect numbers in there? I'll give it a shot.
 
Thanks zarqon. Actually there is one more bit of new content that needs to be supported: Ruthlessly Efficient.

If the character has the effect Ruthlessly Efficient, multiply all deleveling effects by 1.50 This affects both skills and items. It's really very powerful for a Disco Bandit. It stacks additively with a dark porquoise ring (i.e., with both, you do 100%+50% = 150% of normal deleveling).

Thank you!
 
Ok, r55 brings us support for those two things, as well as support for all those pesky helmet turtles giving bonus damage to Headbutt.

I'm a TT at the moment and taking a look at all the new (to me) TT stuff, as well as supporting some of the old stuff I never got around to before, such as the aforementioned helmet bonus damage. I've made a feature request which would allow me to very easily add most of the Blessing enhancements to skills as well. Some have already been added. Hopefully I can get all the new TT stuff supported before I finish the stuff I need to do in aftercore this run.

I'm feeling quite thankful that so far as I've been able to tell there's no special benefit to doing more than one Picky run. It will allow me a bit of time to catch up.
 
Thank you! That will make Disco Bandits easier for me to play.

I'm feeling quite thankful that so far as I've been able to tell there's no special benefit to doing more than one Picky run. It will allow me a bit of time to catch up.

I'm glad that works for you. It's giving me plenty of time to do a full round of 12 standard ascensions for both outfits. Though I sad that ascending is not the best method of farming this season. I just loved the irony of that.
 
I'm brainstorming speed improvements for BatBrain and wondering if anyone can think of some examples of a combat option that becomes available mid-combat. In other words, an action that is unavailable at the beginning of combat but then becomes available later. Off the top of my head I can't think of any.

@Bale: Both outfits, meaning Hatred and Loathing, I assume? I'm almost finished with those myself (but only the first pass... sigh).
 
There's also pickpocketing a combat item, or getting volcanic ash / warbear whosits from the crown/bjorn (for Volcanometeor / shrap).
 
@lost: Yeah, that would probably be a custom action anyway, with one of the granted skills immediately following Summon Underling, so don't really need to consider that.

@heex3: Aha. Looks like I can use "getting an item" as a trigger for a complete reload instead of a partial one.

Thanks for those excellent examples guys. It's looking like I can proceed with my restructuring.

I've just finished part of what's looking to become a rather involved rejiggering of BatBrain. I moved the resistances/damage caps calculations from dmg_dealt() into to_event() -- meaning that advevent.dmg will contain the adjusted numbers. Now all dmg_dealt() has to do is simply sum the spread and, optionally, cap it at monster HP. I also rejiggered event tracking rather severely. New data format, events keyed to the monster, turn, and round they happen, and a completely new method that DOESN'T BREAK WHEN PEOPLE DON'T USE MACROS OR EVEN BATBRAIN. Holy crap!

No serious speed improvements yet but those are much more involved. Also, so far none of the "public" functions have changed. Going to do a bit more testing of the new events tracking before I post an update.
 
Just posted an updated batfactors using integers for effects that include spaces. This needs r15372 or later to work. Hopefully now we can stop most of the error reports being made in the ZLib thread (wish there was a way to capture that error and send people to the appropriate thread).
 
I'm brainstorming speed improvements for BatBrain and wondering if anyone can think of some examples of a combat option that becomes available mid-combat. In other words, an action that is unavailable at the beginning of combat but then becomes available later. Off the top of my head I can't think of any.

Unleash Nanites becomes available mid-combat.
 
Back
Top