Universal Recovery Script

Bale

Minion
My recovery script handles poison and beaten up because those reduce maximum HP so severely. I do that since you can't heal if your max HP are in the toilet.

However mafia does have the ability to recover poison built into the combat settings. Check out the special combat action bar on the upper-right of the adventure tab. It'll also handle automatic MP restoration in combat. (I support that by making sure you always have something to restore MP with in combat.)
 

jokermage

New member
Restoring HP! Currently at 2 of 19 HP, 4 of 9 MP... Target HP = 19.
Division by zero (Universal_recovery.ash, line 646)
Autorecovery failed.

This is latest daily build and v3.0 of the script. I just ascended so that may have something to do with it.
 

Spiny

Member
One of my alts is in HC BM atm. I've been using this script tentatively as I got myself used to how mafia's hp/mp manager worked and knew it wasn't going to use anything I didn't have (I have buying from mall disabled) and it used skills in preference to items.

I browsed some of the code for Bale's script and realized why it was prompting me for anti-anti-antidotes and seltzers and I've been pleased with it for the most part. I was confused, at times, when after gaining access to the white citadel it started buying cloaca colas for 80 meat each, rather than continuing to buy seltzers for the same 80 meat. I thought seltzers restored more mana and would ultimately require less expense. I came to the conclusion that the script decided it was more efficient not to change outfits to the KGE and just bought the accessible cloaca colas. Then, to my surprise, it started buying seltzers again, as well as the cloaca colas still. I came to the conclusion that during the restoration process it must have used up the seltzers it had on reserve for in-combat emergencies, and thus wanted more. I had not used any manually and am adventuring thru the relay browser. I access the script with "restore both" or "restore mana" in the gCLI. As I understand why these things are happening, I think, I'm ok with them. I've opened up the black market so using black cherry sodas now for the most part and that's as expected.

My character is a seal clubber with both tongue skills, but uses mana left and right lunging thrust smacking, because admittedly, I suck at playing a muscle class. (Using a fairy or volleyball for the most part, even though I should probably be using a different familiar for efficiency.) I'm in bad moon with no current access to pulverize and I don't have a spleen familiar. I tend to use all 15 spleens on medicinal herbs because I'm too lazy to go back to the airship to farm some scrolls and phonics. Sometimes I manually use a medicinal herb, but most times I do the "restore both." Meat is tight for me, and I'm stingy lol, so I only buy medicinal herbs as I'm able (sometimes only 5 at a time). If I don't notice that I'm out of the herbs and call the script, a similar log to what is posted below occurs to my frustration.

What I'd like is an option for the script to either buy an herb and use it if there's spleen room (since it buys the other restoratives, it should be able to do this too), OR abort so I can buy an herb before it goes thru all the extra expense of restoring mana, healing, restoring mana. Any chance of this? Or is this already there and I just plain missed it?

> restore both

Restoring HP! Currently at 16 of 255 HP, 18 of 86 MP... Target HP = 255.
You need 1 more Medicinal Herb's medicinal herbs to continue.
Casting Tongue of the Walrus 1 times...
You gain 37 hit points
Tongue of the Walrus was successfully cast.
You need 1 more Medicinal Herb's medicinal herbs to continue.
Restoring MP! Currently at 53 of 255 HP, 8 of 86 MP... Target MP = 50.
Purchasing black cherry soda (5 @ 80)...
You acquire black cherry soda (5)
Purchases complete.
Using 5 black cherry soda...
You gain 51 Muscularity Points
Finished using 5 black cherry soda.
Casting Tongue of the Walrus 5 times...
You gain 181 hit points
Tongue of the Walrus was successfully cast.
Restoring MP! Currently at 234 of 255 HP, 9 of 86 MP... Target MP = 10.
Purchasing black cherry soda (1 @ 80)...
You acquire an item: black cherry soda
Purchases complete.
Using 1 black cherry soda...
You gain 11 Muscularity Points
Finished using 1 black cherry soda.
Casting Tongue of the Walrus 1 times...
You gain 37 hit points
Tongue of the Walrus was successfully cast.
Restoring MP! Currently at 255 of 255 HP, 10 of 86 MP... Target MP = 86.
Purchasing black cherry soda (8 @ 80)...
You acquire black cherry soda (8)
Purchases complete.
Using 8 black cherry soda...
You gain 80 Muscularity Points
Finished using 8 black cherry soda.

Thanks for any help and suggestions and sorry for being so long-winded :)
-Spiny
 

Spiny

Member
Ok, I guess my last post was way too long winded ;)

Anyhow, the problem, I think, was that the line:

"You need 1 more Medicinal Herb's medicinal herbs to continue."

was coming from Mafia. Without Bale's script, it would have aborted and I'd have had to buy herbs. Bale's script did what it was programmed to do, at this point. It checked for herbs behind the scenes and realized I had none so it continued thru the hp/mp restore as scripted.

What was puzzling was this part under the full heal section regarding medicinal herbs:

Code:
	switch {
	case use_herb && my_spleen_use() < spleen_limit() 
	  && (item_amount($item[medicinal herbs]) >0 || (my_meat() >=100 && my_primestat() == $stat[muscle])):
		return use(1, $item[medicinal herbs]);

It was checking to see if I could afford to buy the herbs if I had none, but it didn't do anything with this knowledge. As a result of my frustration, my friend did a tiny hack for me as follows:

Code:
	switch {
	case use_herb && my_spleen_use() < spleen_limit() 
	  && (item_amount($item[medicinal herbs]) >0 || (my_meat() >=100 && my_primestat() == $stat[muscle])):
		if ((item_amount($item[medicinal herbs]) == 0) && (my_meat() >=100 && my_primestat() == $stat[muscle])) {
			print("Buying medicinal herb","blue");
			buy(1, $item[medicinal herbs]);
		}
		return use(1, $item[medicinal herbs]);

This now actually buys the herbs and uses them if I qualify which is far cheaper (for me) than going thru all that mana I had to purchase before.

1120 meat for mana to use skills and restore mana (see prior post above)

vs


100 meat for full heal + 640 meat for mana FTW:

> restore both

You've had the crap beaten out of you... attempting to find some more crap.
Casting Tongue of the Otter 1 times...
You gain 10 hit points
Tongue of the Otter was successfully cast.
Restoring HP! Currently at 10 of 256 HP, 64 of 143 MP... Target HP = 256.
Buying medicinal herb
Purchasing Medicinal Herb's medicinal herbs (1 @ 100)...
You acquire an item: Medicinal Herb's medicinal herbs
Purchases complete.
Using 1 Medicinal Herb's medicinal herbs...
You gain 246 hit points
Finished using 1 Medicinal Herb's medicinal herbs.
Restoring MP! Currently at 256 of 256 HP, 64 of 143 MP... Target MP = 143.
Purchasing black cherry soda (8 @ 80)...
You acquire black cherry soda (8)
Purchases complete.
Using 8 black cherry soda...
You gain 79 Muscularity Points
Finished using 8 black cherry soda.

-Spiny
 
Last edited:

zarqon

Well-known member
Bale --

How about restoring only to 1 HP and 0 MP (and not removing Beaten Up) if my_location() == $location[hidden temple]?

It would save all of us Temple-levelers some configuring, and would really make your script more "universal."

@Spiny: Just a note -- the message "You need N more Xs to continue." is printed by mafia when a script calls retrieve_item() and mafia is unable to get the item, or when the same thing happens using the CLI "acquire" command. In a well-written script, it often doesn't actually mean that you need the item to continue. The message can be a bit confusing and should probably be changed to a more accurate "Unable to acquire N Xs."
 

Bale

Minion
That is honestly the best idea for a new feature I have seen in a long time. I always have to turn down my settings every time I go to the temple and it is annoying. I'll just make the script do it for me! I should be level 11 in two days so I'll test it then.
 

Bale

Minion
Universal recovery v 3.1 released!


Changelog:
version 3.1 July 23, 2009
  • Only restores 1 HP (and doesn't heal beaten up) if you're in the Hidden Temple or mining for ore.
  • Fixed a few bugs
 
Last edited:

Spiny

Member
Bale,

A quick question regarding your formula for find_maxmp(). Both in the prior version of your script, as well as in the new version, you've got:

Code:
	float c = .25 * to_int(my_primestat() == $stat[mysticality]) +1;

Is it a bug, or is there a reason it's not the same as the wiki's suggested formula:

Code:
C is 1.5 if you are a Myst class (1 for other classes)

which would be:

Code:
 	float c = .5 * to_int(my_primestat() == $stat[mysticality]) +1;

-Spiny
 

Bale

Minion
That appears to be a bug. I had consulted the wiki for the forumula, so I can't account for the difference. I do not remember why I thought the factor was 1.25, but thank you for spotting the error.

It seems I also have to update the forumula for the slimy skills so I'll take care of that now also. Anyone know how to find out what level of the slimy skills is possessed?
 

Alhifar

Member
Currently the Recovery Script finds 373 meat too expensive for a scroll of drastic healing. Instead, it thinks it should cast Tounge of the Walrus 82 times, then buy a scented massage oil and use that. Somehow, I don't think that is the cheapest way of going about restoration.

Code:
Restoring HP! Currently at 202 of 3373 HP, 826 of 826 MP... Target HP = 3373.
Searching for "scroll of drastic healing"...
Stopped purchasing scroll of drastic healing @ 373.
Using cached search results for scroll of drastic healing...
Stopped purchasing scroll of drastic healing @ 373.
Casting Tongue of the Walrus 82 times...
You gain 2,834 hit points
Tongue of the Walrus was successfully cast.
Searching for "scented massage oil"...
Purchasing scented massage oil (1 @ 5,950)...
You acquire an item: scented massage oil
Purchases complete.
Using 1 scented massage oil...
You gain 337 hit points
Finished using 1 scented massage oil.
 

Bale

Minion
I suspect I know what happened... At least with regards to the healing scroll. It must be that the price of scroll of drastic healing went up beyond mall_price() +60%. If that happens it won't be able to tell what price a scroll of drastic healing really is and will refuse to purchase at an indeterminate price, so it removed the scroll from consideration. Purchasing at an indeterminate price could be bad. I'm really not sure how to fix that since mafia limits a script's access to pricing information.

As for purchasing scented massage oil AFTER using the tongue 82 times... That's just bad. In several ways. I'm going to look into it.
 

Bale

Minion
r7493 is so awesome!! OMG!!! Squee~!

For some time I've been meaning to modify the code to test -MP cost equipment in all accessory slots to ensure that I can equip it in some slot that does not negatively impact upon your maximum HP and MP. This makes the upgrade relatively easy for me to make so you can expect it soon.

Now, for a question that's been bugging me... While I'm at it, I can switch -MP gear to reduce recovery costs in aftercore... would that be immoral to add on a function that mafia purposefully disabled? Would it be better if I left it disabled by default, but with a boolean in the script to enable the function for the observant? I'd really like to hear what people think about this.

numeric_modifier("Maximum HP Nonmultiplied"), and likewise for MP.
I'd just added that to my script, but thanks to your speculate command I'm not going to need it anymore. Now mafia can figure out maximum HP/MP for me. ;)
 
ok, there it goes. it wasn't you, it was mafia. there was a serious problem with your script, and it wasn't mmj use, but it's fixed now

scratch that, it's still screwy. it's still trying to buy tonic and erring when it's not allowed to. it shouldn't be trying to buy it at all.
this is a recent bug. do you have an old version to compare? I want v2.7 back :(

this is still happening
it says Cannot fully restore MP because fizzy invigorating tonic is disabled!
it doesn't matter what percentages are set and it ignores all other mp restorers in hardcore
 

Spiny

Member
this is still happening
it says Cannot fully restore MP because fizzy invigorating tonic is disabled!
it doesn't matter what percentages are set and it ignores all other mp restorers in hardcore

Interesting.

For my HC use, I've seen it go to seltzers, cloaca colas, and black cherry sodas and use the fizzy as top offs as needed.

I did once have a problem when beaten up where it used a SGEE instead of a tiny house even though I had hundreds of tiny houses. It gave a similar message of tiny houses being disabled. The first post in this thread shows a graphic of which hp/mp items set in mafia the script looks at as far as settings, but the tiny house isn't in the graphic so I didn't think I needed to select it, but I did. Next beaten up, it used a tiny house instead of the eyedrop.

On my myst account, I have cannelloni coccoon permed, and have my hp restore set to fire off at low HPs. Bale's script always uses items instead of the 20 mp skill. Personally, I'd rather burn 20 mp for a full heal than use a bunch of gauze or whatever, but I do have hundreds of those things in softcore so it's more of a personal preference. I like being a packrat. Regenerating 20mp with a chefstave and high level gear is trivial. Granted, if all I had was a tongue skill, disco nap, or lasagna bandages, I'd rather use items first.

-Spiny
 

Bale

Minion
this is still happening
it says Cannot fully restore MP because fizzy invigorating tonic is disabled!
it doesn't matter what percentages are set and it ignores all other mp restorers in hardcore

As Spiny suggests, you probably have Galaktik's fizzy invigorating tonic disabled in preferences. Don't disable it. It is not as good as Knob Goblin seltzer, but it is better than soda water and you don't always WANT to purchase seltzer since it can lower your HP/MP. The script will avoid making you lose HP/MP by equipping the elite guard outfit.

And perhaps you have other things disabled as well.

On my myst account, I have cannelloni coccoon permed, and have my hp restore set to fire off at low HPs. Bale's script always uses items instead of the 20 mp skill. Personally, I'd rather burn 20 mp for a full heal than use a bunch of gauze or whatever, but I do have hundreds of those things in softcore so it's more of a personal preference. I like being a packrat. Regenerating 20mp with a chefstave and high level gear is trivial. Granted, if all I had was a tongue skill, disco nap, or lasagna bandages, I'd rather use items first.
I'm not sure if you're talking about mallcore mode which works extremely differently. That'll always work off expected mall value, shunning items if their mall value is high.

In either mallcore or hardcore I find it uses cocoon for me, so I don't know why it won't do that for you. I'd have to hear a lot more about the specifics of your case.
 

Spiny

Member
I'm not sure if you're talking about mallcore mode which works extremely differently. That'll always work off expected mall value, shunning items if their mall value is high.

In either mallcore or hardcore I find it uses cocoon for me, so I don't know why it won't do that for you. I'd have to hear a lot more about the specifics of your case.

Hrmm... this is an excerpt from yesterday's session log on my myst account:

Code:
> Restoring HP! Currently at 307 of 1043 HP, 684 of 1103 MP... Target HP = 1043.

use 6 filthy poultice
You gain 628 hit points

use 1 bottle of Vangoghbitussin
You gain 100 hit points
You gain 100 Mana Points
You acquire an effect: The 'Tussin (duration: 5 Adventures)

And another from a few days prior:

Code:
 > Restoring HP! Currently at 373 of 964 HP, 925 of 925 MP... Target HP = 964.

use 5 filthy poultice
You gain 555 hit points

use 1 cast
You gain 18 hit points

use 1 cloudy potion of healing
You gain 16 hit points
You gain 15 Mana Points

Setting in Universal_recovery.ash. I hate having scripts auto-buy stuff from mall for me:
Code:
boolean mall = false;

Mafia preferences have both buying from npcs and mall disabled.

HP settings in mafia:
Stop if health at 20%
Restore at 40%
Try to recover to 100%

Cannelloni Coccoon is selected (along with many other items, just to be on the safe side). Bottle of Vangoghbitussin is not enabled, but was used in the above example anyhow, that's fine.

-Spiny
 

Bale

Minion
If you set mall to false, then it will always act as if it is in hardcore. That means it will attempt to use a huge pile of items if it sees them. If you want it to stop using a pile of items, then you're going to have to closet them.

It's acting as expected. I feel relieved.
 
Top