BatBrain -- a central nervous system for consult scripts

The new version is giving me some odd CLI output. It looks like it's working correctly but the output is . . .

Code:
[177] Spooky Putty Monster
Encounter: BRICKO ooze
Strategy: C:\Users\Martin\Desktop\Mafia\ccs\default.ccs [bricko ooze]
Round 0: redwulf25 wins initiative!
[B]Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand /
Evaluator syntax error: can't understand /[/B]
Round 1: redwulf25 executes a macro!
Round 1: redwulf25 tries to steal an item!
[B]Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand /
Evaluator syntax error: can't understand /[/B]
Round 2: redwulf25 executes a macro!
Round 2: redwulf25 casts ENTANGLING NOODLES!
[B]Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand /
Evaluator syntax error: can't understand /[/B]

from that point on the rest of the output is as expected with no syntax errors reported. My best guess, and it's only a guess, is that it has something to do with the OP being added to batfactors as Bale mentioned in the smartstasis thread. On the other hand I just tried auto adventuring in the "fun" house without the OP equipped and am still getting the odd output.
 
This probably has to do with Batfactors needing to be updated, as zarqon said... someone just needs to have time. And not be drifting off to sleep when they do it. :D
 
I think I've changed that now. There were only two occurences of "stats" in batfactors.txt and they both now have | instead of /.
 
Testing actual ML decreases is easy. KoL gives messages stating how much monster attack and defense are reduced.

I think there are still a few places where that doesn't happen, which is what is difficult about the testing.
Anyway, offensive joke is class-independent skill (anybody could have bought it from crimbco and anybody can use it). And it shows some decreases. And combining it with mistletoe shows the same decreases and doesn't show any kiss message. That nearly convinced me by itself, I just wanted more confirmation.
 
Yeah, last I checked it doesn't happen for Birdform deleveling skills, among others.

The deleveling data was all added to batfactors before that KoL update, so depending on the quality of spading on our beloved Wiki some of the numbers in batfactors may be off by a bit. I've never gone through and re-verified it.
 
Heavy Keg Tank? Using the latest BF and SS I either abort when it is encountered or stasis for 30 rounds without killing it. I presume it is just a data problem somewhere but since I blissfully use the scripts without understanding them I am not comfortable with trying to find or fix the problem. Thanks.
 
What does SS output when you encounter the Heavy Kegtank? Batbrain (and thereby SS) is aware of the 50% physical resistance at least.
 
What does SS output when you encounter the Heavy Kegtank? Batbrain (and thereby SS) is aware of the 50% physical resistance at least.

Can't find it in session logs. My memory is that the message had "BatBrain" and "Abort" in it. For reasons that could be entirely bogus I seem to associate a similar message with the time when SS would cast Entangling Noodles and my CCS would try and do the same. That would fail because the skill was no longer available when the CCS got control. Not the case here, though since the CCS is SmartStasis followed by Attack with Weapon.
 
May be the same cause as the incident above. Maybe not.

Latest BB, SS and mafia. CCS is SS then attack with weapon.

Same thing happened for Mobile Armored Sweat Lodge, War Hippy Naturopathic Homeopath, and War Hippy Dread Squad.

NZPR familiar.

Get "on your own" message. Mini-browser says "Macro Aborted ("abort "BatBrain abort: Danger, Will Robinson"")". Have less than 10, out of 600+ HP left. First time I just attacked and was Beaten Up. Every other time it happened I cast Noodles and then LTS and defeated the monster.

If I understand BB/SS correctly and their intent, they should have stopped stasising before my HP got that low. It may be that they "knew" I could still one hit with LTS in which case a feature request would be to tell me that so that I don't blissfully resume my "normal" attack strategy.

Thanks.
 
That depends on how things get called I think. Batbrain itself has the following code
Code:
"if hpbelow "+ceil(max(m_regular()+1,to_float(get_property("autoAbortThreshold"))*my_maxhp()))+"; abort \"BatBrain abort: Danger, Will Robinson\"; endif; ";
which I guess is what aborted above. And SS has a different one that seems to me that it should abort the loop if you go below your current HP, but it won't abort the script and as long as you lose a little each round you will sooner or later end up at the abort point instead.
 
Yeah... I think it was one version back when any hp-loss would abort, which caused problems with any B-items causing the macro and automation to abort... :)
 
I've been trying to make batbrain/spamattack aware of splashback-damage for sauce spells and restorations from saucespheres and came up with the following addition:
Code:
void addopt(advevent a, float meatcost, int mpcost)
{
	if (a.id == "")
		return;
	// don't add non-healing items vs. shadow
	if (m == $monster[your shadow] && a.hp <= 0)
		return;
	// mine crabs are sensitive
	if (m == $monster[mine crab] && dmg_dealt(a.dmg) > 39)
		a.hp -= 100000;
	//splashbacks (S and others)
	int total_spell_damage()
	{
		switch(normalize_dmgtype("sauce"))
		{
			case "hot":	return numeric_modifier("spell damage") + numeric_modifier("hot spell damage");
			case "cold":	return numeric_modifier("spell damage") + numeric_modifier("cold spell damage");
		}
		return numeric_modifier("spell damage");
	}

	if($ints[4003, 4005, 4009] contains to_int(substring(a.id,6)))
	{
		int num = to_int(substring(a.id,6));
		if(my_class() != $class[sauceror])
		{
			switch(num)
			{
				case 4003:	((total_spell_damage() > 10) ? a.hp -= 19 : a.hp -= 0);
							break;
				case 4005:	((total_spell_damage() > 15) ? a.hp -= 19 : a.hp -= 0);
							break;
				case 4009:	((total_spell_damage() > 25) ? a.hp -= 19 : a.hp -= 0);
							break;
			}
		}
		switch(num)
		{
			case 4003:	(have_effect($effect[Jalapeño Saucesphere] > 0 ? a.hp += mp_cost(to_skill(4003)) : a.hp -= 0);
						(have_effect($effect[Jabañero Saucesphere] > 0 ? a.mp += mp_cost(to_skill(4003)) * 0.25 : a.mp -= 0);
						break;
			case 4005:	(have_effect($effect[Jalapeño Saucesphere] > 0 ? a.hp += mp_cost(to_skill(4005)) : a.hp -= 0);
						(have_effect($effect[Jabañero Saucesphere] > 0 ? a.mp += mp_cost(to_skill(4005)) * 0.25 : a.mp -= 0);
						break;
			case 4009:	(have_effect($effect[Jalapeño Saucesphere] > 0 ? a.hp += mp_cost(to_skill(4009)) : a.hp -= 0);
						(have_effect($effect[Jabañero Saucesphere] > 0 ? a.mp += mp_cost(to_skill(4009)) * 0.25 : a.mp -= 0);
						break;
		}
	}
		
	// TODO: add overkilling hobos
	// detect multi-round stun immune monsters here
	if (a.stun > 1 && $monsters[cyrus the virus, queen bee, beebee king, bee thoven, buzzerker, Beebee queue] contains m)
		a.stun = 0;
	int c = count(opts);
	opts[c] = a;
	opts[c] = factor(opts[c],hitchance(a.id));
	opts[c].meat -= meatcost;
	opts[c].mp -= mpcost;
}

This code fails with the message "":" expected (line <first case-line>".

Doing the following works however:
Code:
import <batbrain.ash>

int total_spell_damage()
{
	switch(normalize_dmgtype("sauce"))
	{
		case "hot":	return numeric_modifier("spell damage") + numeric_modifier("hot spell damage");
		case "cold":	return numeric_modifier("spell damage") + numeric_modifier("cold spell damage");
	}
	return numeric_modifier("spell damage");
}

((total_spell_damage() > 10) ? print("Yes") : print("No"));

Is there any specific reason why the switch-case version in the first function fails while the same version without the switch-case works?
 
Last edited:
You start commenting out on the "int total_spell_damage" line... where does that /* comment start end? Ah. At the end of your switched function. So it's not actually there, in your first function... because it's commented out.

As a matter of form, I'd probably do
Code:
if (total_spell_damage() > 10) a.hp -= 19;
instead of the ternary... no sense in wasting an operation and its associated CPU cycles on doing -= 0, and that's the part that's failing anyways...
 
Last edited:
Well, yes. At the moment it is commented out as it isn't working. I forgot to remove that when I copy-pasted it here :)
 
change needed to line 255 due to Mafia change in r9620
Code:
   case $monster[the Demon of New Wave]: foreach el in $elements[] mres[el] = 0.4; mres[$element[none]] = 0.4; break;
 
FWIW, the change in 9620 was necessary to correctly recognize the monster; I tried to finish my Nemesis quest today in-run, since it is fun having rave combos, and I wondered why we didn't seem to know the monster hit points, since it was in the monster data file. The reason is our name was not what KoL itself used, and so we did not recognize it. I logged out, fixed it, and tried again - and we recognized the monster correctly.

(For the record, although I have gotten the DB Nemesis in-run before, today in BeeCore, I failed; the initial damage from my required B-weapon left me with too few hitpoints to survive the whole battle. I have always found the DB Demon Nemesis to be difficult. I'll get him in aftercore, this time. Ah, well.)
 
@Winterbay: Pretty sure that didn't work because ternary syntax should be

(condition ? value1 : value2)

where the values are the same type. Not

(condition ? command1 : command2)

with arbitrary commands.

Thanks for posting that code though! I think I'll add this to build_skillz() since a variable for the elemental bonus already exists there.

@Veracity: more monster recognition is good! Next, we should hope you want to cast DB combos against your shadow! :)

@All: working on adding this splashback stuff now that Winterbay posted it -- will post soon.

EDIT: Aaaand my classroom was swarmed with students who came to class early. Not getting this done till later.
 
Last edited:
Not sure if this is a batbrain or smartstasis issue, but I'm still getting Evaluator syntax error messages when I run. Upped the verbosity to 9 in case that helps diagnose. It's not an issue with spamattack, it was present before I installed that script.

Code:
Using 1 Spooky Putty monster...

[1644] Spooky Putty Monster
Encounter: BRICKO ooze
Strategy: C:\Users\Martin\Desktop\Mafia\ccs\default.ccs [bricko ooze]
Round 0: redwulf25 wins initiative!
1 MP costs 3.8461537μ.
1 HP costs 0.58608055μ.
BRICKO brick (30.0 @ +63.0): 179μ * 48.9% = 87.531006
Value of stat gain: 224.02μ
Profit per round: ActionProfitDamageOtherbase; Baby Sandworm (0μ)0μ--
Parsed round number: 1
Building options...
[B]Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |[/B]
Options built! (128 actions)
BRICKO brick (30.0 @ +63.0): 179μ * 48.9% = 87.531006
Value of stat gain: 224.02μ
Monster: BRICKO Ooze, ATT: 40, DEF: 36, HP: 50, Value: 311.56
You will die in 2450 rounds.
Your attack will kill the monster in 1 rounds.
Building custom actions...
Custom actions built! (0 actions)
Executing macro: scrollwhendone; sub batround; endsub; pickpocket; call batround; if hpbelow 2; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Round 1: redwulf25 executes a macro!
Round 1: redwulf25 tries to steal an item!
Parsed round number: 2
Building options...[B]
Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |[/B]
Options built! (128 actions)
Stasis action chosen: use 185
This monster is not your huckleberry.
Stasis loop complete.
SmartStasis complete.
Round 2: redwulf25 uses the Spooky Putty sheet!
You acquire an item: Spooky Putty monster
You lose 1 hit point
1 MP costs 3.8461537μ.
1 HP costs 0.58608055μ.
BRICKO brick (30.0 @ +63.0): 179μ * 48.9% = 87.531006
Value of stat gain: 224.02μ
SpamAttack: You are fighting a BRICKO Ooze. Mafia considers that this monster has an attack of 40 or 40 when given a monster name.
SpamAttack: Mafia further considers that this monster has a defense value of 36 or 36 when given a monster name.
SpamAttack: Mafia further further considers that this monster has a HP value of 50 or 50 when given a monster name.
SpamAttack: Your current ML-adjustment is: 0.
Building options...
[B]Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |[/B]
Options built! (128 actions)
SpamAttack: Monster HP is 50.0.
SpamAttack: You will kill the monster in 1 rounds with your basic attack.
SpamAttack: The monster will take more than 30 rounds to kill you.
SpamAttack: Expected received damage per round: 1.0, Rounds to kill: 1, Expected damage: 50.0, Hit chance: 1.0
SpamAttack: Monster is weak. We are just going to bash its head in. It'll take 1 rounds.
Executing macro: scrollwhendone; sub batround; endsub; sub batsub1; attack; call batround; endsub; call batsub1; repeat ; if hpbelow 2; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Round 3: redwulf25 executes a macro!
Round 3: redwulf25 attacks!
Round 4: bricko ooze takes 227 damage.
Round 4: redwulf25 wins the fight!
After Battle: Tofflesby leans against a cactus, produces a bottle of tequila, and drinks it. A few minutes later, he belches some murky fluid back into the bottle and hands it to you.
You acquire an item: agua de vida
You gain 1 Fortitude
You gain 2 Wizardliness
You gain 8 Sarcasm
Parsed round number: 4
Look! You found 1 agua de vida (5050μ)!
Building options...
[B]Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |[/B]
Options built! (128 actions)

At least part of it seems to be an inability to parse | any better than it was parsing /
 
Last edited:
Not sure if this is a batbrain or smartstasis issue, but I'm still getting Evaluator syntax error messages when I run. Upped the verbosity to 9 in case that helps diagnose. It's not an issue with spamattack, it was present before I installed that script.

Code:
Using 1 Spooky Putty monster...

[1644] Spooky Putty Monster
Encounter: BRICKO ooze
Strategy: C:\Users\Martin\Desktop\Mafia\ccs\default.ccs [bricko ooze]
Round 0: redwulf25 wins initiative!
1 MP costs 3.8461537μ.
1 HP costs 0.58608055μ.
BRICKO brick (30.0 @ +63.0): 179μ * 48.9% = 87.531006
Value of stat gain: 224.02μ
Profit per round: ActionProfitDamageOtherbase; Baby Sandworm (0μ)0μ--
Parsed round number: 1
Building options...
Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |
Options built! (128 actions)
BRICKO brick (30.0 @ +63.0): 179μ * 48.9% = 87.531006
Value of stat gain: 224.02μ
Monster: BRICKO Ooze, ATT: 40, DEF: 36, HP: 50, Value: 311.56
You will die in 2450 rounds.
Your attack will kill the monster in 1 rounds.
Building custom actions...
Custom actions built! (0 actions)
Executing macro: scrollwhendone; sub batround; endsub; pickpocket; call batround; if hpbelow 2; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Round 1: redwulf25 executes a macro!
Round 1: redwulf25 tries to steal an item!
Parsed round number: 2
Building options...
Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |
Options built! (128 actions)
Stasis action chosen: use 185
This monster is not your huckleberry.
Stasis loop complete.
SmartStasis complete.
Round 2: redwulf25 uses the Spooky Putty sheet!
You acquire an item: Spooky Putty monster
You lose 1 hit point
1 MP costs 3.8461537μ.
1 HP costs 0.58608055μ.
BRICKO brick (30.0 @ +63.0): 179μ * 48.9% = 87.531006
Value of stat gain: 224.02μ
SpamAttack: You are fighting a BRICKO Ooze. Mafia considers that this monster has an attack of 40 or 40 when given a monster name.
SpamAttack: Mafia further considers that this monster has a defense value of 36 or 36 when given a monster name.
SpamAttack: Mafia further further considers that this monster has a HP value of 50 or 50 when given a monster name.
SpamAttack: Your current ML-adjustment is: 0.
Building options...
Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |
Options built! (128 actions)
SpamAttack: Monster HP is 50.0.
SpamAttack: You will kill the monster in 1 rounds with your basic attack.
SpamAttack: The monster will take more than 30 rounds to kill you.
SpamAttack: Expected received damage per round: 1.0, Rounds to kill: 1, Expected damage: 50.0, Hit chance: 1.0
SpamAttack: Monster is weak. We are just going to bash its head in. It'll take 1 rounds.
Executing macro: scrollwhendone; sub batround; endsub; sub batsub1; attack; call batround; endsub; call batsub1; repeat ; if hpbelow 2; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Round 3: redwulf25 executes a macro!
Round 3: redwulf25 attacks!
Round 4: bricko ooze takes 227 damage.
Round 4: redwulf25 wins the fight!
After Battle: Tofflesby leans against a cactus, produces a bottle of tequila, and drinks it. A few minutes later, he belches some murky fluid back into the bottle and hands it to you.
You acquire an item: agua de vida
You gain 1 Fortitude
You gain 2 Wizardliness
You gain 8 Sarcasm
Parsed round number: 4
Look! You found 1 agua de vida (5050μ)!
Building options...
Evaluator syntax error: unexpected end of expr
Evaluator syntax error: can't understand |
Evaluator syntax error: can't understand |
Options built! (128 actions)

You needed to go back a page to see that the issue has already been posted and addressed. It's going to take time to fix.
http://kolmafia.us/showthread.php?6...-consult-scripts&p=55075&viewfull=1#post55075
 
Back
Top