Best Between Battle Script Ever -- formerly AutoMCD

Bale

Minion
Finally looked over your dolphin code. Just thought I'd mention that this subroutine is now part of my betweenBattleMood.

PHP:
void dolphin() {
	item dolphinItem = to_item(get_property("dolphinItem"));
	if(get_counters("Dolphin",1,11) == "" && dolphinItem != $item[sand dollar] &&
	  (is_goal(dolphinItem) || mall_price(dolphinItem) > 3* mall_price($item[sand dollar]))) {
		if(item_amount($item[dolphin whistle]) == 0 && mall_price($item[dolphin whistle]) > mall_price($item[sand dollar]))
			if(retrieve_item(1, $item[sand dollar]))
				visit_url("monkeycastle.php?pwd&action=buyitem&whichitem=3997&quantity=1");
		if(retrieve_item(1,$item[dolphin whistle]))
			use(1,$item[dolphin whistle]);
	}
}

I obviously owe a lot to your code although I check mall price to decide if it is worth spending an adventure to get back the item the dolphin stole. (Since it takes 11 turns to get another dolphin I don't want to waste it on a relatively cheap thingpouch (unless that is a goal) when I'll probably get something more valuable stolen several turns later.)

I also fixed a bug in your code: You forgot to ensure that the character has a sand dollar before getting a dolphin whistle from Big Brother.
 

zarqon

Well-known member
That wasn't a bug -- if you don't get a whistle from Big Brother it will still call retrieve_item(). But it could cause a needless server hit.

I'll probably gank some of these ideas for BBB. Whistling based on mall price if no goals are specified is a fine idea. As always, thanks for sharing. (I think you're a compulsive code-sharer, actually. You may want to talk to a trained professional about it.)
 

Bale

Minion
I am fairly compulsive, but I enjoy my malady since sometimes you share code right back at me. :D

That wasn't a bug -- if you don't get a whistle from Big Brother it will still call retrieve_item(). But it could cause a needless server hit.
But won't it then get the whistle from the mall, even if the whistle's mall price is higher than the sand dollar's mall price?
 

zarqon

Well-known member
This looks pretty good to me:

Code:
   if (get_counters("Dolphin",1,11) == "" && to_item(get_property("dolphinItem")) != $item[none]) {
      boolean no_goals_here() {
         foreach num,mob in get_monsters(my_location())
            if (has_goals(mob)) return false;
         return true;
      }
      if (is_goal(to_item(get_property("dolphinItem"))) || (no_goals_here() &&
         mall_price(to_item(get_property("dolphinItem"))) > (2*mall_price($item[sand dollar]))+to_int(get_property("valueOfAdventure")))) {
         if (item_amount($item[dolphin whistle]) == 0 && mall_price($item[dolphin whistle]) > mall_price($item[sand dollar]) && retrieve_item(1,$item[sand dollar])
            visit_url("monkeycastle.php?pwd&action=buyitem&whichitem=3997&quantity=1");
         if (retrieve_item(1,$item[dolphin whistle])) use(1,$item[dolphin whistle]);
      }
   }

If Bale doesn't spot any more bugs, I'll go ahead and update the script with this.
 
Last edited:

Bale

Minion
Looks like I'm going to have to upgrade my code. That looks wonderful.

All I can comment on is that there are a lot of items within about 2.5 times the price of a sand dollar, but then there is a big jump in price to the really expensive items in a zone, so I chose 3* the sand dollar's price on purpose. If you disagree, fine, that's not a bug. I just think that 3* is better. It pretty much pre-empts the cost of an adventure because of that discontinuity in prices that I'm seeing.

PHP:
void dolphin() {
	item dolphinItem = to_item(get_property("dolphinItem"));
	if(get_counters("Dolphin",1,11) == "" && dolphinItem != $item[none]) {
		boolean no_goals_here() {
			foreach num,mob in get_monsters(my_location())
				foreach it in item_drops(mob)
					if(is_goal(it)) return false;
			return true;
		}
		if(is_goal(dolphinItem) || (no_goals_here() && mall_price(dolphinItem) > 3*mall_price($item[sand dollar]))) {
			if(item_amount($item[dolphin whistle]) == 0 && mall_price($item[dolphin whistle]) > mall_price($item[sand dollar])
			  && retrieve_item(1,$item[sand dollar]))
				visit_url("monkeycastle.php?pwd&action=buyitem&whichitem=3997&quantity=1");
			if(retrieve_item(1,$item[dolphin whistle])) use(1,$item[dolphin whistle]);
		}
	}
}

Thank you for helping to improve my code.
 
Last edited:

zarqon

Well-known member
I'll trust your research -- I'll also apply the *2 to valueOfAdventure. I really think that should be included in the calculation since it is part of the cost of fighting a dolphin.

Behavioral changes in version 1.6:
  • BBB will no longer whistle for thingpouches unless you have sand dollars as a goal.
  • If no goals drop in your location (because you haven't set any or you're adventuring somewhere else), BBB will whistle for items that are worth more than twice the cost of whistling for them.
  • BBB will fight your shaking 4-d camera's monster if it drops goals or bounty items.
 

Raven434

Member
I don't want a Bronze breastplate, but I don't see the corresponding variable to tell BBB to stop trying to get one for me.

I love this script. It is making my TT run very fun as it does the turtling for me.

Thanks.
 
Last edited:

zarqon

Well-known member
BBB is written to get a breastplate, then stop getting them unless they are goals. If you never want to get one, you have two options:

1) Get one, then don't worry about it anymore.
2) Delete that section (lines 65-67) from BBB.
 

Raven434

Member
Thanks Zarqon.

I keep manually setting 'don't get a breastplate'.

I have them in Hagnk's.

> storage bronze

bronze breastplate (5)

Same question for blackberry class items.

Lines 26-41 based on what you just said.

:)
 

zarqon

Well-known member
That's the same deal, same options.

In both of these cases the script is checking available_amount() which includes pulls from storage if you have them available. You must either be in HC or out of pulls, which means the script thinks you have none of the item available, and therefore tries to get one.
 

Rinn

Developer
I have a minor request, I have a different script set as my betweenBattleScript which includes BestBetweenBattle.ash, but to call your script I either have to do a cli_execute("call BestBetweenBattle.ash") which I dislike, or to edit BestBetweenBattle.ash after every update to move all the functionality out of main() into a script I can call directly (bbb() in my case). Whenever you do your next update could you do this for me so I don't have to edit the script when I update?
 

adeyke

Member
This script is immensely useful. I'm loving the auto-dolphin and the choice adventures. There's just one more choice adventure I wish it would handle: the corpses in the spooky forest. Here's my attempt to code for that:

(Removed code. See below for corrected version).

The idea is that it would first try to satisfy any goals, then ensure you have an accordion, then ensure you have a turtle totem, then spend all future choices on spices (plus getting the saucepan).

This is basically the logic I use when doing it by hand (though I make no claims of optimality), so I figured it'd be nice if a script could automate it for me. I've never done any ASH scripting, so I hope it actually works correctly.
 
Last edited:

adeyke

Member
Here's the corrected version
Code:
         if (is_goal($item[stolen accordion]) || is_goal($item[mariachi pants])) {
            friendlyset("choiceAdventure26","3","Search moxie class.");
            friendlyset("choiceAdventure29","2","Search accordion thief.");
         } else if (is_goal($item[helmet turtle]) || is_goal($item[turtle totem])) {
            friendlyset("choiceAdventure26","1","Search muscle class.");
            friendlyset("choiceAdventure27","2","Search turtle tamer.");
         } else if (is_goal($item[saucepan]) || is_goal($item[spices])) {
            friendlyset("choiceAdventure26","2","Search mysticality class.");
            friendlyset("choiceAdventure28","2","Search sauceror.");
         } else if (is_goal($item[disco mask]) || is_goal($item[disco ball])) {
            friendlyset("choiceAdventure26","3","Search moxie class.");
            friendlyset("choiceAdventure29","1","Search disco bandit.");
         } else if (is_goal($item[seal-clubbing club]) || is_goal($item[seal-skull helmet])) {
            friendlyset("choiceAdventure26","1","Search muscle class.");
            friendlyset("choiceAdventure27","1","Search seal clubber.");
         } else if (is_goal($item[pasta spoon]) || is_goal($item[ravioli hat])) {
            friendlyset("choiceAdventure26","2","Search mysticality class.");
            friendlyset("choiceAdventure28","1","Search pastamancer.");
         } else if (available_amount($item[stolen accordion]) == 0 && available_amount($item[calavera concertina]) == 0 &&
             available_amount($item[Rock and Roll Legend]) == 0 && available_amount($item[Squeezebox of the Ages]) == 0) {
            friendlyset("choiceAdventure26","3","Search moxie class.");
            friendlyset("choiceAdventure29","2","Search accordion thief.");
         } else if (available_amount($item[turtle totem]) == 0 && available_amount($item[Mace of the Tortoise]) == 0 &&
             available_amount($item[Chelonian Morningstar]) == 0) {
            friendlyset("choiceAdventure26","1","Search muscle class.");
            friendlyset("choiceAdventure27","2","Search turtle tamer.");
         } else {
            friendlyset("choiceAdventure26","2","Search mysticality class.");
            friendlyset("choiceAdventure28","2","Search sauceror.");
         }
 
Last edited:

zarqon

Well-known member
@Rinn and adeyke: your requested changes have been made. Adeyke, see the first post for more details -- I made a slight change to your proposed functionality.

Also, FYI everyone -- I made this script autosell meat stacks and dense meat stacks if you're in HC. There's no reason I could think of to prefer those items sitting in inventory over meat while ascending in HC. If you really want them for whatever reason, putting them in your closet will prevent them from being sold.
 

Tarko

Member
I keep having the "New Version" msg .

Even if I did update to the new version and refreshed the script menu.

Any idea?

edit
Even closing/Restarting Mafia
/edit
 
Last edited:

zarqon

Well-known member
I suspect this problem fixed itself since it's been a day, but for future reference if you have that problem again, try typing "set _version_automcd =" in the CLI (without quotes). That ought to fix it.
 
Last edited:

zarqon

Well-known member
Um, yes.

Has anyone else noticed this script seems not to be firing with recent builds? I want to confirm this before reporting a bug.
 
Top