Best Between Battle Script Ever -- formerly AutoMCD

Bale

Minion
Now that Veracity has fixed up the Spooky Forest choice adventure to not get messed up automating the spooky sapling, some handling needs to be added to BBB. Right now my newLife sets the forest to get a mosquito, so I'm using the following code in my mood script.

PHP:
	case $location[spooky forest]:
		// Unlock Hidden Temple
		if(hidden_temple_unlocked()) return;
		if(item_amount($item[mosquito larva] > 0 && item_amount($item[tree-holed coin]) < 1 && item_amount($item[spooky temple map]) < 1) {
			friendlyset("choiceAdventure502","2","Get tree-holed coin.");
			friendlyset("choiceAdventure505","2","Get tree-holed coin.");
		} else if(item_amount($item[tree-holed coin]) > 0) {
			friendlyset("choiceAdventure502","3","Get spooky temple map.");
			friendlyset("choiceAdventure506","3","Get spooky temple map.");
			friendlyset("choiceAdventure507","1","Get spooky temple map.");
		} else if(item_amount($item[Spooky-Gro fertilizer]) < 1) {
			friendlyset("choiceAdventure502","3","Get Spooky-Gro fertilizer.");
			friendlyset("choiceAdventure506","2","Get Spooky-Gro fertilizer.");
		} else if(item_amount($item[spooky sapling]) < 1) {
			friendlyset("choiceAdventure502","1","Get spooky sapling.");
			friendlyset("choiceAdventure503","3","Get spooky sapling.");
			friendlyset("choiceAdventure504","3","Get spooky sapling.");
		} else {
			use(1, $item[spooky temple map]);
			vprint("The Hidden Temple has been found!", "blue", 1);
		}
		return;
 
Last edited:

zarqon

Well-known member
Thanks Bale, this is a good start. I still want this to be thoroughly goal-sensitive, however, so once the code is adjusted for all goal possibilities (because I don't think mafia will set choiceadvs if you have a goal of a starter item or something), choiceadv handling for the Spooky Forest will return to BBB. Yay!
 

Veracity

Developer
Staff member
(because I don't think mafia will set choiceadvs if you have a goal of a starter item or something)
As a matter of fact, the old handling for choices #26 and #27 (the 6 starter items) would automatically adjust which path it took if you had a starter item in your goals. It's worked that way for years and still works that way.

We do not automatically adjust choices to get the three hidden temple unlock items, though. That would be a feature request.
 

Bale

Minion
That code I posted yesterday was bugged. Oops. Here's the fix.

PHP:
	case $location[spooky forest]:
		// Unlock Hidden Temple
		if(hidden_temple_unlocked()) return;
		if(item_amount($item[mosquito larva]) > 0 && item_amount($item[tree-holed coin]) < 1 && item_amount($item[spooky temple map]) < 1) {
			friendlyset("choiceAdventure502","2","Get tree-holed coin.");
			friendlyset("choiceAdventure505","2","Get tree-holed coin.");
		} else if(item_amount($item[tree-holed coin]) > 0) {
			friendlyset("choiceAdventure502","3","Get spooky temple map.");
			friendlyset("choiceAdventure506","3","Get spooky temple map.");
			friendlyset("choiceAdventure507","1","Get spooky temple map.");
		} else if(item_amount($item[spooky temple map]) > 0) {
			if(item_amount($item[Spooky-Gro fertilizer]) < 1) {
				friendlyset("choiceAdventure502","3","Get Spooky-Gro fertilizer.");
				friendlyset("choiceAdventure506","2","Get Spooky-Gro fertilizer.");
			} else if(item_amount($item[spooky sapling]) < 1) {
				friendlyset("choiceAdventure502","1","Get spooky sapling.");
				friendlyset("choiceAdventure503","3","Get spooky sapling.");
				friendlyset("choiceAdventure504","3","Get spooky sapling.");
			} else {
				use(1, $item[spooky temple map]);
				vprint("The Hidden Temple has been found!", "blue", 1);
			}
		}
		return;
 

Bale

Minion
Here's some more code I'm adding to my mood. I think you'll want it in BBB also:

PHP:
	case $location[Knob Barracks]:
		if(have_outfit("knob goblin elite guard uniform"))
			friendlyset(522,"2","Ignore the Footlocker.");
		else friendlyset(522,"1","Complete the KGE Outfit.");
		return;
 

Bale

Minion
And as a result of my feature request, you might want to add this to BBB also.

PHP:
	case $location[Guano Junction]:
	case $location[Batrat and Ratbat Burrow]:
	case $location[Beanbat Chamber]:
		if(last_monster() == $monster[Screambat] && is_goal($item[sonar-in-a-biscuit]))
			remove_item_condition(1, $item[sonar-in-a-biscuit]);
		return;
 

Bale

Minion
You don't have to Go Fish! Here's another!

PHP:
	case $location[haunted bedroom]:
		if(item_amount($item[Lord Spookyraven spectacles]) < 1)
			friendlyset(84,"3","Get Spectacles from the Ornate Nightstand.");
		else if(my_primestat() == $stat[mysticality])
			friendlyset(84,"2","Get Mysticality from the Ornate Nightstand.");
		else friendlyset(84,"1","Get Meat from the Ornate Nightstand.");
		return;

I guess you can tell which script I've been working on lately.
 
Last edited:

mredge73

Member
Speaking of Fish...bug report.
This script crashes if you try to auto-adventure on the sea floor before freeing little brother.
monkeycastle.php is not available until you free little brother. It is called on BBB subroutine involving dolphins.
 

Bale

Minion
Been refining my mood script a tiny bit. My handling for the Spooky Forest has gotten a little bit more robust:

PHP:
	boolean need_temple() {
		if(item_amount($item[mosquito larva]) > 0) return true;
		foreach key in $items[tree-holed coin, spooky sapling, Spooky Temple map, Spooky-Gro fertilizer]
			if(is_goal(key)) return true;
		return false;
	}

PHP:
	case $location[spooky forest]:
		if(is_goal($item[mosquito larva])) {
			friendlyset(502, 2, "Get mosquito larva");
			friendlyset(505, 1, "Get mosquito larva");
			friendlyset(507, 1, "Get mosquito larva");
			return;
		}
		if(hidden_temple_unlocked()) return;
		// Unlock Hidden Temple
		if(need_temple() && item_amount($item[tree-holed coin]) < 1 && item_amount($item[spooky temple map]) < 1) {
			friendlyset(502, 2,"Get tree-holed coin.");
			friendlyset(505, 2,"Get tree-holed coin.");
		} else if(item_amount($item[tree-holed coin]) > 0) {
			friendlyset(502, 3,"Get spooky temple map.");
			friendlyset(506, 3,"Get spooky temple map.");
			friendlyset(507, 1,"Get spooky temple map.");
		} else if(item_amount($item[spooky temple map]) > 0) {
			if(item_amount($item[Spooky-Gro fertilizer]) < 1) {
				friendlyset(502, 3,"Get Spooky-Gro fertilizer.");
				friendlyset(506, 2,"Get Spooky-Gro fertilizer.");
			} else if(item_amount($item[spooky sapling]) < 1) {
				friendlyset(502, 1,"Get spooky sapling.");
				friendlyset(503, 3,"Get spooky sapling.");
				friendlyset(504, 3,"Get spooky sapling.");
			} else {
				use(1, $item[spooky temple map]);
				vprint("The Hidden Temple has been found!", "blue", 1);
			}
		}
		return;

I'll be waiting to see if you make that more eloquent.
 

Bale

Minion
There seems to be no limit to my helpfulness:

PHP:
	case $location[Palindome]:
		if(is_goal($item[Ye Olde Navy Fleece]) && available_amount($item[Ye Olde Navy Fleece]) == 0)
			friendlyset(180, 1,"Get Fleeced.");
		else if(available_amount($item[Ye Olde Navy Fleece]) > 0)
			friendlyset(180, 2,"You've got a fleece. You cannot get another.");
		return;
 

Bale

Minion
Not to be obsessive or anything, but...

PHP:
	else if(my_familiar() == $familiar[mini-hipster] && have_equipped($item[ironic moustache])
	  && run_combat().contains_text("The words POWER UP appear above")) {
		cli_execute("fold fixed-gear bicycle");
		equip($item[fixed-gear bicycle]);
	 }
 

Bale

Minion
If you call run_combat() when you're not in a combat it will return the last page load of the previous combat. Awesome, eh?
 

zarqon

Well-known member
Wow, how did you figure that out? That is awesome.

EDIT: Also, doesn't "POWER UP" get screwed before under the sword behind?
 

heeheehee

Developer
Staff member
Capitalized -- pretty sure sword behind only changes lowercase words -- at least, that's how it works in chat. On the other hand, "above" might be affected. "The words POWER UP appear ", perhaps.

(well, sword behind is a bit funny. "(?<!\\S)[a-z]+(?!\\S)" should match all the words that it can affect. Basically, a word consisting only of lower-case letters that doesn't have a non-space on either side.)
 

Bale

Minion
Wow, how did you figure that out? That is awesome.

Actually, I read it here on this forum. I can't remember who posted it. I think it was StDoodle who figured it out, but I might be mistaken.

It's kinda a cool feature to enable a betweenBattleScript respond to specific events at the end of the previous fight.
 
Last edited:

StDoodle

Minion
I think it was one of the devs responding to one of my questions, actually. Though it's pretty foggy. Just don't want to steal credit for something I'm pretty sure I didn't do. ;)

It's possible you're confusing this particular info with the time I mentioned how to "cheat" mafia into manipulating outfits within a mood by using visit_url() on the save outfit page.
 

Bale

Minion
I never seem to stop posting code here. Sorry. I've added this to the top of my Spooky Forest section:

PHP:
		if(have_skill($skill[Super-Advanced Meatsmithing])) {
			int need_bar = (have_skill($skill[Double-Fisted Skull Smashing])? 2: 1) - closet_amount($item[bar skin]) - available_amount($item[bar whip]);
			if(need_bar > 0 && item_amount($item[bar skin]) > 0)
				put_closet(min(item_amount($item[bar skin]), need_bar), $item[bar skin]);
		}

That's to deal with mafia's newfound propensity for selling off bar skins. It's really not worth the small amount of meat to lose a potentially useful bar skin. You'll probably want to add a vprint() in there. I just didn't feel like it.
 
Last edited:
Top