Best Between Battle Script Ever -- formerly AutoMCD

Rinn

Developer
Yeah I understand it might not be ideal for some people, especially hardcore. I use these for my softcore runs and I'm pretty much just shieldbutting the hell out of everything so I want to fight as many combats as possible when I'm unlocking stuff.
 

zarqon

Well-known member
Thanks to whomever edited the title of this thread!

1.3 Update

BBB now does not fight putty monsters if a) you have an expiring counter, or 2) you are Absinthe-Minded < 10. I was breaking my own bounty-wormwooding with this script. No longer!

me right now as an aside: said:
BTW, did you know you get an average of 4.536 spare adventures per wormwood trip? This after a clan bot got 2440 !pipes and averaged the number of adventures spent elsewhere per absinthe. (An example of ZLib's set_avg() function at work, huzzah!)

@Rinn: thanks for sharing those scriptly goodies! I've added the Haunted Library stuff to the latest update, with a slight change: after forcing the gallery and second floor open, it only sets the choiceAdvs to skip the adventure if they are not currently set to 3 (reading an A.F.U.Something book). This allows users to still set those choices manually if they want to get something from the books rather than skip the adventure.

I think mafia handles the castle wheel stuff quite well (I have to change it at most two times per ascension), so I doubt I'll be adding that.

The bedroom and bathroom are a bit more complicated. I would like BBB's choiceadv-setting to respond to goals while doing what people generally want. In the case of the bedroom, I'm usually there when I have absolutely no chance of defeating nightstands, so I usually take stats or meat, depending on which is more needed. It's hard to work out a one-size-fits-all strategy for bedroom choiceadvs. Whether or not you have your class's Spookyraven skill would also be a factor.

We could have a setting bbb_whattodointhebedroom, which besides having an awesome name would contain a general directive such as "stats", "meat", or "fight". There would probably also need to be a boolean setting called "bbb_get_spookyskills". In that case, we could make a pretty intelligent bedroom choiceadv-setter, but would it really be an improvement over mafia's default handling?
 

Bale

Minion
I think mafia handles the castle wheel stuff quite well (I have to change it at most two times per ascension), so I doubt I'll be adding that.

I just thought I'd mention that this sort of thing is best handled by a postAscensionScript. That sort of script is run after your character is reincarnated at level 1, so it is a good choice to put settings you want to reset at the beginning of your run, based on class. Here's what mine looks like:

Code:
// Bale's PostAscensionScript
// set postAscensionScript = postAscensionScript.ash
notify Bale;

boolean set_choice(string adventure, string choice, string purpose) {
	if(purpose != "")
		print(purpose, "olive");
	if(get_property(adventure) != choice) {
		set_property(adventure, to_string(choice));
	}
}
	
set_choice("hpAutoRecovery", "0.1", "Resetting HP/MP restoration settings to minimal");
set_choice("hpAutoRecoveryTarget", "0.9", "");
set_choice("mpAutoRecovery", "-0.05", "");
set_choice("mpAutoRecoveryTarget", "0.2", "");
set_choice("manaBurningThreshold", "-0.05", "");

set_choice("choiceAdventure106", "2", "Ballroom song: Non-combat");

print("Setting choice adventures for "+ my_primestat()+ " class.");

switch(my_primestat()) {
case $stat[muscle]:
	set_choice("choiceAdventure9", "2", "Turn Castle wheel by way of Moxie");
	set_choice("choiceAdventure10", "1", "");
	set_choice("choiceAdventure11", "3", "");
	set_choice("choiceAdventure12", "2", "");
	set_choice("choiceAdventure73", "1", "Whitey's Grove: Get Muscle stats");
	set_choice("choiceAdventure74", "2", "Whitey's Grove: Get boxes of wine");
	set_choice("choiceAdventure75", "2", "Whitey's Grove: Get white lightning");
	set_choice("choiceAdventure90", "3", "Ballroom Curtains: skip choice");
	set_choice("choiceAdventure153", "1", "Defiled Alcove: get Muscle stats");
	set_choice("choiceAdventure155", "4", "Defiled Niche: skip choice");
	set_choice("choiceAdventure157", "4", "Defiled Nook: skip adventure");
	set_choice("choiceAdventure184", "1", "That Explains all the Eyepatches: fight a pirate");
	set_choice("choiceAdventure186", "1", "A Test of Testarrrsterone: get stats");
	set_choice("choiceAdventure139", "1", "Hippies on the Verge of War: Get Muscle stats");
	set_choice("choiceAdventure140", "3", "Hippies on the Verge of War: Fight a drill sergeant");
	set_choice("choiceAdventure141", "2", "Hippies on the Verge of War: Get rations");
	set_choice("choiceAdventure143", "1", "Frats on the Verge of War: Get Muscle stats");
	set_choice("choiceAdventure144", "3", "Frats on the Verge of War: Fight a drill sergeant");
	set_choice("choiceAdventure145", "1", "Frats on the Verge of War: Get Muscle stats");
	set_choice("oceanDestination", "muscle", "Take the Wheel and Sail to Muscle stats");
	break;
case $stat[mysticality]:
	set_choice("choiceAdventure9", "1", "Turn Castle wheel by way of Mysticality");
	set_choice("choiceAdventure10", "1", "");
	set_choice("choiceAdventure11", "3", "");
	set_choice("choiceAdventure12", "2", "");
	set_choice("choiceAdventure73", "3", "Whitey's Grove: Get wedding cake and rice");
	set_choice("choiceAdventure74", "2", "Whitey's Grove: Get boxes of wine");
	set_choice("choiceAdventure75", "1", "Whitey's Grove: Get Mysticality stats");
	set_choice("choiceAdventure90", "3", "Ballroom Curtains: skip choice");
	set_choice("choiceAdventure153", "4", "Defiled Alcove: skip choice");
	set_choice("choiceAdventure155", "4", "Defiled Niche: skip choice");
	set_choice("choiceAdventure157", "1", "Defiled Nook: get Mysticality stats"); 
	set_choice("choiceAdventure184", "2", "That Explains all the Eyepatches: shot of rotgut");
	set_choice("choiceAdventure186", "1", "A Test of Testarrrsterone: get stats");
	set_choice("choiceAdventure139", "3", "Hippies on the Verge of War: Fight a cadet");
	set_choice("choiceAdventure140", "3", "Hippies on the Verge of War: Fight a drill sergeant");
	set_choice("choiceAdventure141", "1", "Hippies on the Verge of War: Get Mysticality stats");
	set_choice("choiceAdventure143", "3", "Frats on the Verge of War: Fight a pledge");
	set_choice("choiceAdventure144", "3", "Frats on the Verge of War: Fight a drill sergeant");
	set_choice("choiceAdventure145", "2", "Frats on the Verge of War: Get food");
	set_choice("oceanDestination", "mysticality", "Take the Wheel and Sail to Mysticality stats");
	break;
case $stat[moxie]:
	set_choice("choiceAdventure9", "2", "Turn Castle wheel by way of Moxie");
	set_choice("choiceAdventure10", "1", "");
	set_choice("choiceAdventure11", "3", "");
	set_choice("choiceAdventure12", "2", "");
	set_choice("choiceAdventure73", "3", "Whitey's Grove: Get wedding cake and rice");
	set_choice("choiceAdventure74", "1", "Whitey's Grove: Get Moxie stats");
	set_choice("choiceAdventure75", "2", "Whitey's Grove: Get white lightning");
	set_choice("choiceAdventure90", "2", "Ballroom Curtains: get moxie");
	set_choice("choiceAdventure153", "4", "Defiled Alcove: skip choice");
	set_choice("choiceAdventure155", "1", "Defiled Niche: get Moxie stats");
	set_choice("choiceAdventure157", "4", "Defiled Nook: skip adventure");
	set_choice("choiceAdventure184", "1", "That Explains all the Eyepatches: fight a pirate");
	set_choice("choiceAdventure186", "3", "A Test of Testarrrsterone: get lots of Moxie"); 
	set_choice("choiceAdventure139", "3", "Hippies on the Verge of War: Fight a cadet");
	set_choice("choiceAdventure140", "2", "Hippies on the Verge of War: Get Moxie stats");
	set_choice("choiceAdventure141", "2", "Hippies on the Verge of War: Get rations");
	set_choice("choiceAdventure143", "3", "Frats on the Verge of War: Fight a pledge");
	set_choice("choiceAdventure144", "1", "Frats on the Verge of War: Get moxie stats");
	set_choice("choiceAdventure145", "2", "Frats on the Verge of War: Get food");
	set_choice("oceanDestination", "moxie", "Take the Wheel and Sail to Moxie stats");
	break;
}
print("Optimal ascension choices set.", "blue");
 
I downloaded the 1.3 update of this script and now it won't run for me anymore. I get the error:

Undefined reference to function 'get_counters' (bestbetweenbattle.ash, line 168)
 

Tarko

Member
Thanks for the script, I love it. been using it ever since I switched to KolMafia!


I have a suggestion/request:

How about a cookie handler?
Make sure you have cookie counter on and actually STOP auto-Adv when cookie triggers.
(either to browser or pre-set semi-rare)

I think That would be awsome.


Cheers, and thanks again for the script!
 

StormCrow42

Member
How about a cookie handler?
Make sure you have cookie counter on and actually STOP auto-Adv when cookie triggers.
(either to browser or pre-set semi-rare)

That's what a "counterScript" is for. Like perhaps mine. Although BBBS could possibly act as a fallback to eat cookies if there was no cookie counter.
 

Bale

Minion
zarqon, here's a suggestion for another improvement to this now essential script:

Code:
      case $location[fantasy airship]:
         if (available_amount($item[bronze breastplate]) == 0 || is_goal($item[bronze breastplate]))
            set_property("choiceAdventure178","1");       // get a breastplate
          else set_property("choiceAdventure178","2");    // skip
[COLOR="Red"]         if ((available_amount($item[metallic A]) < 1 || to_item(to_int(get_property("currentBountyItem"))) == $item[burned-out arcanodiode])[/COLOR]
              && numeric_modifier("Monster Level").to_int() >= 20)
            set_property("choiceAdventure182","1");       // fight MechaMechs for metallic A's/bounties
[COLOR="Red"]          else if (20 + max(0, (-1) * numeric_modifier("Combat Rate").to_int())/2.0 >= 19.15 + numeric_modifier("Experience").to_int())
            set_property("choiceAdventure182","3");      // get stats
          else set_property("choiceAdventure182","1");  // fight if stat non-combat sucks[/COLOR]
         return;

And for what it's worth, my main() has these lines:

Code:
   int max_mcd() {
      if(in_mysticality_sign()) return 11;
      return 10;
   }
   if(my_primestat() == $stat[moxie] || my_buffedstat($stat[moxie]) > my_buffedstat(my_primestat())* .9)
      auto_mcd(my_location());
   else if(current_mcd() < max_mcd())
      change_mcd(max_mcd());
 
Last edited:

Rinn

Developer
You don't even need an if check for max_mcd:
Code:
int max_mcd()
{
      return 10 + in_mysticality_sign();
}
 

Bale

Minion
Good point, but I'm afraid it won't work like that. You need to convert the boolean to int.

Code:
   if(my_primestat() == $stat[moxie] || my_buffedstat($stat[moxie]) > my_buffedstat(my_primestat())* .9)
      auto_mcd(my_location());
   else if(current_mcd() < 10 + in_mysticality_sign().to_int())
      change_mcd(10 + in_mysticality_sign().to_int());
 

Rinn

Developer
It'd work in c++ like that. :|

well it would have created a warning :|
 
Last edited:

Tarko

Member
Heya!

Im working on a between_battle script also, one that keeps tract of your mp_regen and makes sure to burn excess before adv somewhere.

As such, it needs to be run just before adv somewhere and being able to delay request to do his thing. (Like cookie counter-yish)

Anyway, I was wondering if unconditional triggers in moods were run just after or just before a battle?


As your script is running between_battle, I tought I'd post here.

Cheers.
 

Bale

Minion
Sadly I cannot give a simple answer to your question, so I'll give you two answers: Moods are run before battles when automatic adventuring or after battles if adventuring in the relay browser.
 

Tarko

Member
Thanks for the quick reply Bale.

Can I ask when is your Uni_Recovery called?

I was thinking that I should probably had my script to yours, because

1)they might compete for MP
2)my code is to take care of extra MP due to mp_regen, therefore could change my default (Love Song cast) to (lasagna bandage) or any other Spell_restorative (and not wait for the target HP to trigger.

Edit:
I guess it's a dumb question, you kinda answered it in the previous post
/Edit
 
Last edited:

zarqon

Well-known member
Come to think of it, Bale's recovery script should probably consider MP regen as a non-cost in calculating the cheapest option. If it doesn't already.
 

Bale

Minion
I don't consider MP regen. I'm not sure why I should since that mana is already restored when my script is called. Hopefully no turns will pass during restoration. Am I missing something?
 

zarqon

Well-known member
Nope! Don't know what I was thinking exactly. It made sense in my head at the time. One of those days...

If anything, SS should consider regen when deciding whether or not to Disco Nirvana. Hmmm.
 

Tarko

Member
Since Im working on those lines. Mp Regen is actually irrelevant.

What IS revelent is if the amount of MP we have after combat is > than before combat.

Altough it MIGHT seems the same, it's not.

Mp Regen min/max doesnt take into account familliar and the CCS.

So far the only way i found was to write the amount of mp in a file when the script is called.
The between combat it check currant mp and mp before combat, average the whole and set it for new 'true' mp regen. Yes, it means that number changes pretty much all the time.
 

Bale

Minion
Just wanted to share my current version of what happens in the airship:

Code:
      case $location[fantasy airship]:
         switch {     // Handle that fiddly choice adventure for maximal stat gain, or monster as needed
         case (get_property("currentBountyItem").to_item() == $item[burned-out arcanodiode]
           || available_amount($item[metallic A]) < 1) && numeric_modifier("Monster Level") >= 20:
            set_property("choiceAdventure182","1");    // fight MechaMechs for metallic As or bounties
            break;
         case is_goal($item[Penultimate Fantasy chest]) || get_property("choiceAdventure182") == "2":
            set_property("choiceAdventure182","2");    // Get chests for some reason
            break;
         case numeric_modifier("Monster Level") >= 20 
           && min(numeric_modifier("Combat Rate"), 0) /(-2.0) + 20 > (30 + numeric_modifier("Experience"))/2.0:
            set_property("choiceAdventure182","3");    // get stats from non-combat instead of with MechaMech
            break;
         case min(numeric_modifier("Combat Rate"), 0) /(-2.0) + 20 > (24 + numeric_modifier("Experience"))/2.0:
            set_property("choiceAdventure182","3");    // get stats from non-combat instead of weaker combat
            break;
         default:
            set_property("choiceAdventure182","1");    // fight if ML and +exp are high enough to make it give more mainstat
         }
         return;
These days though I'm including that in my recovery script because a betweenBattleScript won't activate while adventuring in the relay browser and I really like using the relay browser.
 
Top