Best Between Battle Script Ever -- formerly AutoMCD

adeyke

Member
Here's an idea for another addition:
Code:
      case $location[fun house]:
          if (numeric_modifier("clownosity") < 4) {
              friendlyset("choiceAdventure151","2","Skip Beelzebozo due to insufficient clownosity.");
          } else {
              friendlyset("choiceAdventure151","1","Fight Beelzebozo.");
          }
          return;
 

Bale

Minion
zarqon, I was wondering what you thought of this bit. I fear it seems rather more complicated than it needs to be, but I think I caught every corner case where there is no longer a need to ID potions. Can you think of some way improve it? 'Cause I have this niggling feeling that I missed something interesting...

PHP:
boolean need_bangs() {
	int gate_potions, missing_potions;
	boolean inebriety, teleportitis, need_extra;
	for i from 819 to 827 {
		switch(get_property("lastBangPotion"+i)) {
		case "teleportitis":
			teleportitis = true;
		case "blessing": case "detection": case "mental acuity": case "ettin strength":
			if(item_amount(to_item(i)) == 0)
				missing_potions = missing_potions + 1;
			else gate_potions = gate_potions + 1;
			break;
		case "":
			if(item_amount(to_item(i)) == 0)
				missing_potions = missing_potions + 1;
			else if(item_amount(to_item(i)) == 1)
				need_extra = true;
			break;
		case "inebriety":
			inebriety = true;
		//case "healing": case "sleepiness": case "confusion":
		}
		if(gate_potions == 5) return false;
	}
	if(teleportitis && inebriety && missing_potions == 0) return false;
	if(need_extra) return true;
	return false;
}

For use in places like this, of course:

PHP:
	case $location[Dungeons of Doom]:  // Open large and small boxes?
		if(need_bangs()) {
			if(item_amount($item[large box]) > 0)
				use(item_amount($item[large box]), $item[large box]);
			if(item_amount($item[small box]) > 0)
				use(item_amount($item[small box]), $item[small box]);
		}
 
Last edited:

zarqon

Well-known member
The way I do it is specify "1 potion of blessing, 1 potion of detection, 1 potion of mental acuity, 1 potion of ettin strength" as goals. Then FTF and BBB work together to make it awesome. No additions necessary.
 

Bale

Minion
That makes sense. What about a potion of teleportitis also?

It doesn't really suit my style to do it that way though since I don't really do much goal controlled automated adventuring. About the only goals I use are ones like "Level 10" and "Level 12". I wouldn't want to miss all the "awesome narrative" in the DoD. Though right now the Greater-Than-Sign is actually much more interesting.
 

Gdunge

Member
I just got a Slimeling and am looking for a good way to automate his use.

It seems to me that the BBB is a good place to feed items to the Slimeling. Or did I miss something obvious?

Thanks!
 

Bale

Minion
Well, you can feed the slimeling from the item manager. Most people wouldn't want a script deciding which gear to throw into your slimeling's maw. A lot of time you don't even need more MP, so it would be a waste to throw more in, just because the little guy is hungry. Nobody needs 900 turns of every buff just because it can be done. It's good to save for later.
 

Gdunge

Member
Well, you can feed the slimeling from the item manager. Most people wouldn't want a script deciding which gear to throw into your slimeling's maw. A lot of time you don't even need more MP, so it would be a waste to throw more in, just because the little guy is hungry. Nobody needs 900 turns of every buff just because it can be done. It's good to save for later.

It would seem that I'm not "most people", which is something I've long suspected. :)

As far as the mana-producing effect, I agree with you that it makes little sense to feed items to the slimeling UNLESS you need MP. Which implies that if you DO need MP, perhaps it makes sense. Which further implies that perhaps the place for this functionality is... UniversalRestore.ash? He could programmatically be fed items from the junk list, maybe? The junk item that provides the best MP value?

But what I was actually wishing for was an automated method of feeding meat stack items to the slimeling to get slime stacks.

I imagine a threshold setting of how many slime stacks you want to have in inventory, and BBB feeding the slimeling a basic meat item if the quantity of slime stacks is below the threshold, then waiting for a slime stack to drop. Repeat.

Is there a way to do this already built into KoLmafia, or into some other script?

Thanks,

Gdunge
 

Bale

Minion
Which implies that if you DO need MP, perhaps it makes sense. Which further implies that perhaps the place for this functionality is... UniversalRestore.ash?
Nope. restore scripts are called with parameters that basically say have X amount of HP/MP ready for me right now. By contrast this simply wants mp ready after the next fight. I'd rather make it a mood script. It could monitor levels of various buffs and feed items to your slimeling/GGG/Hobo whichever is equipped when the levels get low, so that the extra mana can be burned off after the current fight.
He could programmatically be fed items from the junk list, maybe? The junk item that provides the best MP value?
The principle is decent, but I don't think scripts can have access to the junk list so you'd need a mapfile.

But what I was actually wishing for was an automated method of feeding meat stack items to the slimeling to get slime stacks.

I imagine a threshold setting of how many slime stacks you want to have in inventory, and BBB feeding the slimeling a basic meat item if the quantity of slime stacks is below the threshold, then waiting for a slime stack to drop. Repeat.
Well that is reasonably simple. I'd do it as a mood script simply because you can have as many of those as you want and it can be added or removed from your mood easily. If zarqon wanted to, BBB could do so.
 

Gdunge

Member
Thanks for taking the time to reply! My first stuffed Hodgman or Red Balloon is yours!

I'd do it as a mood script simply because you can have as many of those as you want and it can be added or removed from your mood easily. If zarqon wanted to, BBB could do so.

I have been thinking of "moods" as essentially stateless and reacting only to a player's active effects. Your chamois.ash script, for instance, gets called only when the player is slimed, and doesn't keep any persistent data. (Unless I missed it, a distinct possibility. I'm not much of a programmer.)

I guess one could have a mood script that triggers unconditionally, and keeps persistent track of when the slimeling needs to be fed. Is that what you mean?

How would an ASH script store persistent data? zlib?
 

zarqon

Well-known member
What you might like is for FTF to detect slimeling hunger and set a flag. Then, BBB or a mood script could either a) abort when your slimeling is full, or b) feed your slimeling.

Currently the action filter of FTF doesn't even detect slimeling hunger, which means SS can't effectively stasis using slimelings. Slimeling support is on the list of things to add to SS -- unfortunately I doubt I'll have a slimeling for quite a while. Help me get a slimeling and I'd be much more motivated to add proper support. :)

ASH scripts can store persistent data in two ways:
  1. Maps. These are usually collections of data used as resources, but can also be used for storing variables (ZLib settings are actually just a map file).
  2. Mafia properties, sometimes also called preferences.

Both of these are per-character. Some things to keep in mind when deciding whether to use mafia preferences or ZLib settings:

  • All ZLib settings are loaded into memory for every instance of ZLib. The more ZLib settings there are, the slower every ZLib script gets. It's a negligible performace difference, but still worth thinking about.
  • Mafia properties, so far as I know, are loaded into memory once per session.
  • The mafia preferences file is getting bigger and bigger, and will keep getting bigger. It has plenty of settings that you would never use in a script, and sometimes it's hard to know which are mafia-created settings and which are script-created. In the interest of organization, ZLib settings may be the better choice.
  • Will it be cleared daily? If so, then a mafia daily property (starts with an underscore) might be best.
  • Is it something most likely to be configured per user rather than per character? If so, then a regular old script variable may be the best choice.
 

heeheehee

Developer
Staff member
I'll see what I can do with regards to getting you a slimeling, at some point. Just need to get some seed money (seed meat? o_O) on the non-ascending character that'll be doing larva runs from here on out (technically for Monsoon, but I imagine I can work in some exceptions). Also need spare time, which may not be happening in the near future. =(

(Back to the topic) For persistent data that's static (i.e. not going to change unless new game content forces it to be updated), note that you can always have a separate map which you can load from the Map Manager via ZLib's load_current_map() function. This won't slow down other ZLib scripts, which is a plus!
 

slyz

Developer
If it helps, I shamelessly stole and modified a script posted by bleary here. It's HC oriented, and I started making my own list of items you shouldn't consider feeding to the slimeling, but you can customize it easily.

All it does is print a list of items you could feed to the slimeling with a color code: green if it's OK, blue if you need to keep one or more of that item, red if you would get more MP from autoselling (I haven't seen any yet, but it might pop up when the slimeling has only a few pounds and you don't have many +weight skills).

With Jason's recent update to relay browser scripts, it might be a worthwhile project to change this into a feeding menu, but I don't think I know enough about html to do that.

I wouldn't consider letting a script feed items to my slimeling during a run, although I haven't looked into meat items. And I don't use my slimeling in aftercore, but I guess it would be easy to find out the item with the best price/charge ratio in the mall and feed it automatically.

EDIT: I rememberd get_inventory(). It's slightly faster than foreach in $items[] =)
EDIT2 : after playing a little with this, I changed things a little so that the output is sorted by the meat/mp that you would get from feeding the considered items.
EDIT3: this is more of a threadjack than I originally intended... I'll try to PM bleary and start a new thread with this. Hopefully someone more relay-override savvy will turn this into a neat slimeling feeder page.
 

Attachments

  • Feed.ash
    5.8 KB · Views: 28
Last edited:

halfvoid

Member
i think zlib 19 just broke BBBS.

"if" requires a boolean conditional expression (BestBetweenBattle.ash, line 236)

Code:
236   foreach num,mob in get_monsters(my_location()) if (has_goal(mob)) return false;
 

halfvoid

Member
AND

Cannot apply operator && to ( item_amount() > 0 ) (boolean) and has_goal() (float) (BestBetweenBattle.ash, line 248)

Code:
   if (item_amount($item[shaking 4-d camera]) > 0 && has_goal(to_monster(get_property("cameraMonster"))))

Cannot apply operator && to ( item_amount() > 0 ) (boolean) and has_goal() (float) (BestBetweenBattle.ash, line 254)

Code:
if (item_amount($item[spooky putty monster]) > 0 && has_goal(to_monster(get_property("spookyPuttyMonster")))) {
 
Last edited:

heeheehee

Developer
Staff member
Yup. Update your version of BBB (I think the newest version is in this thread...)?

Edit: Also SmartStasis and FTF, unless you've done so already.
 

zarqon

Well-known member
I would like to note that I also use my own scripts every day, on the latest daily build of mafia. I release the same versions that I use. They may have/develop problems since both KoL and mafia are always changing, but they will run.

If they don't run for you, chances are very high that you need to update something. Treat errors, such as the one above that prevents the script from even reaching the version-checking stage, as "new version" indicators.
 

halfvoid

Member
I do usually, just saw the zlib update while i was playing, updated, then never saw an update for any of the other ones before i got the error. hence i posted the errors here.
 

natnit

Member
First of all, thanks very much for the script! It's definitely been a pleasure to to use.

Anyhow, I'm having some problems understanding the TT features of this script (I'm in TT aftercore grabbing the fuzzies trophy):

1) Looking through the code, I can't make out how it decides between using the syncopated and grinning familiars. As I'm farming nickels, syncopated is the way to go, so how can I force that?

2) The wiki explains that the turtle will appear with 3 to 10 turns of effect remaining (pre nemesis) and with 1 to 3 turns remaining (with the garter). It doesn't seem BBB takes this into account. That's quite a few additional hounddog turns (and +item is everything), so even though it is some dirty optimization, it would be nice. :)

Oh, I can also corroborate the values for the garter given. Thanks!
 

zarqon

Well-known member
The present logic is that it assumes you want stats if you're still ascending, otherwise it goes with +items -- if you have both familiars. If you only have one, it will go with that one. If you are no longer under Ronin/HC restrictions, the script defaults to the grinning.... eh?

Ok, I just looked at the script, and it looks like it actually does the opposite of what I intended. Change this:

Code:
      tfams[to_int(!can_interact())] = $familiar[grinning turtle];
      tfams[to_int(can_interact())] = $familiar[syncopated turtle];

to this:

Code:
      tfams[to_int(can_interact())] = $familiar[grinning turtle];
      tfams[to_int(!can_interact())] = $familiar[syncopated turtle];

Yeah, just move that exclamation point down a line. I'll fix that in the next update, along with accounting for appearance ranges. I don't think that bit about turtle appearance ranges was in the Wiki when I added auto-taming to BBB, but that knowledge does make things a little easier to optimize. I don't know that I'll have anything for you before you get your trophy, but it shouldn't be too long a wait. Thanks for bringing this to my attention.
 
Top