BatBrain -- a central nervous system for consult scripts

lostcalpolydude

Developer
Staff member
There are plenty of interesting explanations for that. Dropping your buffed moxie to be closer to 95 would have given a solid comparison.
 

Theraze

Active member
Well, with 105 base moxie and using slice to drop Clancy down to 100 attack, he still did 24 damage.
Encounter: Clancy
Round 0: Theraze loses initiative!
You lose 18 hit points
ATT: 150 (6% × 22.22, death in 77)
DEF: 165 (8.59% × 2.18, win in 505)
HP: 505, Value: 328.13 μ, RES: 0
Round 1: Theraze executes a macro!
Round 1: Theraze casts SLICE!
Round 2: clancy takes 153 damage.
Round 2: clancy drops 19 attack power.
You lose 30 hit points
ATT: 131 (6% × 19.41, death in 62)
DEF: 165 (8.59% × 2.18, win in 352)
HP: 352, Value: 328.13 μ, RES: 0
Round 2: Theraze executes a macro!
Round 2: Theraze casts SLICE!
Round 3: clancy takes 156 damage.
Round 3: clancy drops 16 attack power.
You lose 27 hit points
ATT: 115 (6% × 17.04, death in 45)
DEF: 165 (8.59% × 2.18, win in 196)
HP: 196, Value: 328.13 μ, RES: 0
Round 3: Theraze executes a macro!
Round 3: Theraze casts SLICE!
Round 4: clancy takes 159 damage.
Round 4: clancy drops 15 attack power.
You lose 24 hit points
ATT: 100 (6% × 14.81, death in 21)
DEF: 165 (8.59% × 2.18, win in 37)
HP: 37, Value: 328.13 μ, RES: 0
 

Tarko

Member
I found the error for line 241-ish

I started anew, new download from everything in a new folder but I still got the error.
Went to line 241 and saw it was about elemental form.
MyLittleConsumer.ash had me eat spooky wards
I shrugged off the elemental form and BatBrain works again!


so, I guess there is a coding error where it handles elemental forms.
 

zanmatoer

Member
I found the error for line 241-ish

I started anew, new download from everything in a new folder but I still got the error.
Went to line 241 and saw it was about elemental form.
MyLittleConsumer.ash had me eat spooky wards
I shrugged off the elemental form and BatBrain works again!


so, I guess there is a coding error where it handles elemental forms.

I'm getting the same error with elemental forms
 

Winterbay

Active member
The problematic part is this:
Code:
  if (eform != $element[none]) {       // if you have an elemental form, all damage to the monster is of that element
      foreach el,dm in res.dmg {
         if (el == eform) continue;
         res.dmg[eform] += dm;
         res.dmg[el] = 0;
      }
      if (res.dmg[$element[none]] > 0) { res.dmg[eform] += res.dmg[$element[none]]; res.dmg[$element[none]] = 0; }
   }

Which as can be seen clearly modifies the map within the foreach leading me to wonder if zarqon forgot to test it...

That said, something like this would solve it:
Code:
   spread empty;
   spread copy = merge(res.dmg, empty);
   if (eform != $element[none]) {       // if you have an elemental form, all damage to the monster is of that element
      foreach el,dm in res.dmg {
         if (el == eform) continue;
         copy[eform] += dm;
         copy[el] = 0;
      }
      if (copy[$element[none]] > 0) { copy[eform] += copy[$element[none]]; copy[$element[none]] = 0; }
   }
   res.dmg = merge(copy, empty);
 

zarqon

Well-known member
The "monstermeat" fvar has been fixed -- better than it was before since it accounts for Fistcore -- and will be in version cute mouse.

0 skill jiggle

First of all, the format is int[string], which means the string comes first in the map file, not second. Presently, you are blacklisting exactly "skill jiggle" of the action "0". Since "0" is not a valid macro command, that line has no effect other than to slow the script down an insignificant amount.

Changing it to "skill jiggle 0" will also not have the desired effect, since "skill jiggle" is also not a valid macro command. Try blacklisting "jiggle".

"attack" for AoJ is also added to the same blacklist and that appear to be not working perfectly either

First I've heard of it. Deets, please. It's working for me -- attack is consistently absent from opts[].

Will fix elemental forms -- don't think we need to merge spreads, which is a bit expensive -- we can probably have a single tally float. Also will be in version cute mouse.

If you get Clancy figured out in time, we can also add that fix to version cute mouse. Otherwise, it might have to wait until version ˁ˚ᴥ˚ˀ .
 

Winterbay

Active member
First I've heard of it. Deets, please. It's working for me -- attack is consistently absent from opts[].

Well, there have been some comments in the WHAM thread that WHAM uses attack for monsters in for example the daily dungeon while in Jarlsberg and since I don't specifically add attack in any way the blacklist appears to be not 100% working...

ETA: In relation to Clancy: I'll be fighting him again this evening so shall try some debuffing to get closer to his attack and see what happens.
 
Last edited:

Bale

Minion
If you get Clancy figured out in time, we can also add that fix to version cute mouse. Otherwise, it might have to wait until version ˁ˚ᴥ˚ˀ .

Now you're just screwing with us. What is with that cat face? At least mice are bat related since a bat is just a flying mouse. ;) Cats are just plain inappropriate.
 

Winterbay

Active member
So, Clancy... I fought him twice today. Once with a Moxie of 96 and once with a Moxie of 137, all other stats were equal (except possibly my HP) and this was the result:
Code:
96 MOxie:
Encounter: Clancy
Round 0: winterbay loses initiative!
Round 1: clancy takes 9 damage.
You lose 40 hit points
Round 1: winterbay casts CURDLE!
Round 2: clancy takes 36 damage.
You lose 32 hit points
Round 2: winterbay casts CURDLE!
Round 3: clancy takes 36 damage.
You lose 32 hit points
Round 3: winterbay casts CURDLE!
Round 4: clancy takes 36 damage.
You lose 37 hit points
Round 4: winterbay jiggles the Staff of the Staff of Life
Round 5: You jiggle the staff. A massive cloud of flour spews forth from it, totally enveloping you. When the cloud clears, it becomes apparent that the flour has filled in all of the gaps in your skin, bone, and muscles left by your injuries. You feel great!Your opponent coughs, comically emitting a little puff of flour.
Round 5: You gain 141 hit points.
Round 5: winterbay casts CURDLE!
Round 6: clancy takes 36 damage.
You lose 35 hit points
Round 6: winterbay casts CURDLE!
Round 7: clancy takes 36 damage.
You lose 33 hit points
Round 7: winterbay casts CURDLE!
Round 8: clancy takes 36 damage.
You lose 40 hit points
Round 8: winterbay casts CURDLE!
Round 9: clancy takes 36 damage.
You lose 42 hit points
Round 9: winterbay casts CURDLE!
Round 10: clancy takes 36 damage.
You lose 32 hit points

137 Moxie (alla andra stats samma):
Encounter: Clancy
Round 0: winterbay loses initiative!
Round 1: clancy takes 10 damage.
You lose 32 hit points
Round 1: winterbay casts CURDLE!
Round 2: clancy takes 36 damage.
You lose 36 hit points
Round 2: winterbay casts CURDLE!
Round 3: clancy takes 36 damage.
You lose 25 hit points
Round 3: winterbay casts CURDLE!
Round 4: clancy takes 36 damage.
You lose 28 hit points
Round 4: winterbay uses the gauze garter!
You gain 95 hit points
You lose 22 hit points
Round 5: winterbay jiggles the Staff of the Cream of the Cream
Round 6: You jiggle the staff, but all that comes out of it is a spray of freezing milk. That's disappointing. But hey, at least it dealt 18 damage.
Round 6: clancy takes 18 damage.
You lose 35 hit points
Round 6: winterbay casts CURDLE!
Round 7: clancy takes 36 damage.
You lose 28 hit points
Round 7: winterbay uses the gauze garter!
You gain 119 hit points
You lose 25 hit points
Round 8: winterbay casts CURDLE!
Round 9: clancy takes 36 damage.
You lose 23 hit points
Round 9: winterbay casts CURDLE!
Round 10: clancy takes 36 damage.
You lose 35 hit points
Round 10: winterbay casts CURDLE!
Round 11: clancy takes 36 damage.
You lose 36 hit points
Round 11: winterbay casts GRILL!
Round 12: clancy takes 336 damage.
Round 12: winterbay wins the fight!
You gain 3 hit points
You gain 3 Mana Points
You gain 14 Beefiness
You gain 20 Magicalness
You gain 10 Chutzpah

The damage taken was definitely in the same range but was slightly lower in the second case.
First case:
40,32,32,37,35,33,40,42,32 {32;35,89;42} (min;avg;max)

Second case:
32,36,25,28,22,35,28,25,23,35,36 {22;29,54;36}

ALso, the numbers are somewhat annoying since my last attempt (with 353 moxie) had me lose 86 and 67 HP...

ETA: SInce I forgot to take HP into account (only potentially varying factor between the fights apart from I guess damage absorption and similar) the lower damage could be due to lower maxHP as well I guess.
 
Last edited:

Raven434

Member
Changing it to "skill jiggle 0" will also not have the desired effect, since "skill jiggle" is also not a valid macro command. Try blacklisting "jiggle".

Thanks! I had tried various combinations. I love it when folks help the community learn by programming example. It makes all us monkeys, smarter monkeys. :)
 

josmul123

New member
So I found a bug in BatBrain when you have an elemental form (like coldform).

the current code gives an error about editing a map's contents within foreach.

So I made the following change, which basically uses a couple of temporary variables to get around this mafia limitation.

It no longer breaks and appears to be working correctly with coldform.

(FYI this is the whole function, since I didn't have the original for a diff. The changes occur after the comment:
// if you have an elemental form, all damage to the monster is of that element)

Code:
advevent to_event(string id, spread dmg, spread pdmg, string special, int howmanyrounds) {
   int aoe = 1;
   advevent res;
   res.id = id;
   res.rounds = howmanyrounds;
   matcher bittles = create_matcher("([a-z!]+?) (.+?)(?:$|, )",special);
   while (bittles.find()) switch (bittles.group(1)) {
      case "att": res.att = aoe*eval(bittles.group(2),fvars); break;
      case "def": res.def = aoe*eval(bittles.group(2),fvars); break;
      case "stun": res.stun = eval(bittles.group(2),fvars); break;
      case "mp": if (my_class() == $class[zombie master]) continue;
         res.mp = eval(bittles.group(2),fvars); break;
      case "meat": res.meat = eval(bittles.group(2),fvars); break;
      case "item": string[int] its = split_string(bittles.group(2),"; "); float v;
         foreach n,it in its {
            if (contains_text(id,"enthroned") && $ints[3450,4469,1445,1446,1447,1448] contains to_int(to_item(it)) && stolen contains to_item(it)) { v=0; break; }
            v += item_val(to_item(it));
         } res.meat += v/count(its); break;
      case "aoe": aoe = min(howmanyfoes,to_int(bittles.group(2))); break;
      case "monster": boolean[monster] mlist; foreach n,mst in split_string(bittles.group(2),"\\|")
             mlist[to_monster(mst)] = true; if (!(mlist contains m)) return new advevent; break;
      case "notmonster": boolean[monster] mlist2; foreach n,mst in split_string(bittles.group(2),"\\|")
         mlist2[to_monster(mst)] = true; if (mlist2 contains m) return new advevent; break;
      case "phylum": if (m.phylum != to_phylum(bittles.group(2))) return new advevent; break;
      case "stats": string[int] sts = split_string(bittles.group(2),"\\|");
         foreach n,st in sts res.stats[to_class((n+1)*2).primestat] = eval(st,fvars); break;
      case "!!": res.note = bittles.group(2); break;
   }
   res.endscombat = special.contains_text("endscombat");
   res.dmg = factor(dmg,aoe);

   if (eform != $element[none]) {       // if you have an elemental form, all damage to the monster is of that element

      float tmp = res.dmg[eForm];
      element[int] toEmpty;
      foreach el,dm in res.dmg {
         if (el == eform) continue;
         toEmpty[count(toEmpty)] = el;
         tmp += dm;
      }
      res.dmg[eForm] = tmp;
      foreach eKey in toEmpty {
         res.dmg[toEmpty[eKey]] = 0;
      }
          if (res.dmg[$element[none]] > 0) { res.dmg[eform] += res.dmg[$element[none]]; res.dmg[$element[none]] = 0; }
   }
   res.pdmg = factor(pdmg,1.0);
   return res;
}
 
Last edited:

Veracity

Developer
Staff member
the current code gives an error about editing a map's contents within foreach.

So I made the following change, which basically uses a couple of temporary variables to get around this mafia limitation.
Interesting choice of words. ;)

Would you prefer that we remove the limitation and not trap the Java exception that happens when you try to do that, rather than the current behavior of trapping it and printing out the linenumber and filename to help you fix your ASH bug?
 
Last edited:
Top