autoBasement.ash - Better basement automation

slyz

Developer
You could use retrieve_item() to make sure at least one is present in your inventory before consuming.
 

slyz

Developer
Code:
> ash print(retrieve_item(1,$item[hand turkey outline]));

You need 1 more hand turkey outline to continue.
false
Returned: void

With a MMJ in inventory:

Code:
> ash print(retrieve_item(1,$item[magical mystery juice]));

true
Returned: void

Closeting the MMJ:

Code:
Placing items into closet...
Requests complete.

> ash print(retrieve_item(1,$item[magical mystery juice]));

Removing items from closet...
true
Returned: void

Using the MMJ and retrieving:

Code:
Using 1 magical mystery juice...
You gain 21 Mojo Points
Finished using 1 magical mystery juice.

> ash print(retrieve_item(1,$item[magical mystery juice]));

Purchasing magical mystery juice (1 @ 100)...
You acquire an item: magical mystery juice
You spent 100 Meat
Purchases complete.
true
Returned: void

I guess the return value can be trusted.
 

Bale

Minion
Does retrieve_item() return true (as assumed) if you are successful in retrieving the item?

Yes, it will. It will also return true if you fail to retrieve an item. It will only return false on an error state, like being forbidden to purchase by price limits.

Don't trust the return value. I've been burned by these in the past and it is very hard to debug if it turns out to cause a problem.
 
Last edited:

slyz

Developer
Just out of curiosity, what item can I test that on? When would mafia fail to get an item without the error state?
 

Bale

Minion
I'm testing it under a few more circumstances, but I'm not finding a false positive. Perhaps this function's return value can be trusted after all... I've just had some bad experiences, so I'm hesitant.
 

tgetgel

Member
I am running into an error during initialization. (Seal Clubber)
Code:
Putting on Gauntlet...
Equipment changed.
Maximizing...
112 combinations checked, best score 2879.0
Saving outfit Gauntlet...
Outfit saved
Putting on MPDrain...
Equipment changed.
moxie magnet
Travoltan trousers
Maximizing...
128 combinations checked, best score 1361.0
Putting on beer helmet...
Equipment changed.
Wielding tambourine...
Equipment changed.
Taking off tambourine...
Equipment changed.
Holding tambourine...
Why bother putting a weapon into your offhand if you don't have anything in your on-hand? "On-hand?" Whatever.
Then the script aborts. As you see, it puts on the gauntlet, maximizes, and saves. For MPDrain, it puts it on, but never saves it. Any thoughts?

Edit:base stats:1262/772/778
It would seem this code also is not returning the first time through the code:
Code:
void cache_outfits()
{
	if (outfits_cached) || (my_basestat($stat[Mysticality]) < 200 || my_basestat($stat[Muscle]) < 200 || my_basestat($stat[Moxie]) < 200))
	{
		return;
	}
 
Last edited:

antimarty

Member
I'd love to get this script working (telescope has been done a while, but I still get a sandwich of the gods most ascensions to burn turns) - but it fails during the outfit maximization:

Code:
Saving outfit MP Regen...
Outfit saved
Unrecognized keyword: none

I see some code there using a "none" keyword:
Code:
	cli_execute("outfit save MP Regen");
	familiarCache["MP Regen"].f = my_familiar();
	familiarCache["MP Regen"].i = familiar_equipped_equipment(my_familiar());

	command = "maximize " + combat_stat.to_string();
	foreach i in combat_equipment
	{
		item equipment = combat_equipment[i].to_item();
		if (equipment != $item[none] && available_amount(equipment) > 0 )
		{
			command = command + ", +equip " + equipment.to_string();
		}
	}

Is there some obvious reason this should be failing for me? I'm using a recent mafia build r7978 and zlib is up to date. I didn't edit anything in the script.
 

tgetgel

Member
Code:
Saving outfit MP Regen...
Outfit saved
Unrecognized keyword: none

There was a typo in the naming of the MP Regen and MPRegen between when it was saved and equipped. It was fixed in the latest version of this script with MPRegen changed to MP Regen.
 
Last edited:

antimarty

Member
I'd love to get this script working (telescope has been done a while, but I still get a sandwich of the gods most ascensions to burn turns) - but it fails during the outfit maximization:

Code:
Saving outfit MP Regen...
Outfit saved
Unrecognized keyword: none

It turns out that this was caused by me having earlier broken the rule
Code:
You cannot modify a setting by changing the value in script

I had gone back to the unedited script, but it had cached a bad variable value in the file vars_antimarty.txt - I had to edit that file to get rid of the bad value.
 

zarqon

Well-known member
@antimarty: this is a feature of ZLib settings, actually -- the place in the script where it says setvar() merely specifies a default starting value if the setting doesn't already exist. You can type "zlib vars" in the CLI to see the current values of all of your ZLib settings, or "zlib settingname = value" to change the value of an existing setting. Directly editing the text file also works, but is unnecessary. FYI.

@mredge, Bale, et. al.: If it helps, I have been relying upon the return value of retrieve_item() without problems since I started scripting. Of course, at the beginning I relied on all ASH functions to return what I thought they should. In time, quite a few other functions disabused me of that notion, but retrieve_item() has thus far always returned a value that makes sense -- if you got the item(s), it's true; otherwise, false.
 

Veracity

Developer
Staff member
If there are specific ASH functions that don't consistently return a useful value, how about if you pin bug reports on them? One function per bug report, please. Thanks.
 

zarqon

Well-known member
Off the top of my head, the big ones are create() and use(). Also hermit() but that's not as commonly used. I'll submit reports after I work up some tests that clearly show the problems.

EDIT: I didn't mean by that to "claim" those reports. If anyone wants to beat me to it, feel free!
 
Last edited:

tgetgel

Member
Great script. Filtering observation:

Throwin' Down the Gauntlet adventure with a SC.

The script stopped with the message "unable to buff hp to 21864, quitting" (level 454). I opened the relay browser and one of the options was to use styx muscle. Unfortunately this is only available in Bad Moon which I am not in. If it is not too hard, can that be filtered from the list, grayed out, or is that a mafia issue?
 

Kamekichi

New member
I updated to the latest versions of autobasement, zlib and kolmafia. When I try to start autobasement I get this:

Function 'load_current_map( string, _item_data [string] )' defined multiple times (autoBasement.ash, line 125)
 
All scripts that use auto-updating of data files through Zarqon's Map Manager will need to be updated to work with the new zlib. I'm sure Rinn will fix it soon!

In the meantime, your best bet is to stick with the older ZLib 12.
 

zarqon

Well-known member
Sorry all, I broke this with a very worthwhile update to ZLib. The fix (which Rinn will do himself when he has time) is to DELETE the load_current_map() function entirely from this script. Do that yourself and then you can still use the latest ZLib.
 

Grotfang

Developer
Running this for the very first time. Haven't done ANY basement levels this run:

Code:
> call scripts\autoBasement.ash

Initializing items and effects...
Items and effects initialization complete!
Caching outfits...
Maximizing (1st time may take a while)...
512 combinations checked, best score 845.0
Putting on Hodgman's porkpie hat...
Equipment changed.
Wielding Maxwell's Silver Hammer...
Equipment changed.
Holding Hodgman's imaginary hamster...
Equipment changed.
Putting on letterman's jacket...
Equipment changed.
Putting on Hodgman's lobsterskin pants...
Equipment changed.
Putting on navel ring of navel gazing...
Equipment changed.
Putting on Hodgman's bow tie...
Equipment changed.
Putting on hardened slime belt...
Equipment changed.
Putting on Maxwell's Silver Hammer...
Equipment changed.
Saving outfit Mysticality...
Outfit saved
Maximizing...
160 combinations checked, best score 954.0
Putting on plexiglass pith helmet...
Equipment changed.
Wielding lawn dart...
Equipment changed.
Putting on V for Vivala mask...
Equipment changed.
Putting on Hodgman's bow tie...
You may only equip one of those at a time.

Huh?

Try again:

Code:
> call scripts\autoBasement.ash

Initializing items and effects...
Items and effects initialization complete!
Caching outfits...
Putting on Mysticality...
Equipment changed.
Maximizing...
96 combinations checked, best score 880.0
Putting on plexiglass pocketwatch...
Equipment changed.
Putting on navel ring of navel gazing...
You may only equip one of those at a time.

Once more for luck:

Code:
> call scripts\autoBasement.ash

Initializing items and effects...
Items and effects initialization complete!
Caching outfits...
Putting on Mysticality...
Equipment changed.
Maximizing...
96 combinations checked, best score 880.0
Putting on plexiglass pocketwatch...
Equipment changed.
Putting on navel ring of navel gazing...
You may only equip one of those at a time.

I now have this every single time I run the script.
 
Top