Universal Recovery Script

Spiny

Member
Of course the ideal is that healing would be preferred to not healing and in truth UR would like to heal you. It's clearly trying to do so. The problem appears that the script wants to heal with a fullheal item/skill that is not available at the current juncture in your run and in mine from post 819. Now it's up to Bale to determine how to instruct the script to use other, preferably cost efficient, means of healing if a fullheal is not available in cases such as these.
 

fronobulax

Developer
Staff member
So I was biting my tongue because I find UR very helpful and useful. Since it isn't doing what I would like at the moment, I was getting angsty and realized I was slipping into that sense of entitlement that pretty consistently makes the users of a free tool seem ungrateful and at odds with the developer. So...

As noted above, UR was either not healing anything or healing to 50% of my health as opposed to the requested 100%. I actually looked at the code and saw the following line.
Code:
	if(Verbosity > 1) print("Last attempt to purchase HP with meat.", "blue");
	else return purchase_hp(target);		// Restoration has failed, so lets try to restore hp with meat.
Since my instance of vi is not doing very much with syntax driven highlighting, there is always the chance that I just can't match braces. However, if I am right it looks like the code will either print the message or restore HP but not both. (The fall through seems to be to return a null value). I turned UR verbosity off and UR did heal me.

I think the same code construct occurs with MP purchases as well.

In any event, you may wish to examine this and verify that it is doing what is expected regardless of verbosity.

With verbosity off and initiating the restore from the relay GUI, the gCLI had
Restoring HP! Currently at 34 of 116 HP, 96 of 112 MP, current meat: 4723 ... Target HP = 116.
Visiting Doc Galaktik...

Restore 24 HP at Doc Galaktik's
You gain 24 hit points
You spent 144 Meat
Cure purchased.

which suggests that UR had the right idea for my target HP but chose not to act on it for some reason. That may be a feature and not a bug because I can imagine a special case where restoring to some minimum rather than what was requested is done to save meat. I'm not sure I'd be an advocate for it, at the moment, but documenting the special case would be enough.

Did I tell you how much I appreciate UR?

Thanks.
 

slyz

Developer
From looking at purchase_hp(), the fact that UR is only recovering up to 50% when it has to resort to buying HP with meat is a feature.
The target is reset if a full heal was asked by Mafia:
PHP:
if(objective == 0)   // Let's not be stubborn. Lets save meat by getting close enough
	target = min(target *.9, hp_autoheal);
where hp_autoheal is the amount of HP under which Mafia will ask for a restore.

Unless this is a typo, what happens is that, if your only option to finish healing is to buy Ailment Ointments, the target is lowered so you can save some meat (maybe you will soon have a better option?).
 

fronobulax

Developer
Staff member
Unless this is a typo, what happens is that, if your only option to finish healing is to buy Ailment Ointments, the target is lowered so you can save some meat (maybe you will soon have a better option?).
I was wondering about that. At least it is deliberate. Without putting words into Bale's mouth (and he has been quiet on this subject lately) I believe UR was designed to be much more efficient and optimal than I require.

For example, I quite often auto adventure in an area where the typical monster will knock my health down to 40% of max. If I adventure twice without restores I am almost certain to get beaten up and that is undesirable. So I restore at 50% and restore to 100% and that almost certainly allows auto-adventure to succeed. The behavior of trying to save me meat by not healing to the requested amount saves me meat but either costs me time because I have to manually restore or costs adventures because I forget and get beaten up. There are times when there is nothing better than the Doc and I would like to use him. I should also note that if I unchecked the Doc items as allowable restores, I would be in almost the same situation.

I am reluctant to suggest to Bale how he proceed because our goals and philosophies differ, but I'm wondering if checking any of the Doc restores should mean that spending available meat is not a concern and the UR should just do what was asked.
 

Bale

Minion
I actually looked at the code and saw the following line.
Code:
	if(Verbosity > 1) print("Last attempt to purchase HP with meat.", "blue");
	else return purchase_hp(target);		// Restoration has failed, so lets try to restore hp with meat.
Since my instance of vi is not doing very much with syntax driven highlighting, there is always the chance that I just can't match braces. However, if I am right it looks like the code will either print the message or restore HP but not both. (The fall through seems to be to return a null value). I turned UR verbosity off and UR did heal me.

I think the same code construct occurs with MP purchases as well.

That was a bug and thank you for finding it. The unnecessary "else" did not occur with MP purchases, so at least I didn't do it on purpose. :confused:

I am reluctant to suggest to Bale how he proceed because our goals and philosophies differ, but I'm wondering if checking any of the Doc restores should mean that spending available meat is not a concern and the UR should just do what was asked.

The problem is this: People get upset when it spends too much meat healing. Previously I've had people quite convinced that if it goes berserk spending huge amounts of meat on healing HP then I should let them do something like heal in their campground. I have little problem because I have cocoon and other healing skills, so it works for me.

Perhaps I should add a "spend meat freely" option so that everyone is happy. (Gosh I love being able to add options in my UI script.)
 

Bale

Minion
Bugfix release

version 3.72 July 7, 2010
- fix bug that prevented use of Doc Galaktik to heal HP if verbosity was turned up.
 

Bale

Minion
Script doesn't check for accordion thief store access for Medicinal Herbs.

Dang. I do believe you're correct. In my next version this will be lines 95-97. You can edit it into your copy now:

Code:
boolean use_herb = contains_text(hpAutoRecoveryItems, "medicinal herb's medicinal herbs")
	&& (my_primestat() == $stat[muscle] || item_amount($item[Medicinal Herb's medicinal herbs]) > 0
	|| (my_class() == $class[accordion thief] && my_level() >= 9));
 
Last edited:

Xenthes

Member
I have a problem with just one of my characters and for the life of me I can not figure out what is going on. UR only wants to restore MP using Galaktik's Fizzy Invigorating Tonic no matter what I have UR or mafia set to do. This started at my last ascension and has continued to the current one. I was hoping that ascending would clear it up, but it didn't.
I am currently a lvl 4 AT doing a HCNP run. Since I am in HC I don't want to use meat to heal at this point in the run.
Verbose is set at three when I tried to restore MP and then I manually rested on the clan couch.
Code:
Calling Universal Recovery for type=MP, amount=13
Restoring MP! Currently at 16 of 16 HP, 0 of 13 MP, current meat: 974 ... Target MP = 13.
Try to heal MP from inventory.
Last attempt to purchase MP with meat.
Cannot restore MP because fizzy invigorating tonic is disabled!
Did not fully restore MP for some reason.
Visiting Comfy Sofa in clan rumpus room

[139] Rest in Clan Sofa (1 turns)
You gain 13 Mojo Points
Calling Universal Recovery for type=HP, amount=0
Calling Universal Recovery for type=MP, amount=0

Attached is my settings in UR.

Since this is the only one of my alts this is happening to and I can't find a difference in settings I a bit frustrated.

Thanks for any help.
 

Attachments

  • UR_settings.JPG
    UR_settings.JPG
    95.2 KB · Views: 56

slyz

Developer
UR will only use an adventure in the clan sofa if no MP or HP is wasted. See line 995:
PHP:
if( (my_maxmp() - my_mp()) >=my_level()*5 && (my_maxhp() - my_hp()) >= my_level()*5)
 

Schmendrick

New member
Dang. I do believe you're correct. In my next version this will be lines 95-97. You can edit it into your copy now:

Code:
boolean use_herb = contains_text(hpAutoRecoveryItems, "medicinal herb's medicinal herbs")
	&& (my_primestat() == $stat[muscle] || item_amount($item[Medicinal Herb's medicinal herbs]) > 0
	|| (my_class() == $class[accordion thief] && my_level() >= 9));

Yeah, I actually did that to the last version. Then I updated, forgot I'd fixed my older version, and got all annoyed when I saw all that meat getting spent (I'm Bad Moon, so it was going to Galaktik for HP). But I remembered
Code:
|| item_amount($item[Medicinal Herb's medicinal herbs]) > 0
from earlier so instead of bothering with editing again I just bought a crapload of Herbs (I'll use 'em sometime, right?). And then came here to tell you about it.

Sorry if I was a bit terse; I did it to avoid the opposite error of being too verbose, but Zarqon pointed out to me that it might have come across as rude. He was actually looking forward to me getting blasted for it. v:rolleyes:v
 

Xenthes

Member
UR will only use an adventure in the clan sofa if no MP or HP is wasted. See line 995:
PHP:
if( (my_maxmp() - my_mp()) >=my_level()*5 && (my_maxhp() - my_hp()) >= my_level()*5)


Then why does this only happen with this one character out of eight that I use?
 

Terrabull

Member
I am getting this strange error when I use the recovery script w/ the Slime Tube script. It had been working fine for days, but this is my first usage of the slime script since updating UR.
It halts execution too, very very odd. I have my recover % set to recover up to 90%, and start at 30%
Code:
Restoring HP! Currently at 700 of 1534 HP, 582 of 718 MP, current meat: 3262360 ... Target HP = 1381.
Putting on Brimstone Bracelet...
Equipment changed.
Casting Lasagna Bandages 27 times...
You gain 524 hit points
Lasagna Bandages was successfully cast.
Putting on malevolent medallion...
Equipment changed.
Putting on Brimstone Bracelet...
Equipment changed.
Casting Lasagna Bandages 1 times...
You gain 19 hit points
Lasagna Bandages was successfully cast.
Putting on malevolent medallion...
Equipment changed.
Putting on Brimstone Bracelet...
Equipment changed.
Casting Lasagna Bandages 1 times...
You gain 30 hit points
Lasagna Bandages was successfully cast.
Putting on malevolent medallion...
Equipment changed.
Putting on Brimstone Bracelet...
Equipment changed.
Casting Lasagna Bandages 1 times...
You gain 27 hit points
Lasagna Bandages was successfully cast.
Putting on malevolent medallion...
Equipment changed.
Putting on Brimstone Bracelet...
Equipment changed.
Casting Lasagna Bandages 1 times...
You gain 13 hit points
Lasagna Bandages was successfully cast.
Putting on malevolent medallion...
Equipment changed.
Did not fully restore HP for some reason.
 

heeheehee

Developer
Staff member
Brimstone bracelet gives -20% muscle, right? That might be it (max HP changing as it switches equips for cheaper casts).
 

Terrabull

Member
That could be, but I can't tell it "Don't use the brimstone bracelet." Figured there should be something to keep the script from eternally looping like this.
 

Bale

Minion
The code for that can sometimes get tricky I believe that the slime script directly calls for healing levels that might cause trouble with checking for cutoffs on not using the Brimstone Bracelet.

You can tell it "Don't use the brimstone bracelet." Preferences -> General -> "Allow equipment changing when casting buffs". Turn that off and you're safe. That's the best and easiest way to solve the problem.
 

Terrabull

Member
I also have a plexiglass pocketwatch too. Plus several other things it could use for cheaper casts. That would stop any of them from being used also. I meant I can't single the brimstone out.
 

lostcalpolydude

Developer
Staff member
Put it in your closet? Also, I thought mafia ignored that setting in aftercore anyway and refused to switch gear, unless UR is causing the gear switching in aftercore (as nice as this script sounds, I'm too paranoid to automate healing).
 

Liguinetta

New member
Updating recoveryScript_map_v2.txt from '' to '2009-11-19T03:48:59-06:00'...
recoveryScript_map_v2.txt => 2009-11-19T03:48:59-06:00
...recoveryScript_map_v2.txt updated.
Already updated from http://kolmafia.us/scripts/updateprices.php?action=getmap in this session.
sharePriceData => true
_meatpermp => 17.0
_meatperhp => 5.1
_version_BalesUniversalRecovery => 3.72
Map modified within foreach (Universal_recovery.ash, line 1449)
Autorecovery failed.


My turn to get this now. This was the first use of a new installation of the recovery script on a brand new hard drive.
Any ideas why?
 
Top