Universal Recovery Script

Bale

Minion
I have this box checked, but it was still ending the script with what I quoted above instead of resting. I'm not sure why this is happening, and it is the main reason I came here.

In that case I suspect that the reason it is not resting is because it wants to make use of the full HP & MP value from resting. If you're gonna use an adventure, you should get your full value from it. Once again, posting part of your session log might demonstrate that.

I may have to switch back to the default recovery, at least it used inventory items.
The bolded part made it sound like my script was not fulfilling your needs. Not to mention sounding a bit snarky, though that may not have been your intent.
 

Rinn

Developer
This restore seems a little weird to me:
Code:
> ash restore_hp(0);

 > Restoring HP! Currently at 713 of 1728 HP, 348 of 1723 MP, current meat: 73695356 ... Target HP = 1728.
 > Restoring MP! Currently at 713 of 1728 HP, 348 of 1723 MP, current meat: 73695356 ... Target MP = 878.

[1545] Rest in your dwelling
You gain 39 hit points
You gain 80 Mojo Points

[1545] Rest in your dwelling
You gain 39 hit points
You gain 80 Mojo Points

[1545] Rest in your dwelling
You gain 38 hit points
You gain 80 Mojo Points

buy 2 ancient Magi-Wipes for 200 each from 1056965 on 20100107
You acquire ancient Magi-Wipes (2)

buy 4 ancient Magi-Wipes for 200 each from 1953474 on 20100107
You acquire ancient Magi-Wipes (4)

use 6 ancient Magi-Wipes
You gain 335 hit points
You gain 328 Mojo Points

cast 1 Cannelloni Cocoon
You gain 564 hit points
My restore settings are at 75% hp to 100% hp, and 50% mp to 55% mp. I expect it restored mp because I was below my recovery target, but I would expect when only requested to restore hp that's all that would be restored and any mp restored during that time would only be used if necessary to restore hp.
 

Bale

Minion
Looks good to me. Your HP started under 75% and MP started under 50%. When it was done your HP was at 100% and MP was at 55%. That is good behavior.

Perhaps you're wondering why it healed MP also. 99.9% of the time when it needs to heal HP to default values, it gets a request to heal MP immediately after. So, if MP are low it will try to satisfy that at the same time in case healing MP with mixed HP/MP items will be enough to restore HP. (If you'd told it to heal to a specific HP number, then it wouldn't have anticipated the need to invoke MP restoration.) Most of the time this prevents undesirable behavior.
 

Rinn

Developer
So if I had called restore_hp(my_maxhp()) it wouldn't have restored any mp unless necessary to cast healing spells?
 

Bale

Minion
Correct. Though it is still only restoring mp if your mp is under your mp restoration target, so it shouldn't be a huge problem.
 

shoptroll

Member
For some reason the script isn't firing when my HP/MP dip below the thresholds specified in my mafia settings. I've double checked all my settings and Mafia is set to restore HP & MP while manually adventuring (this has always worked for me in the relay browser). Mood is not set to apathetic.

Tried upgrading Mafia to the latest daily, did not fix it.

Only thing that changed today is starting an AT HCO run and adding zlib + newLife and bumcheekcity's snapshot script to my scripts directory.

Help? :(
 
Last edited:

Rinn

Developer
It would be in any situation where you have wildly fluctuating max mp and you only need to restore hp (basement diving) as you could potentially waste a lot of mp if you had not turned off your recovery target.
 

Bale

Minion
I suspect your problem is actually that you're mistaken about your healing settings. One thing that newLife does is to turn restoration way down. Unfortunately this change is not displayed in the UI. The UI will correct itself when you quit mafia and log in again.

If this wasn't the problem... please tell me a lot more about the situation and I'll take another guess.
 

shoptroll

Member
I suspect your problem is actually that you're mistaken about your healing settings. One thing that newLife does is to turn restoration way down. Unfortunately this change is not displayed in the UI. The UI will correct itself when you quit mafia and log in again.

Yup, that was it. Thanks for the info!
 

NastyPeasant

New member
I have set mafia to use Universal_Recovery.ash
I'm starting to regret this.

I have set HP restore at 30%, and ONLY ticked "medicinal herbs" under HP/MP restore. I don't want ANYTHING else used, and NOTHING else is ticked.

I have set MP restore to "don't restore". Ever.

Yet there are times when the following happens:
> Restoring HP! Currently at 20 of 104 HP, 13 of 97 MP, current meat: 35338 ... Target HP = 99.

use 1 phonics down
...
use 1 honey-dipped locust
...


W.T.F.!!! NO! DAMNIT!

Based on a quick grep, it's Universal_Recovery.ash doing this.

I would like to know WHY its doing this even though I have specifically told it to use ONLY medicinal herbs and NOT restore MP.
I would like to know HOW to stop this really annoying behaviour.

This behaviour is completely unacceptable. It's not the first time its happened, but this time its made me really annoyed. I'm in BM, I don't have this shit to waste!
 
Last edited:

NastyPeasant

New member
I have set mafia to use Universal_Recovery.ash

If I tell Mafia (in the Adventure->HP/MP options) to STOP at 30% HP it does as requested without using anything. Its only if I have it try to heal me using only medicinal herbs that universal_recovery goes off and does its own thing.
 

NastyPeasant

New member
I'm in BM, I don't have this shit to waste!

Lovely. The script has now used up my entire supply of honey locust while doing a lucre quest, for no reason whatsoever.

At the moment, this behaviour in Universal_Recovery makes the "automated" features of mafia totally useless to me, especially when I'm so resource limited in BM.

Please, is there some way to turn off THIS particular "feature", or should I just stop using universal_recovery.ash until this problem is fixed?
 

Bale

Minion
I'm sorry that you are so angry. I'm particularly sorry because it is indeed this script to blame and I don't intend to change this behavior.

If you had read the first post -- it contains a lot of information on how this script works in hopes that people won't get so angry -- you'd have noticed it has an image detailing exactly which items can be excluded from use by universal_recovery. None of the other items can be excluded.

My script works on the assumption that items exist to be used. It will only use phonics down and honey-dipped locusts if it can completely use them. If they won't heal enough HP, only then will it use herbs. The logic is that you can only use herbs 15 times in a day so you'll want to save them for the times that they are actually necessary. (It doesn't want to waste your spleen.)

This script tries really hard to figure out the most effective means of healing. If you disagree with its logic, then please switch back to default recovery where you can indeed tell it to do nothing except heal with herbs. Mafia's default heal is very stupid, but it can follow that instruction 100% of the time while my script cannot be informed to behave that way. (And I wouldn't want to do that since I do not believe it to be a problem.)

Now you know. I simply don't want to duplicate functionality that mafia already possesses.
 
Last edited:

NastyPeasant

New member
OK, yes, I obviously misunderstood the description. Here is a listing of why those instructions might be not as clear as they could be. At the end I've included some suggestions on how to make those instructions perhaps a bit more explicit in what Universal_recovery does and doesn't do.

If you had read the first post -- it contains a lot of information on how this script works in hopes that people won't get so angry

I did read the first post. I read:

After installation, configuration only requires you to set the healing targets in mafia's HP/MP usage tab just as when you set up mafia's restoration settings.
which implies that preferences I set will be obeyed, not completely ignored.

and
This script will allow you to customize its healing in hardcore or ronin by making use of the following options in KolMafia's HP/MP usage.
followed by a diagram that includes the "don't restore MP", and other options that universal_recovery ignored completely.

and
Hardcore Mode: For hardcore before freeing the king or in normal core before breaking Ronin. This mode will treat inventory as if it was precious, always attempting to heal with the minimal items, never wasting any inventory since it is hard to replace.
I found the locusts hard to replace, myself. Especially since I'd specifically said not to restore MP (because I wanted manual control over items that did that)

and
The script will obey mafia's preferences,
No, it will not. You probably meant to say "will obey mafia's preferences about where to purchase things".

and finally:
Any option not highlighted in the illustration is ignored by this script.
which is the one line that basically annuls all the others. I suggest you add "this means you can't specifically include or exclude anything that is not on this list, and universal_recovery will automatically decide whether or not to use it", or something MUCH more explicit. Please.

Unless my reading comprehension has deserted me, most of the above (except the last, single, line) says lots about Universal_recovery.ash following user preferences, and only one passing comment about it completely ignoring user preferences and using stuff that has been specifically excluded from said preferences. If that is indeed how Universal_recovery is supposed to work, might I suggest you be a bit more explicit about this behaviour? As in, put this line (or something similar)
items not listed in the highlighted section cannot be excluded from use, and will be used if universal_recovery deems it necessary. Universal_recovery will also ignore "no HP restore" or "no MP restore" if it needs to use an item that does both.
above the image. In bold. In a larger font. Blinking. (ok, not that last one. Please not that last one.)

Yes, now that I've been informed that it was universal_recovery responsible for using stuff I wanted to keep until later I'll have to either be more careful about putting stuff into my closet to hide it, or disable universal_recovery when I want the system to do exactly what I told it to do.

Don't get me wrong, I've probably found universal_recovery quite useful many times, but I'd suggest you be MUCH more explicit in your introduction about the fact that it WILL use any and all items NOT listed in the picture you show. My reading comprehension is pretty good, and I completely missed that when reading it (and read it I did). I know I'm not the only one that's been caught out by this, and all the other people I've talked to have been blaming mafia for this behaviour, not universal_recovery.

Might I also suggest that you put something about it being universal_recovery that is deciding to use those items in the output? So that we know we forgot to temporary disable it for whatever it was we were doing at the time where it wasn't really required? So instead of:
> Restoring HP! Currently at 20 of 104 HP, 13 of 97 MP, current meat: 35338 ... Target HP = 99.
...
have
> Universal_Recovery restoring HP! HP=20/104, MP=13/97, meat=35338 ... Target HP=99.
...
Thank you for using Universal_Recovery.
or something like that to let people know who is doing what and where.

Finally, my apologies for my initial tone, but I was quite put out by losing those locusts and lots of other stuff, and it took a while for me to get annoyed enough to start digging. In this case I'd been saving those locusts for later.
 
I've found that diagram pretty clear. You can manipulate the behavior of the options that are highlighted; the options that are not highlighted, UR pays no attention to and does whatever it wants. (Most of the time, that's smarter than what I could do without rather a lot of tedious comparative math.)

May I suggest that if you want such fine control over your healing, perhaps it's best to have NOTHING done automatically? Or if you just want Mafia to do what Mafia does, don't use a script on top that does explicitly tell you that it will ignore some options that Mafia has?

And furthermore, I don't really understand why, when you figured out that UR was doing things that weren't right for you, you left it on so it could keep doing them! The instructions for turning UR off are in the first post too, even in bold. Just type:
set recoveryScript =
 

Grotfang

Developer
Might I also suggest that you put something about it being universal_recovery that is deciding to use those items in the output?

That's a fair point, but that feature is already there. Mafia's default behaviour does not print those

Code:
> Restoring HP! Currently at 20 of 104 HP, 13 of 97 MP, current meat: 35338 ... Target HP = 99.

messages as standard.

Finally, you do come across as a little abrasive here. I would suggest that given this script is provided for free, for a game that is provided for free, perhaps it's worth being a little more relaxed when posting?
 

NastyPeasant

New member
Finally, you do come across as a little abrasive here. I would suggest that given this script is provided for free, for a game that is provided for free, perhaps it's worth being a little more relaxed when posting?

Fair point, well made.

If it helps, I'd like to apologize for the abrasive nature of my postings.
 

zarqon

Well-known member
I love this forum. People help each other, people concede points, people use diplomatic language.

Oh also there are some awesome scripts, like this one. Whenever I convert someone from regular KoL to mafia, UR is one of the things I'm sure to set them up with.
 

Veracity

Developer
Staff member
Some day, I will have to try out this script - and zarquon's scripts. But, I choose to play KoL the way the creators INTENDED it to be played: in KoLmafia's relay browser, with help from KoLmafia's GUI, as needed. This ASH stuff? It's cheating!

:) :) :) :)
 
Top