BatBrain -- a central nervous system for consult scripts

Veracity

Developer
Staff member
Q: Will the bobblehead be upgradeable when Nuclear Autumn stops being the current path?
A: There is a cap on it. I would probably not remember to turn it off when the season expires. We tend to stop giving you the souvenirs when the season ends. HS: What if we don't give out new ones... J: ...but continue upgrading existing ones? That sort of serves the best... HS: Because it's checking a flag that we can't just stop incrementing. J: Oh right, we can't stop incrementing the flag because people playing in the future wouldn't be able to unlock new levels of their fallout shelter. So I guess it will stop dropping, but people who have it can still upgrade it.
Thank you.
 

zarqon

Well-known member
This is why I like Yellow Rays (from my Crimbo Shrub, these days)

A fine scheme. I normally yellow ray that outfit, which was also another reason for my annoyance with it going from 1 turn to 50. It seems that in HC NA doing a 100% run, I actually had no sources of yellow rays, despite having a pretty well decked-out account.

My cynical expectation is that the event will climax on Tuesday, to align with the horror of the 2016 US election.

Ha! I had the same thought. I'll be relieved -- and probably horrified -- when both are over.
 

Bale

Minion
This is why I like Yellow Rays (from my Crimbo Shrub, these days):

Only two months until the Crimbo Shrub goes out of standard. Then I'll have to use a viral video or a mayo lance. Neither of those is quite as convenient as my Crimbo Shrub, but I guess I'll adapt. :(
 

lostcalpolydude

Developer
Staff member
Actually, using a Crimbo Shrub for meat covers the cost of a mayo lance from the first use, and then the second use gives you extra meat. So that route can be better than yellow rays from the shrub. But that doesn't really apply once the shrub goes away.
 

Bale

Minion
Actually, using a Crimbo Shrub for meat covers the cost of a mayo lance from the first use, and then the second use gives you extra meat. So that route can be better than yellow rays from the shrub. But that doesn't really apply once the shrub goes away.

That's interesting! But it still requires me to eat something with mayo before I can use the lance, right? So it can't be used before I have something to eat.
 

Bale

Minion
Oh. For some reason I thought I didn't get the mayo until the food was eaten. So I can just the mayo packet in anticipation that there will be food to eventually follow. Use the lance and eat food later that day.
 

Magus_Prime

Well-known member
Batbrain just tried to kill a Fun-Guy mushroom and failed in a big way.

Code:
Turn-Ons: badminton, moonlit walks, shopping
Turn-Offs: swords, slingshots, rattling chains, scams, durian fruit, evocations

It tried to two-shot with Frost Bite and Science! Fight with Medicine.
When that failed it tried a few rounds of Stealth Mistletoe
Then it cast Tattle for 22 rounds

All the while the character is losing HP.

Any ideas?
 

Xenthes

Member
I am getting this error. I have r17754 version of mafia. I have also updated all my SVNs.

Code:
Function 'qprop( string )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (BatBrain.ash, line 342)
andf the offending line
Code:
   if (!qprop("questM10Azazel")) {
 

Theraze

Active member
How did you install BatBrain? Doing so with svn install should have added zlib, which is where that function lives...
 

Xenthes

Member
Ahh, Therein lies the problem

I got a new computer since the HD on my old one died. Before the HD totally died I copied my mafia file to dropbox. Apparently not all the files didn't download from dropbox.

I actually got it working just after I posted. I found an older version of mafia and updated things with that.

Thanks for the reply!
 

zarqon

Well-known member
Attention New-You questers!

While we await mafia support for New-You quest tracking, I've added support for the quest to BatBrain and SS. It accesses four tracking properties to determine which spell to cast vs. which monster, and whether to attempt Olfaction vs. said monster. Also BatBrain increments your tracking property as you advance the quest. Once mafia tracks the quest, we can easily switch to using those properties.

But for now, use this code to set the four properties SS needs to access to perform your action:

PHP:
   monster fixedmon(string monstr) {
      if (to_monster(monstr) != $monster[none]) return to_monster(monstr);
      switch (monstr) {
         case "Orcish Frat Boy": return $monster[orcish frat boy (music lover)];
      }
      return $monster[none];
   }
   matcher m = create_matcher("Looks like you've cast (.+?) during (\\d+) of the required (\\d+) encounters with  ?(?:a|an|some|the) (.+?)!", visit_url("questlog.php?which=1"));
   if (m.find()) {
      for i from 0 to m.group_count() print(i+": "+m.group(i));
      monster target = fixedmon(m.group(4));
      if (target == $monster[none]) abort("Unable to identify monster '"+m.group(4)+"'");
      set_property("_newYouMonster", target);
      set_property("_newYouSkill", m.group(1));
      set_property("_newYouSharpeningsCast", m.group(2));
      set_property("_newYouSharpeningsNeeded", m.group(3));
      foreach l in $locations[] if (!l.nocombats) foreach mon,rate in appearance_rates(l) if (mon == target) print("Found in "+l+" with an appearance rate of "+rate);
   } else print("Quest didn't match.");

I have this saved as a separate script, but you could also put it in your login script behind a check for eudora() == "New-You Club".

Once running this code, the tracking properties will be set correctly, and adventuring in a location with the specified monster will automatically use the correct skill vs. the correct monster (and Olfact it if appropriate). This will work no matter how you encounter the monster, so it would also work throughout your adventuring day if you decided to Digitize the monster.

The New-You quest can now be accomplished with

PHP:
while (get_property("_newYouSharpeningsCast").to_int() < get_property("_newYouSharpeningsNeeded").to_int())
   adventure(1,$location[place that has the monster]);

Enjoy!
 

coandco

Member
Hmm. So, I incorporated this into my version of NewYou.ash, but it doesn't seem to quite be working. The _newYouSharpeningsCast counter updates as expected, but then seems to get stuck at one fewer than the max:

Code:
Visit to Woods: Whitey's Grove in progress...

[6796] Whitey's Grove
Encounter: whitesnake
Round 0: CrankyOne wins initiative!
WHAM: Running SmartStasis
Round 1: CrankyOne executes a macro!
Round 1: CrankyOne casts SUMMON LOVE GNATS!
Round 2: CrankyOne casts TANGO OF TERROR!
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with attack with your weapon.
Round 3: CrankyOne executes a macro!
Round 3: CrankyOne attacks!
Round 4: CrankyOne wins the fight!
After Battle: You gain 29 hit points
After Battle: You gain 33 Mana Points
You gain 49 Meat
You acquire an item: white snake skin
You acquire an item: bird rib
After Battle: You gain 5 Fortitude
After Battle: You gain 21 Mysteriousness
After Battle: You gain 3 Smarm

Post Adventure done, boop.
New You progress: cast Tango of Terror 8 of 10 times against whitesnake at Whitey's Grove

Visit to Woods: Whitey's Grove in progress...

[6797] Whitey's Grove
Encounter: white chocolate golem
Round 0: CrankyOne wins initiative!
WHAM: Running SmartStasis
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with Thrust-Smack.
Round 1: CrankyOne executes a macro!
Round 1: CrankyOne casts THRUST-SMACK!
Round 2: CrankyOne wins the fight!
After Battle: You gain 35 hit points
After Battle: You gain 25 Mana Points
You acquire an item: white chocolate chips
After Battle: You gain 6 Muscleboundness
After Battle: You gain 21 Mysteriousness

Post Adventure done, boop.
New You progress: cast Tango of Terror 8 of 10 times against whitesnake at Whitey's Grove

Visit to Woods: Whitey's Grove in progress...

[6798] Whitey's Grove
Encounter: whitesnake
Round 0: CrankyOne wins initiative!
WHAM: Running SmartStasis
Round 1: CrankyOne executes a macro!
Round 1: CrankyOne casts SUMMON LOVE GNATS!
Round 2: CrankyOne casts TANGO OF TERROR!
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with attack with your weapon.
Round 3: CrankyOne executes a macro!
Round 3: CrankyOne attacks!
Round 4: CrankyOne wins the fight!
After Battle: You gain 22 hit points
After Battle: You gain 33 Mana Points
You gain 54 Meat
You acquire an item: bird rib
After Battle: You gain 3 Muscleboundness
After Battle: You gain 23 Wizardliness
After Battle: You gain 3 Chutzpah
You gain a Moxie point!

Post Adventure done, boop.
New You progress: cast Tango of Terror 9 of 10 times against whitesnake at Whitey's Grove

Visit to Woods: Whitey's Grove in progress...

[6799] Whitey's Grove
Encounter: whitesnake
Round 0: CrankyOne wins initiative!
WHAM: Running SmartStasis
Round 1: CrankyOne executes a macro!
Round 1: CrankyOne casts SUMMON LOVE GNATS!
Round 2: CrankyOne casts TANGO OF TERROR!
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with attack with your weapon.
Round 3: CrankyOne executes a macro!
Round 3: CrankyOne attacks!
Round 4: CrankyOne wins the fight!
After Battle: You gain 24 hit points
After Battle: You gain 24 Mana Points
You gain 49 Meat
You acquire an item: white snake skin
After Battle: You gain 4 Beefiness
After Battle: You gain 18 Magicalness
After Battle: You gain 5 Roguishness

Post Adventure done, boop.
New You progress: cast Tango of Terror 9 of 10 times against whitesnake at Whitey's Grove

Here's the code that's directing that:
Code:
	while (get_property("_newYouSharpeningsCast").to_int() < get_property("_newYouSharpeningsNeeded").to_int()) {
		boolean success = adventure(1,_loc_NewYou);

		string msg = "New You progress: cast " + _sk_NewYou + " " + get_property("_newYouSharpeningsCast") + " of ";
		msg = msg + get_property("_newYouSharpeningsNeeded") + " times against " + _mon_NewYou + " at " + _loc_NewYou;
		print(msg, "blue");

		// A location can become unavailable mid-adventure (if, for example, your location is McMillicancuddy's Farm)
		if (!success)
			abort("Could not adventure at " + _loc_NewYou);
	}

It looks like something's causing BatBrain to not update the variables correctly on the last iteration. Thoughts?
 

zarqon

Well-known member
At such a low verbosity that output doesn't give any clues for what's happening in the fights (like being able to see the quest messages being tracked), but your print output after the fights at least allowed me to find the error. I had carelessly released some dangerous wild regex characters into a contains_text() check without thinking! Should be fixed in r107.
 

coandco

Member
At such a low verbosity that output doesn't give any clues for what's happening in the fights (like being able to see the quest messages being tracked), but your print output after the fights at least allowed me to find the error. I had carelessly released some dangerous wild regex characters into a contains_text() check without thinking! Should be fixed in r107.

Thanks much! Sorry about the low verbosity -- by the time I saw the problem, the quest was already done for the day and I couldn't jack up the verbosity and try again.
 

coandco

Member
Interesting. The fix seems to have been a little overzealous -- it's now overshooting by one. Still, that's a much less quest-breaking bug than undershooting. Either way, here's what I'm seeing now, same code as last time:

Code:
[7209] South of the Border
Encounter: La Farmacia de Sue?os
You acquire an item: Meleegra? pills

Post Adventure done, boop.
New You progress: cast Salsaball 7 of 8 times against handsome mariachi at South of the Border

Visit to Beach: South of the Border in progress...

[7210] South of the Border
Encounter: handsome mariachi
Round 0: CrankyOne wins initiative!
WHAM: Running SmartStasis
Round 1: CrankyOne executes a macro!
Round 1: CrankyOne casts SUMMON LOVE GNATS!
Round 2: CrankyOne casts SALSABALL!
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with attack with your weapon.
Round 3: CrankyOne executes a macro!
Round 3: CrankyOne attacks!
Round 4: CrankyOne wins the fight!
After Battle: You gain 29 hit points
After Battle: You gain 42 Mana Points
You gain 12 Meat
You acquire an item: bottle of tequila
You acquire an item: handsomeness potion
After Battle: You gain 2 Beefiness
After Battle: You gain 19 Enchantedness
After Battle: You gain 4 Sarcasm

Post Adventure done, boop.
New You progress: cast Salsaball 9 of 8 times against handsome mariachi at South of the Border
Your saw is so sharp!
Requests complete.
 

zarqon

Well-known member
Looks like BatBrain may have been running more than once on the same page text. I've just changed it to a method that -- if your properties are set beforehand correctly -- won't care how many times it checks a given page. If your properties aren't set, it'll keep adding 1, even if that means overshooting.

Also, coandco's New-You 2 script has brought to light a conflict that can occur where you may have multiple attraction targets in a single zone. You may even be on a bounty hunt in a zone that also has your New-You quest monster, with a different monster set to be automatically olfacted in your BatMan_attract setting! In that case, which one takes priority? I see three options:

1) Print a red message (without aborting) letting you know you have multiple valid attraction targets in your current zone. Attentive users can then adjust the configuration as they like, or leave things as they are and end up olfacting the first one that comes along (current behavior). Upside: we don't presume to make that important decision for you. Downside: inattentive users may end up olfacting the wrong monster, significantly extending a quest (odds are, the quest they wanted prioritized).

b) Prioritizing your New-You quest monster. If your quest properties are set (which at present, must be deliberate) and you're adventuring in the quest zone, chances are high you will save more turns by olfacting the quest monster than you would another monster in the zone. Upside: always speeds up the quest you're probably on. Downside: users who don't care strongly about completing the New-You quest (probably anyone who already has the skill) may set the properties as part of logging in, with the idea that they may be able to opportunistically complete the quest as they go about their regular day, but still prefer that SS olfact the monster they have specified.

III) Not olfacting any monsters until only one target remains. Olfacting one target will drastically reduce the likelihood of encountering the second target, so wait until there's only one monster to attract. Upside: fastest multiple-quest completion. Downside: we don't know when the reason for olfacting your non-New-You quest target is satisfied, so there will always be multiple targets until the New-You quest is done.

My BatMan_attract setting looks like this at present:

dairy goat, Knott Yeti, violent fungus, dirty old lihc, unemployed knob goblin, giant man-eating shark, desperate gold farmer, mutated alielephant, pine bat, Mer-kin monitor, Skinflute, writing desk, Mob Penguin entrepreneur, angry tourist, anesthesiologist bugbear, creepy eye-stalk tentacle monster, angry mushroom guy, gamblin' man, possessed wine rack, endless winter, pygmy shaman, tomb rat

(Incidentally, it looks like I can remove several of those now.) But the rest of them either speed up quests or maximize my item/meat results in a zone. In the latter case I'd prefer if the New-You monster were Olfacted instead, but in the former case I'd prefer if no monster were olfacted, so that I could accomplish both goals at once. After completing either quest, I'd olfact the remaining monster.

This all makes me lean towards option III, but it would require adding conditionals for specific monsters in SS, i.e. only olfacting dairy goats if you need the quest cheese. Some feedback from the community would be most helpful in figuring out what to do here: which monsters do you regularly olfact, and why?

For me:

  • dairy goat: quest cheese
  • violent fungus: amino acids for quest
  • dirty old lihc: faster Evil reduction
  • unemployed knob goblin: beer lenses
  • giant man-eating shark: more harmless than other monsters in zone
  • writing desk: speed up quest completion
  • anesthesiologist bugbear: speed up clearing the Medbay
  • creepy eye-stalk tentacle monster: speed up getting the bugbear communicator badge
  • angry mushroom guy: speed up Nemesis quest
  • possessed wine rack: speed up getting the bottle of Chateau de Vinegar
  • pygmy shaman: hopefully get Thrice-Cursed before the first choiceadv
  • tomb rat: speed up getting tomb ratchets for finding Ed

  • desperate gold farmer: maximize gold piece drops
  • gamblin' man: maximize Chroner from playing cards
  • mutated alielephant: maximize lunar isotope drops
  • Mer-kin monitor: maximize cheatsheets
  • Skinflute: maximize star/line drops
  • angry tourist: maximize meat drops
 

fronobulax

Developer
Staff member
I let scripts manage olfaction for me in most cases. One character doesn't have the skill yet, one character lets Veracity's Meat Farming script make the choice and one character needs to start using WHAM (or SmartSmack) again before this is relevant. That character is in Never-Ascended Aftercore so olfactions that make quests easier are not relevant.
 

Theraze

Active member
My usual olfaction target is just "goals" so that if I have a goal set, SS can automatically figure out who in the zone is the best for that. Not optimal, but it's dynamic at least. :)
 
Top