Best Between Battle Script Ever -- formerly AutoMCD

kainstake

New member
confirmed on 7955, running on linux w/java:
IcedTea6 1.6.1
from debian sid.

gcli gives:

Unable to invoke bestbetweenbattle.ash.
Autorecovery failed.

Invoking script manually appears to work, however I haven't tested extensively that way.
 

zarqon

Well-known member
If you're running mafia in 'nix, calling scripts is case-sensitive; so be sure that you type the filename exactly as you saved it. Unless you renamed it, that means all the B's are capital, like so: "BestBetweenBattle"
 

kainstake

New member
If you're running mafia in 'nix, calling scripts is case-sensitive; so be sure that you type the filename exactly as you saved it. Unless you renamed it, that means all the B's are capital, like so: "BestBetweenBattle"

Confirmed that case was matching what was actually in the filesystem. Something in mafia is coalescing the name of the script to lowercase.

Specifically, it looks like the call to CLI-execute the script coaleses the input to lowercase.

Bug reported, patch attached to bug.
http://kolmafia.us/project.php?issueid=1003
 
Last edited:

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Would this script be the appropriate place to auto-use things like Old Coin Purse? (items that do nothing but give meat).

If so, implement! (with option to disable of course)

Awesome script though

Gausie
 

kainstake

New member
Would this script be the appropriate place to auto-use things like Old Coin Purse? (items that do nothing but give meat).

If so, implement! (with option to disable of course)

Awesome script though

Gausie

Well, depends. By the time I'm where coin purses / wallets can drop for me, meat for buffs/recovery usually isn't an issue, so I just collect them, or munch them at ascension time. Your best bet is probably to add them to the cleanup filter, where I believe (correct me if I'm wrong on this) Kolmafia will auto-consume them when you trigger a cleanup.

If your recovery and other meat-using scripts trigger an abort properly when you're out of meat, then this isn't really an issue, and if it isn't directly related to a zone goal, you probably don't want to auto-consume items.

For a practical example of this perhaps not being wise, observe when briefcases were hot during 2008 Crimbo. ;)
 
I'm having trouble with BBB's turtle taming functionality. It has to do with the turtle condition BBB sets and the way my script is using the adventure() command. My script is adventuring in the Thugnderdome one adventure at a time like so (very simplified version):

Code:
while(this)
   adventure(1,$location[Thugnderdome]);
With a condition set from BBB my script adventures once at the Thugnderdome and then Mafia sees that the condition was not satisfied and stops my script.

Code:
Visit to MoxSign: Thugnderdome in progress...

[2430] Thugnderdome
Encounter: Gnomester Blomester
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: gnomester blomester takes 131 damage.
You gain 7 Strengthliness
You gain 1 Magicalness
You gain 3 Smarm

Visit to MoxSign: Thugnderdome in progress...

[2431] Thugnderdome
Encounter: gnarly gnome
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: gnarly gnome takes 131 damage.
You gain 6 Strengthliness
You gain 3 Enchantedness
You gain 3 Roguishness

Visit to MoxSign: Thugnderdome in progress...

[2432] Thugnderdome
Encounter: vicious gnauga
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: Grog sucks some blood out of your opponent and injects it into you.
Round 1: vicious gnauga takes 134 damage.
You gain 7 hit points
You gain 4 Beefiness
You gain 5 Enchantedness
You gain 5 Roguishness

Visit to MoxSign: Thugnderdome in progress...

[2433] Thugnderdome
Encounter: gnasty gnome
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: Grog sucks some blood out of your opponent and injects it into you.
Round 1: gnasty gnome takes 149 damage.
You gain 6 hit points
You gain 9 Muscleboundness
You gain 2 Sarcasm

Visit to MoxSign: Thugnderdome in progress...

[2434] Thugnderdome
Encounter: Gnomester Blomester
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: gnomester blomester takes 129 damage.
You gain 5 Fortitude
You gain 3 Wizardliness
You gain 3 Sarcasm

Preparing to tame a turtlemail bits...
Internal checkpoint created.
temp => turtlemail bits|Mosquito
Holding turtling rod...
Equipment changed.
Purchasing turtle pheromones (1 @ 50)...
You acquire an item: turtle pheromones
You spent 50 Meat
Purchases complete.
Using 1 turtle pheromones...
You acquire an effect: Eau de Tortue (duration: 10 Adventures)
Finished using 1 turtle pheromones.
Condition added: turtlemail bits
turtlemail bits

Visit to MoxSign: Thugnderdome in progress...

[2435] Thugnderdome
Encounter: gnu jack gnome
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: gnu jack gnome takes 125 damage.
You gain 6 Strongness
You gain 5 Wizardliness

[COLOR=Red]Conditions not satisfied after 1 adventure.[/COLOR]
Holding misfit dolly...
Equipment changed.

Visit to MoxSign: Thugnderdome in progress...

[2436] Thugnderdome
Encounter: gnefarious gnome
Round 0: Luxovius the Great wins initiative!
Round 1: Luxovius the Great attacks!
Round 1: Grog sucks some blood out of your opponent and injects it into you.
Round 1: gnefarious gnome takes 129 damage.
You gain 3 hit points
You gain 6 Muscleboundness
You gain 3 Magicalness
You gain 2 Chutzpah
[COLOR=Red]
Conditions not satisfied after 1 adventure.[/COLOR]
I realize I could just turn the taming functionality off, but I really don't mind it as long as it doesn't stop the script. I could rework the entire while loop I'm using, but I'd rather not (it is more complicated then what I posted above). Does anyone have an idea on how I can leave BBB's taming on and have it not stop the execution of my script or should I just turn off the taming functionality?
 

zarqon

Well-known member
@gausie: That's kind of what I did by making it autosell meat stacks. The key difference here is that selling meat stacks is reversible, but using container items is not. And since meat is not an item, I can't make using meat containers goal-sensitive. I'll think about adding a switchable option, but it's not high on my list.

This does bring up an intriguing idea:

A "meat recovery" script, which attempts to keep your available meat above a specified threshold (which would perhaps be a function of your level). It would work exactly like a recovery script but fire every time your meat drops below a certain point. The script would maintain liquid meat by 1) taking available meat from other accessible locations, 2) (creating and) using meat-containing items, and finally 3) autoselling expendable inventory.

Interesting.

@Ninj: seems like there must be a better method for detecting when you've gotten your turtle than adding the zone's available turtle to your goals, but I haven't thought of it yet. Simply tracking inventory would be iffy.

In the meantime, capture the return value of adventure() if possible. Even an empty block would work, i.e. if (adventure(1,loc)) {}
 
@Ninj: seems like there must be a better method for detecting when you've gotten your turtle than adding the zone's available turtle to your goals, but I haven't thought of it yet. Simply tracking inventory would be iffy.

In the meantime, capture the return value of adventure() if possible. Even an empty block would work, i.e. if (adventure(1,loc)) {}

I'll give that a try. Thanks.

This does bring up an intriguing idea:

A "meat recovery" script, which attempts to keep your available meat above a specified threshold (which would perhaps be a function of your level). It would work exactly like a recovery script but fire every time your meat drops below a certain point. The script would maintain liquid meat by 1) taking available meat from other accessible locations, 2) (creating and) using meat-containing items, and finally 3) autoselling expendable inventory.

I have a meat_check.ash that I having been using with my personal ascension suite that is similar to this. Right now it's being called as an unconditional trigger. It's in it's rudimentary stages right now so the amount of meat to keep on hand could definitely be calculated better but for now it looks like this:

Code:
import <auto_quest.ash>

int safemeat;
if(my_level() > 10)
    safemeat = 750;
else if(my_level() > 5)
    safemeat = 500;
else if(my_level() <= 5)
    safemeat = 100;
    
if(my_meat() < safemeat)
    farm(safemeat,"to ensure enough meat is on hand for restoratives");
The farm function first tries to use meat-containing items, then tries to get meat from storage if possible, then it proceeds to farm for meat in the location it can get the most meat from that is currently unlocked. It doesn't autosell anything however.

The only problem with setting it as an unconditional trigger is it doesn't seem to fire when adventuring inside of a while loop. I'm not completely clear on when an unconditional trigger actually triggers?
 

Bale

Minion
I just around to checking out the current version of BBB.

zarqon, I hadn't looked at this in a while. It seems that you've added in everything my personal version did better. That was part of my reason for sharing it, so I feel awesome! (Mana burning is irrelevant now that veracity fixed up mafia's summoning for burning.) You also added in some other wonderful things I hadn't thought of. I still made a personal version to use as a mood just because I like to personalize all scripts I use, but it is virtually identical to your own now. Wonderful!

PS. Was friendlyset() inspired by similar code in newLife, or is this just a case of great minds thinking alike?
 
Last edited:

zarqon

Well-known member
Hmmm, I could have sworn I already posted a response to this. I remember writing it. Argh. Try again, shorter this time.

Bale, thanks for the kind words. If you think of any other improvements to make, don't hesitate to suggest them. (I say that knowing that probably only a natural disaster could prevent you from sharing any improvements you may devise.)

About friendlyset(): I do remember that being an odd moment. I had just added that in, maybe a day or two before checking out newLife, and saw that you had a very similar thing going. Great minds.
 

Tarko

Member
Could I suggest something?

When you change the NC for the script to get 2 of whatever items; couldnt you 'disable' the boss fight until you actually those 2 items?

That would be awesome!
 

SoItBegins2

New member
It seems the new version of ZLib (14) breaks BestBetweenBattle-- at least on my copy of Mafia. Here's the error message I get:

Function 'load_current_map( string, turtle_rec [location] )' defined multiple times (bestbetweenbattle.ash, line 289)

I'm running v13.8, no revision. Help?
 

halfvoid

Member
Does BBBS support autouse of libram skills between battles?

edit:
nevermind, i just wrote a quick script with the cli command.
 
Last edited:

zarqon

Well-known member
Actually, mafia handles librams skills as part of its mana burning. If you want it to be more specific in which libram skills it uses, a script/command would be useful, otherwise just adjust your MP burning settings (and make sure you have the right stuff checked in preferences).
 

halfvoid

Member
Oh. didn't even know that. Well i wrote the script anyway, might as well use it. Its got a special function for sending of a bricko bat to a notable charity.
 

zarqon

Well-known member
I'm sure the charity will be ridiculously excited about that. If the charity is deserving, you may want to share that function so others could use it as well. ;)
 

halfvoid

Member
there's it in its entirety. i titled it fireandforget.ash but its not a fitting title as i still have to maximize before, overstuff my familiar, autosell and feed candy. but strangely, i like doing all that manually sometimes.

Code:
import <EatDrink.ash>;

void main()
{
eatdrink(fullness_limit(), inebriety_limit(), spleen_limit(), false, false);
while (adv > 0)
{
cli_execute("cast * Summon brickos");
adventure (1, $location["Giant's Castle"]);
}
eatdrink(fullness_limit(), inebriety_limit(), spleen_limit(), true, false);
cli_execute("use 5 bricko brick");
cli_execute("csend 1 bricko bat to zarqon");
}

but i believe the last cli_execute is what you wanted to see.
 

Veracity

Developer
Staff member
cli_execute("use 5 bricko brick");
Is there some reason you do it this way rather than, say, "create( 1, $item[BRICKO bat] )"?

I've never understood why people like to do a "cli_execute" of a CLI command from ASH when there is a built-in ASH function which does exactly the same thing.
 
Top