Universal Recovery Script

I've been manually setting the verbosity by editing the script like so:
Code:
#int Verbosity = get_property("baleUr_Verbosity").default_int(1);
int Verbosity = 3;
That way I know it's running with the verbosity, and once I replace the script with a new version, I don't need to change my properties again. Running with that one:
> ashq restore_hp(0)

Calling Universal Recovery 3.10.5.2 for type=HP, amount=0
Restoring HP! Currently at 35 of 303 HP, 16 of 16 MP, current meat: 53265 ... Target HP = 288.
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.
Recovery target reduced to healing trigger (196)to conserve meat.
Did not fully restore HP for some reason.

> inv brain

crappy brain (84)
good brain (8)
hunter brain
It's obviously this version, since it posts the version number on top. It's also obviously using Verbosity 3, since we see the "Trying to fullheal" message, which only shows at Verbosity 3. :(

Edit: It can obviously find the skills when manually prodded...
> ash import <Universal_Recovery.ash> populate_skills(100); find_cheapest_skill(100);

Returned: Bite Minion
level => 1
traincost => 0
class => Zombie Master
libram => false
passive => false
buff => false
combat => false
song => false
permable => false
dailylimit => -1
timescast => 109

> ash import <Universal_Recovery.ash> populate_skills(288); find_cheapest_skill(288);

Returned: Devour Minions
level => 6
traincost => 0
class => Zombie Master
libram => false
passive => false
buff => false
combat => true
song => false
permable => false
dailylimit => -1
timescast => 1

Spliced in a bit more logging, specifically this:
Code:
		if(Verbosity > 2) print("Need "+(skills[cheap_skill].mp * q)+" MP to cast that skill.");
			if(mp_heal(skills[cheap_skill].mp * q))
				old = old - 1; 	// mp restoration may have restored hp. Do another iteration and recalc
		}
		if(Verbosity > 2) print("Need "+(skills[cheap_skill].mp * q)+" MP to cast "+cheap_skill+" "+q+" times.");
		switch {
		case my_hp() >= target: 	// Success!
> ash restore_hp(0)

Calling Universal Recovery 3.10.5.2 for type=HP, amount=0
Restoring HP! Currently at 35 of 303 HP, 16 of 16 MP, current meat: 53265 ... Target HP = 288.
Trying to fullheal
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Need 4 MP to cast Devour Minions 1 times.
Need 4 MP to cast Devour Minions 1 times.
Last attempt to purchase HP with meat.
Recovery target reduced to healing trigger (196)to conserve meat.
Did not fully restore HP for some reason.
Returned: true
Not sure why it's failing to cast Devour Minions... on 11441. I can manually cast it, like so:
> cast devour minion

Casting Devour Minions 1 times...
Installing default certificate validation...
Validating login server (www.kingdomofloathing.com)...
726 players online.
Sending login request...
Synchronizing moon data...
You gain 151 hit points
Devour Minions was successfully cast.
After manually casting devour, restoration worked again...
> ash restore_hp(0)

Calling Universal Recovery 3.10.5.2 for type=HP, amount=0
Restoring HP! Currently at 186 of 303 HP, 12 of 12 MP, current meat: 53265 ... Target HP = 288.
Trying to fullheal
_meatperhp => 0.26666666666666666
Casting Bite Minion 1 times...
You gain 30 hit points
Bite Minion was successfully cast.
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Casting Bite Minion 2 times...
You gain 60 hit points
Bite Minion was successfully cast.
Need 2 MP to cast Bite Minion 2 times.
baleUr_HPtrouble => false
Returned: true
Looks like the problem happens when UR needs to use devour? Guess I'll let it run a bit more and see if I get back to fail-state. Since it's fully healed now...

Yep. Worked fine as long as it was using bite. But then...
> ash restore_hp(0)

Calling Universal Recovery 3.10.5.2 for type=HP, amount=0
Restoring HP! Currently at 42 of 303 HP, 16 of 16 MP, current meat: 53784 ... Target HP = 288.
Trying to fullheal
Try to heal HP from inventory.
Trying to fullheal
Try to heal HP with skills.
Need 4 MP to cast Devour Minions 1 times.
Need 4 MP to cast Devour Minions 1 times.
Last attempt to purchase HP with meat.
Recovery target reduced to healing trigger (196)to conserve meat.
Did not fully restore HP for some reason.
Returned: true

Maybe a mafia bug?
> my_hp

Returned: 42

> ash use_skill(1, $skill[devour minion])

Returned: true

> my_hp

Returned: 42

And... hackfix that works:
Code:
		return cli_execute("cast "+q+" "+it);
:) Replaces the use_skill in cast().
 
Last edited:
Thanks for starting the bug report. No wonder it made no sense to me. Devour Minion is just silently failing to do anything while returning true.
 
Thanks slyz!
Restoring HP! Currently at 98 of 270 HP, 12 of 12 MP, current meat: 50422 ... Target HP = 257.
_meatperhp => 0.2962962962962963
Casting Bite Minion 1 times...
You gain 27 hit points
Bite Minion was successfully cast.
_meatperhp => 0.23703703703703705
Casting Devour Minions 1 times...
You gain 135 hit points
Devour Minions was successfully cast.
Using mafia 11445 and the 1840 version of UR.
 
Something a little odd about the current UR:
Restoring HP! Currently at 136 of 393 HP, 13 of 13 MP, current meat: 89896 ... Target HP = 374.
Casting Bite Minion 1 times...
You gain 39 hit points
Bite Minion was successfully cast.
Using 1 red pixel potion...
You gain 105 hit points
Finished using 1 red pixel potion.
Using 1 red pixel potion...
You gain 115 hit points
Finished using 1 red pixel potion.
Specifically... red pixel potions are on the 'not allowed' list, because they're what I throw at the shadow. So the bug I'm reporting is, during zombiecore, UR (apparently) ignores your disallowed items/skills list.
 
This appears to be part of a larger pattern of neglect.


Universal recovery v 3.10.6 released!


Changelog:
version 3.10.6 September 5, 2012
  • Respect recovery settings to restrict item use when not in Mall Mode.


Download Universal Recovery v3.10.6 here: View attachment 6854
(Universal_Recovery.ash goes in the /scripts folder)​
 
Thanks. :) I did end up with JUST enough potions to beat the shadow, but I'd rather have a few spares in case I critically fail the combat. Less painful retrying.
 
I'm sure it's an error I'm making somehow, but I can't get Universal Recovery to work for me at all. I installed it because I'm doing the war in a BHY run, and there's pretty much no way to avoid losing tons of HP.

I configured it using the relay, and set it as my recovery script according to the first post, but it's not doing anything. Any help?

Once again. This is probably my fault. I know that.
 
I haven't used KoLmafia for a while and I'm guessing some update added specific items to the Use these restores section: in the HP/MP Usage tab. For some reason scroll of drastic healing wasn't checked in this list (although I did use them through UR in the past).

UR happily went on and kept buying (3) them but then failed to use them due to min(q, for_use(it)) on line 648 and get hpAutoRecoveryItems only included the scroll when it was checked. Should I make sure any other items are checked since this option wasn't available in the relay browser?
 
I'm sure it's an error I'm making somehow, but I can't get Universal Recovery to work for me at all. I installed it because I'm doing the war in a BHY run, and there's pretty much no way to avoid losing tons of HP.

I configured it using the relay, and set it as my recovery script according to the first post, but it's not doing anything. Any help?

Once again. This is probably my fault. I know that.

In the CLI, please type get recoveryScript and tell us what it says. Note that capitalization counts, so to avoid errors please copy/paste both the command, and mafia's response.

Then please verify the filename of the recovery script. Check your /scripts directory to find it. Ensure it matches the result of the previous question.


Should I make sure any other items are checked since this option wasn't available in the relay browser?

All options you need to check are in the relay script. Download that, put it in your /relay folder and then select it from the topmenu of the relay browser.
 
Last edited:
Maybe this has always been answered, but whenever I use the script outside of hardcore I run into this problem:

Validating adventure sequence...

The string "r31" is not an integer; returning 31 (zlib.ash, line 191)
The string "r37" is not an integer; returning 37 (zlib.ash, line 191)
Restoring MP! Currently at 848 of 852 HP, 30 of 214 MP, current meat: 32741068 ... Target MP = 193.
In mallmode, best MP restorative is: New Cloaca-Cola @ 1.0866666666666667 meat total.
Trying to use 2 New Cloaca-Cola
Searching for "six-pack of New Cloaca-Cola"...
Search complete.
Stopped purchasing six-pack of New Cloaca-Cola @ 34,999.
Using cached search results for six-pack of New Cloaca-Cola...
Stopped purchasing six-pack of New Cloaca-Cola @ 34,999.
You need 2 more six-pack of New Cloaca-Cola to continue.
Failed to use an item from the mall.

And this just repeats 15 or 16 times before it stops trying. I have 4k elven magipacks but it has this crazy obsession with the 6 packs. Thoughts?
 
Hehehe... known issue with New Cloaca-Cola. Closet all your cloaca-cola... broken as well as original six-packs, and it should stop failing.
 
Yeah... easiest thing to do is just remove these two lines:
Code:
	if(mallcore)  // This is only handled freely in mallcore mode
		heal[$item[six-pack of New Cloaca-Cola]] = new restorative_info(0, 0, 840, 960, 0.0, 900.0);
Those are the lines that tell UR that six-packs function just fine for creating Cloaca-Cola, but if it decides to use that it has to use the whole thing. Meh. You shouldn't miss having that gone. :)

Since I mentioned it elsewhere... a few lines that help UR do better with zombie-core.
Code:
string meatpermp() {
	switch {
	case my_class() == $class[Zombie Master]:
		return "100.0";
	case buy_mmj:
and
Code:
float meatperhp() {
	if(my_class() == $class[Zombie Master])
		return (100.0 / (my_maxhp() / 10));
	if(galaktik_cures_discounted() && contains_text(hpAutoRecoveryItems, "curative nostrum"))
The first makes it realize that you can get MP/horde for 100 meat, so value it there if you don't have anything better. Yes, if you don't have the skill, you can't do that... but we need to give it SOME value, and 100 is on the nicely high side in general. The second tells it that (if we had bite minion) we can heal 10% of health for 1 minion... 100 meat, for those of you following along at home. True, we could make it way more complicated and set it to no worse than 10 meat cost, since if you have <100 hp, it should still restore 10, but... eh, whatever. This works. :)
 
Maybe this has always been answered, but whenever I use the script outside of hardcore I run into this problem:



And this just repeats 15 or 16 times before it stops trying. I have 4k elven magipacks but it has this crazy obsession with the 6 packs. Thoughts?

On top of what Theraze said you also appear to have two version of zlib. At least that's the only script I know that use the "r<num>" versioning scheme and you got two different of that printing which is odd.
 
Nope... just that Arundel has a single old one. Since Zarqon clings tightly to his nonstandard numbering system, it compares both your current (r31) and his latest (r37) versions together, so you get two errors... once per integer conversion. :) If he ever went to a non-mixed system, it would have only had a single error (r31) and the current version (38) would just flow invisibly. :)
 
Ah, an entire 300 adventures at the generator without 7 schizophrenic red flashes. Deleting the lines worked. Thank you all!
 
So for the longest time I have wished I could figure out what was automatically setting my MP threshold to zero. At first I thought it was NewLife. Then maybe BCCAscend, but now I think it is UR. I have a highly skilled ascending character. Just because I am a muscle class does not mean that I don't want MP for buffs and the occasional combat spell. When I start as a low level character with meat problems and no access to the Myst Store I believe UR tries to recover MP as requested but eventually fails because there is not enough meat. My hypothesis is that after several such failures, UR decides to stop trying to restore MP with meat and as a consequence or side-effect the settings get changed. If this hypothesis is correct are there settings I should consider checking or changing to keep this from happening? If it is not a correct hypothesis, are there any suggestions for other places to look? Thanks.
 
If I remember correctly newLife does set MP-restoration to 0 (it won't show in the interface until you log out and back in again though). I don't think UR chanegs anything unless you use the relay-script to change it.
 
Back
Top