Universal Recovery Script

Theraze

Active member
I believe that mafia will always buy antidotes in groups if it happens automatically, because they're cheap and it saves server hits.
 

Bale

Minion
That's UR. Mafia only purchases antidotes one at a time in hardcore/ronin and purchases them in groups of 30 out of ronin/hardcore. Also mafia only purchases antidote if you are adventuring in a location with a poisonous monster.
 

Rinn

Developer
I'm not sure if this is a feature request or just a setting I'm unaware of. I've noticed when extremely low on meat, UR will still attempt to restore as much mp as possible using less optimal mp restoring methods. For example, I'm currently in a BM run and the best mp restorer I have access to is black cherry soda, however if I have less then 80 meat, UR will instead try to restore some mp with Doc Galaktik. I'd rather it abort out before using the the worse restorer if possible, since by that point it's typically going to fail restoring anyway.

Thoughts?

Here's the relevant output
Code:
Restoring HP! Currently at 104 of 339 HP, 14 of 104 MP, current meat: 280 ... Target HP = 306.
Restoring MP! Currently at 104 of 339 HP, 14 of 104 MP, current meat: 280 ... Target MP = 33.
Using 1 Knob Goblin seltzer...
You gain 11 Muscularity Points
Finished using 1 Knob Goblin seltzer.
Purchasing black cherry soda (1 @ 80)...
You acquire an item: black cherry soda
You spent 80 Meat
Purchases complete.
Using 1 black cherry soda...
You gain 9 Muscularity Points
Finished using 1 black cherry soda.
Casting Tongue of the Otter 1 times...
You gain 11 hit points
Tongue of the Otter was successfully cast.
Restoring MP! Currently at 115 of 339 HP, 27 of 104 MP, current meat: 200 ... Target MP = 84.
Purchasing black cherry soda (2 @ 80)...
You acquire black cherry soda (2)
You spent 160 Meat
Purchases complete.
Using 2 black cherry soda...
You gain 19 Muscularity Points
Finished using 2 black cherry soda.
Visiting Doc Galaktik...

Restore 2 MP at Doc Galaktik's
You gain 2 Muscularity Points
You spent 34 Meat
Cure purchased.
Insufficient meat to fully restore MP without wasting restoratives!
Restoring MP! Currently at 115 of 339 HP, 48 of 104 MP, current meat: 6 ... Target MP = 84.
Insufficient meat to fully restore MP without wasting restoratives!
Recovery target reduced to healing trigger (169)to conserve meat.
Insufficient meat to fully restore HP without wasting restoratives!
Did not fully restore HP for some reason.
 

Bale

Minion
I'm also not really sure if it is a bug or a feature request.

Thought: If mp is needed to cast a spell, then you might want it to use doc galaktik to get the extra mp even if it is more expensive. But only if it is possible to purchase enough to fulfill the request. Otherwise it should return in failure.

Generally I get around this by turning off fizzy invigorating tonic when I don't want to use it. Obviously that is not the best solution.

I'll think more about what UR should do and how to do it.
 

pthalo

New member
i searched this thread to see if limit stores were mentioned, but didn't get any results.

does this script take into account limit stores? you mentioned that it checks mall prices once per session. for me, it decided ancient magic wipes were cheapest (level 13 disco bandit aftercore), and I was wondering whether that was based on the one in the mall costing 120 meat or on all of the others costing 200 meat?

If it doesn't handle limit stores, the way it could is, once a session it checks the mall prices for the various items, and then if it buys something from the mall it compares it against the price it has stored and if different, updates the value it has stored and recalculates which is cheapest.
 

Bale

Minion
The script has no special handling for limit stores. It has the same mafia handling of prices that all scripts use. Mafia purposefully only allows limited mall information to make it hard to script a mallbot. It is good to know how mafia allows scripts to interact with the mall so I'll explain in detail.

There is a function called mall_price() which returns the current mall price of an item, ignoring the first four items listed to compensate for stores with limits and min-priced sales. That means a limit store is compensated for, so if a single store is offering a price of 120 meat for a 1/day item and every other store sells it for 200 meat, then mall_price() will return a value of 200 meat.

Additionally, to prevent abuse, mall_price() will only perform an actual Mall search once per item per session. After that all calls for the same item will return the cached value. This cached value is updated after attempts to purchase the item using the CLI or ASH buy command (even unsuccessful ones), but not in any other conditions, including purchasing with the purchase tab.
 

pthalo

New member
Oh, cool. Thanks for the explanation. The way mafia checks prices seems entirely fair. (and, wow, I never would've guessed that ancient magic wipes were the way to go. i've mostly been guessing (just using whatever i have the most of. I have about a zillion tiny houses on hand, so i had been using those. maybe i should just sell them instead.)

your script has also had the effect of making me rethink some of the buffs i have going during aftercore meat farming. if i have to pay 200 meat every 4-5 turns, even with salamanderity active, am i sure i'm getting that much meat by having all those buffs active? I like re-evaluating strategies and doing math, so this is fun.
 

Bale

Minion
your script has also had the effect of making me rethink some of the buffs i have going during aftercore meat farming. if i have to pay 200 meat every 4-5 turns, even with salamanderity active, am i sure i'm getting that much meat by having all those buffs active? I like re-evaluating strategies and doing math, so this is fun.

Oh dear. You're casting all your own buffs in aftercore? Use this instead.
 
I *think* this is UR...
after breaking prism in fistcore, mafia still tries to buy black soda from the black market.
Code:
Purchasing black cherry soda (5 @ 76)...
Stopped purchasing black cherry soda @ 100.
Putting on bounty-hunting pants...
Equipment changed.
Cannot spend meat to fully restore MP! Failed to use black cherry soda for some reason.
Did not fully restore MP for some reason.

clicking on the black market in relay reveals "The Black Market is empty, because you beat up the guy who ran it."

I do *not* have black cherry soda checked in the mp panel.
thanks.

ETA: ok... maybe a mafia fix in the works
 
Last edited:

pthalo

New member
well, i was, sort of out of laziness even though i'd used buffbots in the past, but i've stopped that now, once i figured out how much casting carlweather's was costing me. the buff bot you linked is better than the one i used to use. thanks.

I'm still casting leash, springy, salamandar kata and miyagi massage myself, and olfacting goth giants, and doing both disco and rave nirvana. leash gives me an extra 16% meat drops at this weight and costs 4 meat per turn (assuming 60 mp for 200 meat), so that's cost effective. springy fusilli costs 3.3 meat per turn and the logic i was using was that my pickpocket chances would go up if i got the jump more often, but actually looking at the wiki, i should be getting the jump 100% of the time anyway. (168 (my mainstat) - 40 (goth giant's initiative) > 100). i've also got disco aerobics going for no discernable reason. i could drop miyagi -- some of my +meat equipment has hp/mp regen anyway and my hp isn't going to drop below 95% anyway -- nothing can hit me here. salamandar kata is always cost effective.
 

Bale

Minion
Weatherboy, I see you posted in the bug report. Thanks. After I break the prism again (it'll be a bit since I'm getting the donation trophy) I'll make a post there if the bug still exists.

pthalo, forewarned is forearmed. It's good to know what mp costs so that you can use that information they way you are doing now. Universal recovery actually makes that information available at all times so that you don't have to watch as closely. In the CLI, you can request that information like this:

Code:
[COLOR="olive"]> get _meatpermp[/COLOR]

24.0

That tells me how much meat each point of mp costs. I'm in fistcore right now so that price is really high. If I had access to black cherry soda it would be 8.0, if I had access to mmj it would change with my level and if I had mall access it would reflect the most recent price data.
 

pthalo

New member
Oh, how cool is that. Thanks. I use the CLI heavily, and it's nice to know there's an easy way to find out (i was just doing the math by myself)

If you really need mp and meatpermp is 24, then galaktik@17 is the way to go. in my fist runs i've just gotten salamanderity as soon as i could and cast buffs as the mp accrues. i haven't spent anything on mp in fistcore beyond the initial 5 mp needed to cast salamanderity the first time. More expensive buffs I've been budgetting around (using them less, but since i have more the enough mp for the basics, i can afford a few casts here and there throughout the run, even daily ode to booze hasn't been a problem)
 

pthalo

New member
or maybe s/he has galaktik disabled in their settings?

also might be worth it to open the citadel... gain a scroll, a hippy outfit, and cheap mp
 

Bale

Minion
I actually disabled galaktik... Though I still wonder why it came out to 24.0.

Anyway, I saw no reason to open the citadel since I wasn't purchasing mp. I'm in softcore to get the new trophy so I had tons'n'tons of mp from the CoT-megadrone. Mp is so easy in softcore that it is a joke. I've got most interesting buffs at 1000 turns and I haven't purchased a single restorative or used a starfish.
 

fxer

Member
Code:
Purchasing some magical mystery juices for use as a combat restorative.
Purchasing magical mystery juice (1 @ 100)...
You acquire an item: magical mystery juice
You spent 100 Meat
Purchases complete.
_meatpermp => 5.0

You have a current version of Universal Recovery Configuration.
baleUr_FistPurchase => false
mpAutoRecoveryTarget => 0.05

Is the latest UR supposed to buy stuff in Fistcore? I looked at the setting in the relay script and it was unchecked. Using Mafia r9762
 
Last edited:

Bale

Minion
Wow. I honestly cannot figure out why it purchased that mmj for you. I'm pouring over the relevant code and drawing a blank.

Please confirm for me in the CLI:

Code:
[COLOR="olive"]> get _version_BalesUniversalRecovery[/COLOR]

3.9

[COLOR="olive"]> ash my_path()[/COLOR]

Returned: Way of the Surprising Fist
 

fxer

Member
now using r9768 but the output is as yours was

Code:
> get _version_BalesUniversalRecovery

3.9

> ash my_path()

Returned: Way of the Surprising Fist

put the MMJ's in my closet and ran another adv and the script bought a few more:

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

<combat cut>

Purchasing some magical mystery juices for use as a combat restorative.
Purchasing magical mystery juice (3 @ 100)...
You acquire magical mystery juice (3)
You spent 300 Meat
Purchases complete.
_meatpermp => 4.6511626

Double checked the FistPurchase boolean in prefs.txt and it is setting and storing properly
 
Last edited:

Bale

Minion
I added protections against this happening regardless of the situation. Please let me know if it is fixed.


Universal recovery v 3.9.1 released!



Changelog:
version 3.9.1 August 29, 2011
  • Added extra checks to protect against purchase in Way of the Surprising Fist
 
Last edited:

fxer

Member
Looks like that solved it Bale, didn't purchase more when I put them in my closet, and then I pulled and used all of them and it still didn't buy more, thanks as always
 
Top