Universal Recovery Script

That could be a lot of server hits. I would rather closet some meat here or there just to make sure I have some stashed away in case I need it.

What could be a lot of hits? The wrapper would add two hits to whatever else was being done - one to closet meat and one to un-closet meat. Unless you intend to run the wrapped function "a lot" I'm not sure how you count "a lot" of hits so it would be useful to know what I am mis-counting.
 
If you use a UR wrapper, and mafia runs UR 2 times per adventure (possibly more, depending on if you've put it into your BBS and ABS due to item usage fights), that's potentially 12 (2 (hp/mp) * 3 (BBS, automatic, ABS) * 2 (closet/uncloset)) extra server hits per adventure. Bad.
 
Code:
int spendable_meat() {
  if (get_property("scriptsIgnoreThisMeat").to_int() > 0)
    return my_meat() - get_property("scriptsIgnoreThisMeat").to_int();
return my_meat();
}

Replace all calls to my_meat() with spendable_meat() in any script you want to play nice with this setting, and then set the custom mafia property "scriptsIgnoreThisMeat" to the value of meat that scripts should pretend you don't have?

(Note: code is top-of-my-head at work, can probably be simplified)
 
I'd probably have the first check look for get_property != "" and then always do my_meat - to_int. Since you're getting the same warning regardless...
> ash get_property("scriptsIgnoreThisMeat").to_int()

Returned: 0

> ash "scriptsIgnoreThisMeat".to_int()

The string "scriptsIgnoreThisMeat" is not an integer; returning 0 ()
Returned: 0
Basically, you're either doing my_meat() - 0 or my_meat() - sITM. Could actually make it a bit more efficient by defining sITM as an int and only checking it once... something like
Code:
int spendable_meat() {
  int sITM = get_property("scriptsIgnoreThisMeat").to_int();
  return my_meat() - sITM;
}
 
You're all making a good argument for why meat conservation is a worthwhile feature to add to UR so that all the closeting can be avoided. However it would be troublesome, fiddly and annoying to implement and it I won't actually use the feature... so I won't do it. You're gonna have to keep using the closeting workaround and KoL will have to deal with the extra server hits. I regret that, but it would be too darn boring to fix.
 
I just noticed I could use Lure Minion to get rid of junk brains...and I didn't run into a meat problem getting minions so I'm not too worried about the save meat setting.



However, I am now getting this message if I have Universal Recovery enabled:

Code:
Did not fully restore MP for some reason.

This happens before it will let me adventure, in HC Zombie Master. I have my MP set to not recover, exited mafia and went back in and still get the same message (using build 11440 and latest recovery).
 
Sorry about that bug. It was because of a round-off error. I've fixed the problem in the latest version.


Universal recovery v 3.10.4 released!



Changelog:
version 3.10.4 August 29, 2012
  • Make good use of extremely powerful healing items like Camp Scout Pup Tents
  • Fix for not always recognizing that restoration is set to not recover.
  • Zombiecore: Use "Lure Minion" to trade brains for horde


Download Universal Recovery v3.10.4 here: View attachment 6825
(Universal_Recovery.ash goes in the /scripts folder)​



I just noticed I could use Lure Minion to get rid of junk brains...and I didn't run into a meat problem getting minions so I'm not too worried about the save meat setting.

Starting with this version, Lure Minion will be used to trade in junk brains. It will always conserve enough brains to fill the rest of your stomach today plus half of what you'll need for tomorrow. (If you have a stomach of 20 and you've eaten 16 brains, it will retain 14 brains for your personal use.) It starts by trading in lower quality brains first.
 
Starting with this version, Lure Minion will be used to trade in junk brains. It will always conserve enough brains to fill the rest of your stomach today plus half of what you'll need for tomorrow. (If you have a stomach of 20 and you've eaten 16 brains, it will retain 14 brains for your personal use.) It starts by trading in lower quality brains first.

That sounds like a great idea to me. I think that'll be enough to make sure you can fill your stomach each day. Thanks for the awesome script!
 
I appreciate the feedback. I'm a little nervous that people will not want this script to do that, but some people don't want it to control spending their meat either, so.... Oy.
 
Restoring HP! Currently at 53 of 284 HP, 25 of 25 MP, current meat: 48630 ... Target HP = 270.
You need 1 more Camp Scout pup tent to continue.

Not sure why it's trying to use non-available items in hardcore...
 
Universal recovery v 3.10.5 released!



Changelog:
version 3.10.5 August 30, 2012
  • Fixed a bug that would sometimes keep the script from checking your inventory when you are under 20% health.


Download Universal Recovery v3.10.5 here: View attachment 6827
(Universal_Recovery.ash goes in the /scripts folder)​
 
Okay... this version doesn't use impossible pup tents anymore (Yay!), but...
Restoring HP! Currently at 18 of 303 HP, 24 of 24 MP, current meat: 52828 ... Target HP = 288.
Recovery target reduced to healing trigger (196)to conserve meat.
Did not fully restore HP for some reason.
I have 52k meat and 83 crappy brains. Instead it went into combat with 18 hp.
 
> skill

Uncategorized
CLEESH
Stomach of Steel

Zombie Master
Bilious Burst
Bite Minion
Devour Minions
Distracting Minion
Elemental Obliviousness
Flesh Mob
Hunter's Sprint
Indefatigable
Infectious Bite
Insatiable Hunger
Lure Minions
Neurogourmet
Plague Claws
Recruit Zombie
Skullcracker
Summon Minion
Undying Greed
Unyielding Flesh
Vigor Mortis
Virulence

> inv brain

crappy brain (84)
good brain (8)
hunter brain

> my_meat

Returned: 53265
 
Verbosity 3:
> ashq restore_hp(0)

Calling Universal Recovery 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.
 
Well that was spectacularly unhelpful. I'm attaching a new build to this post. Hopefully that will be super verbose enough to troubleshoot the problem.
 
Last edited:
Unfortunately, result looks exactly the same to me...
> ashq restore_hp(0)

Calling Universal Recovery 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.
16 horde currently, btw. If that matters. Restoration settings are that every time it gets down to 10, restore to 30.
 
Now you're freaking me out. Are you sure you don't have two different copies of Universal_recovery in your directory of scripts?

Try the special build attached to this post. Then type the following commands into CLI

inv brain
get baleUr_Verbosity
 
Last edited:
Back
Top