Universal Recovery Script

While I'm happy that it fixed itself, I'm regretful that you weren't able to duplicate it with "Super Verbose".
 
Love the script.

When considering HP restore, could it take into account whether MP will need to be restored after casting?

I am adventuring in hobopolis, getting hit and then using tongue of the walrus, followed by ancient Magi wipes.

The magi wipes restore MP well, but the side effect of restoring HP about equal to the amount I needed restored in the first place makes me wonder.

I am guessing this is due to the weighting of HP/meat and MP/meat values.

A borderline case, of course, as I will soon be perming cocoon.
 
Actually, it has nothing to do with weighting. The problem is that mafia calls UR to heal HP. Then mafia calls UR to heal MP. These calls are entirely separate and I deal with them separately. It has never really seemed worth the trouble to predict mafia's next MP call to UR during the HP call and figure the best way to deal with them together, since the cost of HP is so much less than MP and it is only really a problem once you have access to the mall. It's a big problem to fix that small problem.

It does seem odd that it would choose to restore a lot of HP with tongue instead of using scrolls of drastic healing. That's just Weird! Do you have very little HP? This troubles me.
 
For some reason during my HC ascension this script begins to hang once I start getting drops from the pyramid.
It seems to have trouble with really thick bandage checked as a hp restorer.
If I only have one mummy wrapping then it hangs at "Try to heal HP from inventory."
If I have 2 then it uses them but still hangs after using them.

Code:
Calling Universal Recovery for type=HP, amount=0
Restoring HP! Currently at 201 of 417 HP, 78 of 95 MP, current meat: 8869 ... Target HP = 376.
Trying to fullheal
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Try to heal HP from inventory.
Using 2 mummy wrapping...
You acquire an item: really thick bandage
Finished using 2 mummy wrapping.
Using 1 really thick bandage...
You gain 117 hit points
Finished using 1 really thick bandage.
Odd, Hanging the script by manually typing "restore hp" in the cli:
Code:
Calling Universal Recovery for type=HP, amount=380
Restoring HP! Currently at 379 of 417 HP, 59 of 95 MP, current meat: 8452 ... Target HP = 380.
Try to heal HP from inventory.
 
Last edited:
I have to confess cluelessness. I cannot imagine why it would hang at a time like that. People have just started to report this in the last two weeks, so I cannot help wondering if it is some recent change to mafia causing a problem, but I just do not know.

This ONLY happens with really thick bandages? Maybe I can find a clue there if I keep looking.

Thanks for turning up verbosity to max.
 
I just read back a few pages, looks like everyone is complaining about items dropped from the macguffin quest.
Magi-wipes and palm fronds may also be possible culprits since I also have them checked as restorers.
In this example it appears that the thick bandage is causing the issue.
 
An infinite loop can happen in inv_hp_restore() with mummy wrapping and palm fronds: if inv_quant() returns 1, use_inv() is called but does nothing. If there aren't any other options to try in the inv_hp_restore() loop, it will keep trying with no result.

One solution would be to update the options in inv_hp_restore(), on line 1053:
PHP:
repeat {
	done = true;
	clear(options);
	options = choose_inventory("HP");
	for i from 0 upto count(options)-1 {
		q = inv_quant(options[i], target- my_hp(), "HP");
		if(q>0) {
			use_inv(q, options[i]);
			if(my_hp() >= target) return true;
			done = false;
		}
	}
} until(done);

A simpler solution would be to add this to inv_quant(), on line 405:
PHP:
if( (it == $item[Palm frond] || it == $item[mummy wrapping]) && quantity == 1 )
	return 0;

Another detail: I think choose_inventory() can let through cases where using palm fronds or mummy wrappings would wast too much HP... 2 * value.maxhp should be checked for those instead of value.maxhp on line 811:
PHP:
case $item[Palm frond]: // Only use these if there is at least 2.
case $item[mummy wrapping]:
	if(item_amount(key)>1 && 2 * value.maxhp *.90 <= max_heal)
		options[count(options)] = key;
	break;
 
WTF? I appreciate the troubleshooting, but that case should be handled in for_use() where if q = 1, it returns 0 for those items.

inv_quant then returns min(quantity, for_use(it)) which would be 0.

Edit: OH WAIT! I see! If it actually only needs half a thick bandage, but has more than 1 mummy wrapping, it returns 1 and LIKES IT! There's the potential for it to get stuck on 3,5, etc also so I'll add a modulus check at line 405.

Code:
if((it == $item[Palm frond] || it == $item[mummy wrapping]) && quantity %2 == 1 ) 
   quantity = quantity - 1;
Thanks LOTS!
 
Last edited:
Universal recovery v 3.71 released!


Changelog:
Universal Recovery version 3.7 June 30, 2010
& relay UI version 1.12
  • Improved logic to save meat on Doc Galaktik by skimping on healing if unnecessary.
  • Fixed possible infinite loop for Palm fronds and mummy wrappings.
  • Small tweaks to User Interface for relay browser.
 
Last edited:
It does seem odd that it would choose to restore a lot of HP with tongue instead of using scrolls of drastic healing. That's just Weird! Do you have very little HP? This troubles me.

Rather odd, it was casting tongue of the walrus about 30 times to restore HP, I had between 800 and 1200 HP while running the script.
 
Rather odd, it was casting tongue of the walrus about 30 times to restore HP, I had between 800 and 1200 HP while running the script.
Did you configure it to use scrolls, either through Mafia's HP/MP Usage configuration or through UR's relay browser interface?
 
Did you configure it to use scrolls, either through Mafia's HP/MP Usage configuration or through UR's relay browser interface?

It shouldn't matter. In mallmode there is no way to stop it from using scrolls, other than to tell it not to purchase stuff from the mall. Did he have mall purchase turned off?
 
At this point, the script doesn't accommodate for when one is wearing gear that regens hp or mp right? I'm asking because the script overused a magi-wipes for all of 2mp in aftercore. Tonic and Nostrum are enabled in the options. It's not a big deal, but it was puzzling.

Code:
Restoring HP! Currently at 119 of 321 HP, 99 of 202 MP, current meat: 177606 ... Target HP = 321.
In mallmode, best HP restorative is: filthy poultice @ 343.4 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 145.45454 meat total.
Mall price to restore 48MP is 140 meat.
Cast a healing skill.
Casting Tongue of the Walrus 5 times...
You gain 185 hit points
Tongue of the Walrus was successfully cast.
Current HP: 304, MP: 49
In mallmode, best HP restorative is: filthy poultice @ 28.9 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 145.45454 meat total.
Mall price to restore 8MP is 24 meat.
Cast a healing skill.
Casting Tongue of the Walrus 1 times...
You gain 39 hit points
Tongue of the Walrus was successfully cast.
Current HP: 321, MP: 39
My meat: 177606. Should be successfully healed...
Restoring MP! Currently at 321 of 321 HP, 39 of 202 MP, current meat: 177606 ... Target MP = 202.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 474.18182 meat total.
Trying to use 3 ancient Magi-Wipes
Searching for "ancient magi-wipes"...
Purchasing ancient Magi-Wipes (2 @ 150)...
You acquire ancient Magi-Wipes (2)
Purchases complete.
Using 3 ancient Magi-Wipes...
You gain 161 hit points
You gain 161 Muscularity Points
Finished using 3 ancient Magi-Wipes.
Current HP: 321, MP: 200
In mallmode, best MP restorative is: ancient Magi-Wipes @ 5.4545455 meat total.
_meatpermp => 2.7272727
Trying to use 1 ancient Magi-Wipes
Searching for "ancient magi-wipes"...
Purchasing ancient Magi-Wipes (1 @ 150)...
You acquire an item: ancient Magi-Wipes
Purchases complete.
Using 1 ancient Magi-Wipes...
You gain 54 hit points
You gain 57 Muscularity Points
Finished using 1 ancient Magi-Wipes.
Current HP: 321, MP: 202
My meat: 177156. Should be successfully healed...

I'm currently equipped with snailmail hauberk and heart of the volcano as far as regen is concerned:

Code:
> modtrace regen

source HP Regen Max MP Regen Min HP Regen Min MP Regen Max
snailmail hauberk +14.00 =*14.0 +6.00 =*6.0 +6.00 =*6.0 +14.00 =*14.0
heart of the volcano +20.00 =*34.0 +2.00 =*8.0 +10.00 =*16.0 +5.00 =*19.0

Edit: Looks like it only did this once anyhow.
 
Last edited:
The script does not consider that you may be recovering hp/mp while adventuring and it should not do so. Mafia tells it that it needs X Hp or Y MP right now and it obeys the order. I think that's the best way for it to behave.

The correct action is for you to turn down your MP restoration from max to only 90% or so, to make use of your in-combat regeneration. That's a decision for the player to make.
 
The script does not consider that you may be recovering hp/mp while adventuring and it should not do so. Mafia tells it that it needs X Hp or Y MP right now and it obeys the order. I think that's the best way for it to behave.

The correct action is for you to turn down your MP restoration from max to only 90% or so, to make use of your in-combat regeneration. That's a decision for the player to make.

I've always wondered why people would set things below max restoration level... I think you may have given me insight ;) Thanks!
 
I've always wondered why people would set things below max restoration level... I think you may have given me insight ;) Thanks!
I almost never need 100% and so I set a lower target under the presumption that it is somewhat more efficient in some ill defined sense. What is interesting is the way that the lower bound has actually become a parameter adjusted during play. I don't want to spend anything I don't have to, but sometimes if I auto-adventure with the setting too low, I get beaten up. But the implications of 25% when you are at 10 HP are much different than 25% at 200 HP so tweaking is in order.
 
Mallmode on, it was buying magi wipes.

And Scroll of drastic healing was enabled, as was everything that could be reasonably used without a cost of adventures or full.

I don't suppose it had anything to do with having tongue permed?

It wasn't due to beaten up or other negative status effects either.
 
Operator error, I'm sure, but...
Accordion thief, Bad Moon. latest version of UR according to the zlib check, local build of mafia from source. Currently have 88 max HP. Mafia and UR settings to auto recover health at 50% and try to recover to 100%. I am expecting that any time my HP is 43 or less, UR will try and recover up to 88. However what I am seeing is that UR is satisfied with 44. Since it is using Doc G. for healing and there is 1,000+ meat on hand, it should not have a problem buying up to 88. Using the much appreciated relay override script I press the button to Update and restore HP with Super verbose and I get
baleUr_Verbosity => 3
Calling Universal Recovery for type=HP, amount=0
Restoring HP! Currently at 44 of 88 HP, 78 of 93 MP, current meat: 1798 ... Target HP = 88.
Trying to fullheal
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Last attempt to purchase HP with meat.
when my HP is exactly 44.

Later that same session, once my max HP is at 89 and I get reduced to 44 HP
Calling Universal Recovery for type=HP, amount=0
Restoring HP! Currently at 44 of 89 HP, 78 of 94 MP, current meat: 2355 ... Target HP = 89.
Trying to fullheal
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Last attempt to purchase HP with meat.
Calling Universal Recovery for type=MP, amount=0
Calling Universal Recovery for type=HP, amount=0
Restoring HP! Currently at 44 of 89 HP, 78 of 94 MP, current meat: 2355 ... Target HP = 89.
Trying to fullheal
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Last attempt to purchase HP with meat.
In the above, I'm not sure what was generated by pushing the button and what was part of the recovery after the last adventure.

UR is definitely allowed to access Doc G.

Thoughts?
 
Thoughts?

Pretty sure that was the situation for me back on post 819. Bale was puzzled and thinking about it. Not sure if any changes were implemented to address it. I know several UR versions ago, I'd easily go broke while UR merrily purchased Galaktiks and that was frustrating. I much prefer the current "not heal me" as opposed to "go broke on inefficient options." Ailment ointments would have been more appropriate than on tap Galaktiks at the time. I do my in-run adventuring manually in the relay browser. I tend to call UR manually as well. I've steered more and more toward manual restoration, but when I'm really low on hp and mp I call the script to do my math for me. I definitely give the script free reign while automating stuff in aftercore which is where the script shines for me the most.
 
Well I discovered the "problem" because automation was failing. Basically I would set the recovery options because I knew I couldn't survive starting out at half health. However the effect was that I would get restored to half health and then get beaten up. At that point I have two bad choices - keep getting beaten up or use a mood to abort. Regardless, if I understood what I was doing, UR did not do what I told it to. I contrast that to mafia's auto healing where it will do what is asked. Now I don't care whether Bale sees this as a problem, but I certainly would reconsider my use of UR as long as it appears to be doing something other than what I asked and it is not explained why.

We have actually touched on this in other posts. My perfect UR script would always recover and that would trump efficiency. If it failed it would be because I lacked meat or items and not because it didn't want to use a tiny house because there was no need to restore both HP and MP. UR at the moment places a higher premium on efficiency than I do. That's fine but it does make me reconsider whether UR is really something I want when a secondary goal is hands off automation.
 
Back
Top