Best Between Battle Script Ever -- formerly AutoMCD

Theraze

Active member
Rather than use up my last skeleton key on the daily dungeon, I only want to use the key if I will still have an extra for the lair. The easy fix is to change the retrieve_item(1, skeleton key) to retrieve_item(2, skeleton key).
 

Magus_Prime

Well-known member
I realize that not many people are doing Bees Hate You runs these days but: factoids. BBB was driving me crazy with the Twin Peak handling so I made a small addition to BBB:

Code:
case $location[twin peak]:
         int twinPeakProgress = to_int(get_property("twinPeakProgress"));
         if (my_path() == "Bees Hate You") {
            friendlyset(606,"6","");
            friendlyset(618,"2","");
         } else if ((twinPeakProgress & 1) == 0 && numeric_modifier("Stench Resistance") >= 4) {
            friendlyset(606,"1","Investigate the stinky room.");
            friendlyset(607,"1","");
         } else if ((twinPeakProgress & 2) == 0 && foodDrop() >= 50) {
            friendlyset(606,"2","Search for food.");
            friendlyset(608,"1","");
         } else if ((twinPeakProgress & 4) == 0 && item_amount($item[jar of oil]) > 0) {
            friendlyset(606,"3","Follow the music with a jar of oil.");
            friendlyset(609,"1","");
            friendlyset(616,"1","");
        } else if (twinPeakProgress == 7 && numeric_modifier("Initiative") >= 40) {
            friendlyset(606,"4","Chase your doppleganger.");
            friendlyset(610,"1","");
            friendlyset(617,"1","");
        } else friendlyset(606,"1","What to do here?");
        return;

Replace the case statement around line 522 with the above and it should properly handle grinding through the zone.
 
Last edited:

Bale

Minion
Any reason why you didn't just set the Bees Hate You skip at the beginning? After all, there's no reason to do the Stinky and Food Drop portions since it will never get any further?
 

Magus_Prime

Well-known member
Ha! No but you make an excellent point. By the time I got disgusted with the BBB settings I just threw the change where I did to finish the zone. I made the change to the code in the post.
 
Last edited:

adeyke

Member
When adventuring in the Secret Council Warehouse (Ed the Undying path), it should probably use the pairs of inventory/map as you find them. They're quest items, so there's no reason you'd want to hold onto them.
 

Bale

Minion
I've got that handling in my after battle script and that is where it belongs. Since best between battle only activates before adventuring, you'll always adventure once more than necessary if you put it there.
 

adeyke

Member
That one additional adventure would give you the Macguffin, no?

However, you're probably right that that would be better handled in a different script. The same probably goes for the whole use_goalcontaining_items.
 

Bale

Minion
Okay. You're right that the acquire the MacGuffin adventure would be triggered, so no-harm, no-foul.
 

zarqon

Well-known member
r20 Update

This update basically just catches the script up with the thread.

First, some fixes for challenge paths:
  • You don't need a boning knife, a beehive, or a model rocketship in Bugbear Invasion since there is no Sorceress' Tower.
  • You can't take the Twin Peak shortcuts in BHY (thanks for the code, Magus).

Add more familiars to famdrop (thanks for the code, five35).

If you haven't yet unlocked the Sorceress' crazy door, hold a skeleton key back when adventuring in the Daily Dungeon (good idea Theraze).

Automatically use warehouse maps when appropriate in the Secret Council Warehouse (good idea adeyke).

Enjoy!
 

phallen1

New member
May I suggest a change to the dropfam function? The grim brother and the grimstone golem have daily drops for when they're enthroned/Bjornified. I check to see if they're currently enthroned/Bjornified and if they have not gotten those drops, and if those are true then I'm not going to pull them out of the throne/Bjorn for their normal drops.

Code:
	  boolean throne(familiar fam) { return ( have_equipped($item[crown of thrones]) && my_enthroned_familiar() == fam ) ||
		( have_equipped($item[buddy bjorn]) && my_bjorned_familiar() == fam ); }

...

         case $familiar[grim brother]: if ( throne(f) && clim("_grimFairyTaleDropsCrown",2) ) return false; return clim("_grimFairyTaleDrops",5);
         case $familiar[grimstone golem]: if ( throne(f) && clim("_grimstoneMaskDropsCrown",1) ) return false; return clim("_grimstoneMaskDrops",1);
 

Magus_Prime

Well-known member
I just realized that, when automating turns at "Twin Peak", BBB doesn't use rusty hedge trimmers to speed up the zone when they are available.

It's too late to test it this run but would changing the code block that starts at line 44 from

Code:
void use_goalcontaining_items() {
   if (my_path() == "Way of the Surprising Fist") cli_execute("use * teachings of the fist");
    else if (!can_interact()) cli_execute("sell * meat stack; sell * dense meat stack");
   cli_execute("use * evil eye");

to

Code:
void use_goalcontaining_items() {
   if (my_path() == "Way of the Surprising Fist") cli_execute("use * teachings of the fist");
    else if (!can_interact()) cli_execute("sell * meat stack; sell * dense meat stack");
   cli_execute("use * evil eye");
   cli_execute("use 1 rusty hedge trimmer");

be sufficient or are there ramifications I'm not considering?
 
Last edited:

adeyke

Member
That's definitely dangerous. The hedge trimmers aren't a quest item, which means:
  • A player might have them in their inventory even after the quest has been completed.
  • A player might want to mallsell them instead of using them.
 

Theraze

Active member
Also, wouldn't that use the rusty hedge trimmer including buying more from the mall even if you didn't need them?
 

Bale

Minion
You could check if(get_property("twinPeakProgress") != "15") and only use hedge trimmers if true.

And why in the world are those lines using cli_execute() inside of a CLI script instead of use()?
 

Bale

Minion
cli_execute() wouldn't work outside a cli script. It just seems really odd to use cli_execute("use * evil eye"); instead of use(item_amount($item[evil eye]), $item[evil eye]);
 

Theraze

Active member
You mean it wouldn't work outside an ASH script, since cli_execute makes it convert from ASH to CLI as the scripting type. Though you could have a CLI script use ASH or ASHQ to convert to ASH for your cli_execute call, like this:
> ashq (cli_execute("ashq cli_execute(\"ashref\ hash\");"))

string my_hash( )
 

Bale

Minion
Ok, I excised the code for Flavour from my mood script. Granted, I wrote this a year or so back (I obviously didn't care about wasting 1MP here and there, which was one of several reasons my mood script was not shareable), but it has served me well. It skips Flavour if you have no Pastamancer or Sauceror spells. After that, it chooses the element to which the majority of the monsters in the zone are vulnerable, with some weight also given to the element you already have the most bonus spell damage in. It skips elements if any monsters in the zone are immune to that element, so for zones where all elements have an immune monster, it defaults to spirit of nothing.

At least, I think that's how it works. Haha.

PHP:
// returns the element to which attacks would be best tuned for this zone
int[element] get_vulns() {
   int[element] vulns, res;
   foreach i,m in my_location().get_monsters() {
      switch (m.defense_element) {
         case $element[none]: continue;
         case $element[hot]: vulns[$element[sleaze]] += 1; vulns[$element[stench]] += 1; break;
         case $element[spooky]: vulns[$element[hot]] += 1; vulns[$element[stench]] += 1; break;
         case $element[cold]:   vulns[$element[hot]] += 1; vulns[$element[spooky]] += 1; break;
         case $element[sleaze]: vulns[$element[cold]] += 1; vulns[$element[spooky]] += 1; break;
         case $element[stench]: vulns[$element[cold]] += 1; vulns[$element[sleaze]] += 1; break;
      }
      res[m.defense_element] += 1;
   }
   foreach e in vulns if (res contains e) remove vulns[e];
   if (count(vulns) == 0) foreach el in $elements[] if (!(res contains el)) vulns[el] += 1;  // all elements are cool if none are
   return vulns;
}
skill get_flavour(element e) {
   switch (e) {
      case $element[cold]: return $skill[spirit of peppermint];
      case $element[hot]: return $skill[spirit of cayenne];
      case $element[spooky]: return $skill[spirit of wormwood];
      case $element[sleaze]: return $skill[spirit of bacon grease];
      case $element[stench]: return $skill[spirit of garlic];
      default: return $skill[spirit of nothing];
   }
}
void intrinsics(){
  // flavour of magic
   boolean have_spells() { foreach s in $skills[] if (have_skill(s) && s.combat && $classes[pastamancer,sauceror] contains s.class) return true; return false; }
   if (!have_skill($skill[flavour of magic]) || !have_spells()) return;
   boolean have_spirit() { for i from 167 to 171 if (have_effect(to_effect(i)) > 0) return true; return false; }
   int[element] vulns = get_vulns();
   element[int] sorte;
   foreach v in vulns sorte[count(sorte)] = v;
   sort sorte by -(vulns[value] + numeric_modifier(value+" Spell Damage"));
   if (count(sorte) > 0) {
      if (have_effect(to_effect(get_flavour(sorte[0]))) == 0) use_skill(1,get_flavour(sorte[0]));
   } else if (have_spirit()) use_skill(1,$skill[spirit of nothing]);
}

Have fun!

I've been using my own version of this for some time, but I have discovered that it is a problem in OCRS because the default was cold and a common OCRS modifier is frozen which makes every monster cold aligned. Obviously I had to stop all my non-elemental zones from using cold as the default element. Finally I settled on this, although I'm not 100% sure it is the best solution.

PHP:
void flavour() {
	// Convert Element to Spirit
	skill get_flavour(element e) {
		switch (e) {
		case $element[cold]:   return $skill[spirit of peppermint];
		case $element[hot]:    return $skill[spirit of cayenne];
		case $element[spooky]: return $skill[spirit of wormwood];
		case $element[sleaze]: return $skill[spirit of bacon grease];
		case $element[stench]: return $skill[spirit of garlic];
		}
		return $skill[spirit of nothing];
	}
	// Does the character have any active spirit?
	boolean have_spirit() {
		for i from 167 to 171
			if(have_effect(to_effect(i)) > 0) return true; 
		return false;
	}
	// 
	if(have_skill($skill[flavour of magic])) {
		switch(my_location()) {
		case $location[The Ancient Hobo Burial Ground]: // Everything here is immune to elemental dmg
			if(have_spirit())
				use_skill(1, $skill[spirit of nothing]);
		case $location[Hobopolis Town Square]: // Don't interfere with Scarehobos
			return;
		}
		// Find the element to which attacks would be best tuned for this zone
		float [element] vulns, res;
		foreach el in $elements[cold, hot, sleaze, spooky, stench]
			vulns[el] = 0;
		foreach i,m in my_location().get_monsters() {
			switch (m.defense_element) {
			case $element[none]: continue;
			case $element[hot]:    vulns[$element[sleaze]] += 1; vulns[$element[stench]] += 1; break;
			case $element[spooky]: vulns[$element[hot]] += 1;    vulns[$element[stench]] += 1; break;
			case $element[cold]:   vulns[$element[hot]] += 1;    vulns[$element[spooky]] += 1; break;
			case $element[sleaze]: vulns[$element[cold]] += 1;   vulns[$element[spooky]] += 1; break;
			case $element[stench]: vulns[$element[cold]] += 1;   vulns[$element[sleaze]] += 1; break;
			}
			res[m.defense_element] += 1;
		}
		if(my_path() == "One Crazy Random Summer")
			vulns[$element[cold]] -= 0.5;
		foreach e in vulns
			if(res contains e)
				remove vulns[e];
		// Now, sort them
		element [int] sorted;
		foreach v in vulns
			sorted[ count(sorted) ] = v;
		if(count(sorted) > 0) {
			sort sorted by -(vulns[value] * (numeric_modifier(value+" Spell Damage") + 1));
			if(have_effect(to_effect(get_flavour(sorted[0]))) == 0)
				use_skill(1, get_flavour(sorted[0]));
		}  else if (have_spirit()) use_skill(1,$skill[spirit of nothing]); 
	}
}
 

Magus_Prime

Well-known member
For the neophyte ash scripters among us: would I save the above to an ash file, set it as my between battle script and then import zarqon's BBB into that?

Edit: Nevermind I found this discussed a few pages back. Out of curiosity would what I outlined above work?
 
Last edited:
Top