autoBasement.ash - Better basement automation

bumcheekcity

Active member
Maybe it could be a good idea to block those mer-kin potions that give 200% to one stat, but -100% to the others? I think that's been the cause of some premature script abortion.

Also keeps trying to equip my sandworm with disembodied hand stuff. Let me know if you want it run at higher verbosity.


Code:
[1175] Fernswarthy's Basement (Level 74)
Buffed Muscle Test: 253 current, 449 needed
Muscle Test passed
Basement level 75: Stat reward
Maximizing...
14144 combinations checked, best score 111.00
Putting on warbear plain ushanka...
Equipment changed.
Wielding Unkillable Skeleton's restless leg...
Equipment changed.
Putting on Misty Robe...
Equipment changed.
Putting on sea salt scrubs...
Equipment changed.
Putting on warbear long johns...
Equipment changed.
Putting on fudgecycle...
Equipment changed.
Putting on streetfighting champion's belt...
Equipment changed.
Putting Gofflesby the Exotic Parrot back into terrarium...
Taking Gron the Disembodied Hand out of terrarium...
Putting on Uncle Hobo's highest bough...
Equipment changed.

[1176] Fernswarthy's Basement (Level 75)
Encounter: Save the Dolls/Save the Cardboard
You gain 178 Enchantedness
You gain a Mysticality point!
Stat gain received
Basement level 76: Monster
Maximizing...
107176 combinations checked, best score 506.00
216428 combinations checked, best score 506.00
326819 combinations checked, best score 506.00
416920 combinations checked, best score 506.00
Putting on Brimstone Beret...
Equipment changed.
Wielding scratch 'n' sniff sword...
Equipment changed.
Holding Brand of Violence...
Equipment changed.
Putting on Cloak of Dire Shadows...
Equipment changed.
Putting on astral shirt...
Equipment changed.
Putting on Brimstone Boxers...
Equipment changed.
Putting on plexiglass pendant...
Equipment changed.
Putting on tube sock...
Equipment changed.
Putting Gron the Disembodied Hand back into terrarium...
Taking Trort the Baby Sandworm out of terrarium...
Restoring HP! Currently at 278 of 491 HP, 220 of 524 MP, current meat: 297995529 ... Target HP = 491.
Casting Cannelloni Cocoon 1 times...
You gain 213 hit points
Cannelloni Cocoon was successfully cast.
Restoring MP! Currently at 491 of 491 HP, 200 of 524 MP, current meat: 297995529 ... Target MP = 250.
Searching for "carbonated water lily"...
Search complete.
Purchasing carbonated water lily (1 @ 170)...
Purchases complete.
Using 1 carbonated water lily...
You gain 65 Muscularity Points
Finished using 1 carbonated water lily.

[1177] Fernswarthy's Basement (Level 76)
Encounter: 96 Bottles of Beer on a Golem
Round 0: bumcheekcity wins initiative!
1 HP costs 0.209μ. ( 451 / 491 )
1 MP costs 2.615μ. ( 265 / 524 )
ATT: 864 (94% × 93.57, death in 6)
DEF: 864 (19% × 52.58 (3) (3) (3) (3) (3), win in 50)
HP: 735, Value: 2,478.01 μ, RES: 0
WHAM: You have no profitable MP restoratives.
WHAM: You have no profitable HP restoratives.
WHAM: Monster HP is 735.0.
WHAM: Starting evaluation and performing of attack
Auto-funk: merging 'use 6472' and 'use 5290'.
WHAM: Enqueuing a stun to help with the battle
WHAM: Enqueueing Harpoon! (macroid skill 1023).
WHAM: Enqueueing Brand (macroid skill 7152).
WHAM: Enqueueing Drunkula's bell (macroid use 6472).
WHAM: Enqueueing d20 (macroid use 5290).
Auto-funk: merging 'use 6472' and 'use 5290'.
WHAM: Enqueueing Harpoon! (macroid skill 1023).
WHAM: Enqueueing Harpoon! (macroid skill 1023).
WHAM: We are going to 7-shot with Rain-Doh blue balls, Harpoon!, Brand, Drunkula's bell, d20, Harpoon! and Harpoon!.
Round 1: bumcheekcity executes a macro!
Round 1: bumcheekcity uses the Rain-Doh blue balls!
Round 2: x bottles of beer on a golem takes 14 damage.
Round 2: bumcheekcity casts HARPOON!!
Round 3: x bottles of beer on a golem takes 117 damage.
Round 3: bumcheekcity casts BRAND!
Round 4: x bottles of beer on a golem takes 93 damage.
You lose 86 hit points
Round 4: bumcheekcity uses the Drunkula's bell and uses the d20!
Round 5: x bottles of beer on a golem takes 38 damage.
You lose 38 hit points
Round 5: x bottles of beer on a golem takes 238 damage.
You lose 89 hit points
Round 5: bumcheekcity casts HARPOON!!
Round 6: x bottles of beer on a golem takes 127 damage.
You lose 91 hit points
Round 6: bumcheekcity casts HARPOON!!
Round 7: x bottles of beer on a golem takes 127 damage.
Round 7: bumcheekcity wins the fight!
After Battle: Trort smiles a three-lipped smile from beneath the shade of his little sombrero.
You gain 119 Strongness
You can now equip a 'WILL WORK FOR BOOZE' sign (and possibly other things).
You gain a Muscle point!
You gain 64 Magicalness
You gain 61 Cheek
You gain a Moxie point!
Monster defeated
Basement level 77: Mysticality Test
Maximizing...
108209 combinations checked, best score 509.00
218633 combinations checked, best score 509.00
256176 combinations checked, best score 509.00
Putting on Helm of the Scream Emperor...
Equipment changed.
Holding Cold Stone of Hatred...
Equipment changed.
Putting on sugar shorts...
Equipment changed.
Putting on Brimstone Bracelet...
Equipment changed.
Putting on Brimstone Brooch...
Equipment changed.
Putting on plexiglass pinky ring...
Equipment changed.

[1178] Fernswarthy's Basement (Level 77)
Buffed Mysticality Test: 255 current, 474 needed
Mysticality Test passed
Basement level 78: Muscle Test
Maximizing...
58255 combinations checked, best score 232.00
Searching for "oil of expertise"...
Search complete.
Putting on plexiglass pith helmet...
Equipment changed.
Holding Brimstone Bunker...
Equipment changed.
Putting on ornamental sextant...
Equipment changed.
Putting on plastic vampire fangs...
Equipment changed.
Putting on headhunter necktie...
Equipment changed.
Updating inventory...
Retrieving equipment...

Hat: plexiglass pith helmet
Weapon: scratch 'n' sniff sword
Off-hand: Brimstone Bunker
Shirt: astral shirt
Pants: sugar shorts
Container: Cloak of Dire Shadows

Acc. 1: ornamental sextant
Acc. 2: plastic vampire fangs
Acc. 3: headhunter necktie (4)

Pet: Baby Sandworm (27 lbs)
Item: (none)

Sticker 1: scratch 'n' sniff wrestler sticker (3)
Sticker 2: scratch 'n' sniff wrestler sticker (3)
Sticker 3: scratch 'n' sniff wrestler sticker (3)
Your Baby Sandworm can't wear a Brimstone Bludgeon
unable to buff Muscle to 482, quitting
Basement sucessfully automated for 11 out of 40 adventures. If the script failed due to being unable to buff you high enough you can either try to level up some or raise "autoBasement_max_potion_price" to a higher value.
Restoring HP! Currently at 175 of 337 HP, 187 of 655 MP, current meat: 297995359 ... Target HP = 321.
Casting Cannelloni Cocoon 1 times...
You gain 162 hit points
Cannelloni Cocoon was successfully cast.

[1179] Fernswarthy's Basement (Level 78)
Buffed Muscle Test: 144 current, 483 needed
 

Bale

Minion
Maybe it could be a good idea to block those mer-kin potions that give 200% to one stat, but -100% to the others?

Better than blocking those really cheap, powerful buffs would be code to uneffect them when the off stat is needed. SGEEAs are cheap.
 

Winterbay

Active member
autoBasement follows the maximizer which, as far as I'm aware, already suggests uneffecting those effects when maximizing for something it is detrimental to. Granted this will only happen when the iteration reaches that point and if that uneffect-command is far down it could be problematic but the few times I've seen it, it has been among the top 5 suggestions.
 

fronobulax

Developer
Staff member
autoBasement follows the maximizer which, as far as I'm aware, already suggests uneffecting those effects when maximizing for something it is detrimental to. Granted this will only happen when the iteration reaches that point and if that uneffect-command is far down it could be problematic but the few times I've seen it, it has been among the top 5 suggestions.

I've never seen autoBasement uneffect the merkin potions and have had it abort numerous times because it couldn't reach a goal. Use SEGA and re-run and autoBasement is happy. I've also seen autoBasement fail to uneffect an elemental form when the form was detrimental to the current test.

I tend to run with a high value for potion purchases but perhaps there is a setting that differs and has an unexpected (to me?) side effect?
 
There seems to be some issue with the potion-purchasing code [...]
And is the script allowed to buy from the mall? (just checking)
This solved that problem. (Specifically, I had to enable buying from the Mall in Mafia's preferences.) Thanks for your (collective) patience, and sorry for being so thick!

That said, I have a new problem to report: The script is unable to pass elemental tests, and it could do, if it would just equip my Parrot.

1. I get unable to pass elemental test, quitting. The script has no familiar equipped.
2. I equip outfit "Elemental Resistance" (the one defined by the script), equip my Parrot, and heal.
3. I pass the elemental test manually, with no other buffing required.

Don't know if this is related to what I gather is a history of familiar problems, but I figured it was worth reporting.

Thanks again for all your work on this script! It sure is handy, even if I have to do a manual workaround now and then.
 

Qualidus

New member
I've been looking into some of the problems of overbuffing and have found a few interesting culprits.

For some problems with elemental resistance tests, a "whatif quiet" needs to be performed after equipping the Elemental Resistance outfits.

This is because elemental_damage uses speculated resists to calculate the damage taken which isn't being updated after switching to the outfit.

A similar whatif quiet may need to be performed after switching to the exotic parrot. I don't have one so can't test this condition.

This should address the issue seen by PaladinWhite.

Another thing I've seen the script do is insanely overbuff HP to pass an elemental test. For example, I'm predicted to take 2000 damage from the test yet the script uses philter of phorce, trivial avocations, tomato juice of powerful power, the 100% and 200% slime potions, etc. buffing me to almost 7000 hp.

This seems to be due to differences between using speculative Max HP and current Max HP.

I was able to narrow this down to between steps 5 and 6 where chained whatifs are performed trying a bunch of different effects to get HP high enough. However, the test to break the loop uses my_maxhp() which isn't going up since everything is being simulated in whatif. Ultimately the entire chain gets executed in the end although I'm not sure where this occurs resulting in a massive overbuff.

A nice-to-have would be the option to disable the increasing of combat stat after switching to the combat outfit. I currently use a Mesmereyes and stuns/1-shots to kill monsters so don't need to worry about surviving the hits. The stat increaser causes this to swap pieces in my combat outfit which might actually lead to my demise. Currently I've just commented out this part in the code.

Also, I'm not sure if there's a better way of handling maximizer costs of 0. These are mostly things like x/day buffs like Hatter, Telescope, Ball Pit, etc. Ideally I wouldn't want these used until all other possibilities had been exhausted and perhaps even have the ability to toggle these limited-time buffs.

They seem to be associated with maximizer entries that have item = $item[none] and skill = $skill[none].

These does seem to be at least one exception to this which is the trivia master buff that uses up 3 trivia cards and has no associated item or skill.

Lastly, a quirk I seem to be encountering is that for some reason Mafia wants to dual-wield the scratch 'n' sniff sword. The maximizer will suggest removing the the scratch 'n' sniff in my mainhand and equipping it in my offhand which fails since I can't dualwield without a mainhand.

I can't seem to reproduce this normally, ie wear outfit, and try the same maximizer command so I'm wondering if Mafia's state is getting messed up somewhere.

One idea for more optimal solutions would be to continually call the maximizer after executing each maximizer option. For example, I need 1500 of a stat, and the first maximizer option gives me +1000. It'd be more efficient to use a 500 stat booster rather than the next option (which is likely +1000). However, this would also result in lots of extra calls to the maximizer that I'm not entirely sure would be worth it.

I think what I'm wondering is if the script could use the maximizer in a fashion similar to solving a weighted knapsack problem, although I'd be wary of the execution time for this.

Thanks for maintaining this script!
 

Theraze

Active member
Regarding the dual wielding quirk, do you have two swords available in any way - for example one in the closet, or one in your clan stash and automatically taking items from the stash enabled? If so, then that is a well known 'issue' that happens with the way that the maximizer equips items - that would be, one at a time.
 

Qualidus

New member
The scratch 'n' sniff sword is a non-tradeable quest item so I don't think it's possible to tuck one away even if I wanted to try to dual-wield it. The closest form to available would be I do have other stickers in the inventory that could be perceived as being able to create a second one except the stickers only make a new item if one doesn't already exist. I'll see if I can capture better information when this resurfaces.
 

Theraze

Active member
It's possible that, since you get a sword/crossbow by using a sticker if you don't have one yet, that mafia believes it can acquire multiple by using another sticker... that would be a mafia bug if you could actually replicate it. As you deduced. :)

Note that since the maximizer does save its last few maximization strings, you can try to replicate whatever autoBasement did that caused it to believe that multiple SnS weapons were available. If you can actually sort it out, great! If not... well, it's one of those things. :(
 

martapp

New member
I'm on the last build with all the scripts re-updated, and I hit level 26 again so I thought I'd retry diving.
I hit the issue with dual wielding my scratch and sniff sword (same as I reported a while back), so if there is anything I can do to help diagnose the problem, let me know.
 

Winterbay

Active member
I'm on the last build with all the scripts re-updated, and I hit level 26 again so I thought I'd retry diving.
I hit the issue with dual wielding my scratch and sniff sword (same as I reported a while back), so if there is anything I can do to help diagnose the problem, let me know.

That's a shame. I thought that bug had been fixed. Obviously there's another bug here. Maybe I should dive into the basement myself again to see what I can fins out.
 

fronobulax

Developer
Staff member
I should get into the basement in a couple days and I'll watch too. I presume we believe the problem exists because the inventory count for the S&SS gets out of synch?
 

Winterbay

Active member
I would assume so. I see no way the script should be able to generate 2 aricker weapons with the code as written.
I guess as a stopgap measure the script could trigger a complete refresh if it detects more than one sticker weapon in the maximizer commands.
 

Terrabull

Member
The script still tries to buy a phial instead of buffing my elemental resistance, and then HP to reasonable levels.
It can't seem to realize that a single philter of phorce is less expensive than a phial.
Even before the price increase, that amount of money would have been a big waste.
 
Last edited:

heeheehee

Developer
Staff member
Psst. I recently added "reasonably-priced" phials to my saucepotion bot restocking script. If anyone accidentally buys phials (will probably end up being from me) and wants a refund, lemme know.
 

Qualidus

New member
As far as I can tell the script will always try to acquire a phial if enough of the following steps occur [steps correspond to autoBasement prints]:
1) Check if your max hp is sufficient to defeat the test [step 1]
2) After wearing your elemental resist outfit, check if your HP is enough to pass the test (bugged due to missing whatif quiet) [step 2 and step 3]
3) Uneffecting any other element forms if applicable (may also be bugged due to missing whatif quiet) [step 4]
4) Generating a list of maximization options specifically for the type of elements in the test and balancing with HP [step 5]
5) Start considering options one by one until the test is passed (bugged due to using actual HP instead of speculative HP), then execute the result [step 6 is the one that executes if it passes]
6) Last possibility of maximization is to use a phial if the price is acceptable (limited by autoBuyPriceLimit) [last else case of step 6]
7) If acquired a phial, generate maximization options for the remaining element (ignore phials) [step 7]
8) Similar to (5) consider options until the test passes (also uses my_maxhp() so may be bugged) [step 8]
9) If the test didn't pass, execute everything anyway and move on to HP maximization [else clause of step 8]
10) Print if unable to acquire a phial in step 7 and move on to HP maximization
11) Check if current max HP is sufficient to pass the test, if not maximize for HP [step 9]
12) Check if maximized HP is sufficient to pass the test (may be bugged due to missing whatif quiet where gear has changed for max hp but not in the speculation) [step 10]
13) If so, heal and continue, check if current HP is enough to pass the test, if so test passed!
14) Test failed

Due to some of the bugs mentioned, autoBasement tends to overbuff and keep trying different maximization strategies when it could already pass the test.

Also, autoBasement's goal isn't the cheapest possible basement dive but more to get you through it. Optimizing for cheapest presents some additional challenges, mostly reordering the maximization optimizations to identify the cheapest combination of buffs that passes the test. There's also the debate regarding purchase price limits on groups of items.

On the near latest Mafia build (r13750), I hit a double S&S sword error again. I figured out how to repdroduce at least one instance of it, updated the original bug report, and hope this aids the devs in figuring out how to squash it!

Edit: I think I found another bug in the way the script maximizes for stat tests and equalizing potions which causes potentially a lot of overbuffing and item consumption.

Since the script is using the maximizer score as part of maximizer_wrap, it can't effectively compound multiple effects together. The equalizing oils have an effect on all percent effects that increase the effect of each significantly.

Propose modifying maximize_wrap to perform the same type of whatif simulation that is done for the elemental tests and/or pass a numeric_modifier string that must exceed the goal instead of using the raw maximizer score.

Reproduction steps:
1) Call maximize_wrap for a stat with a high limit and ensure an equalizing oil will be used (make sure limits allow it).
2) Compare the score from the output of maximize_wrap with the actual buffed stat value.
3) Score will be significantly lower than actual stat (I wound up with stats of 7700 when I needed 6600 and it wanted to keep buffing except failed due to item acquisition).

I was able to simulate removing a tomato juice of powerful power and the 100% stat potion and still pass the test.
 
Last edited:

martapp

New member
I would assume so. I see no way the script should be able to generate 2 aricker weapons with the code as written.
I guess as a stopgap measure the script could trigger a complete refresh if it detects more than one sticker weapon in the maximizer commands.

I think it is fixed for me; I just finished a Pete run and switched to a TT; I'm only level 14 at the moment, but I was able to dive for 60-odd turns so far without any errors with the sword. It might just be that the sword is not optimal for my character at this level, but would be needed if I started at a higher level.
 

Terrabull

Member
I'm not asking for it to be cheapest. I put up with the extra cost and bugs and what not for the convenience of having it mostly done for me. But having it buff my stats up to the needed level and then putting on an elemental form more than doubles the cost. That removes some of the benefit of the convenience.
 

Winterbay

Active member
Test the newest version. Should hopefully only resort to phials as a last resort rather than the first option when maximization fails.
 

infarct

New member
Thanks for the script, bro!

I have 1 thing to report.

1) I just updates to the latest build and script and now I get the following error Expected ;, found ) (autoBasement.ash, line 684)

2) Also, previously, it wouldn't let me start because I'm already level 30. Is this still an issue and if so, how can I fix it?

Thanks again!

Infarct
 
Top