Universal Recovery Script

I had very good reasons for aborting healing if it gets within 95% of the target HP... after all, that could save a good bit of meat and normally it is perfectly acceptable. However, I clearly see your point. It would be good if 100% healing target was considered absolute in aftercore. I don't feel like making a full release right now, so the build I'm attaching to this post will consider 100% to be a special exception. This should solve your problem.

(When I get around to making a proper release it will include this modification.)
 

Attachments

Last edited:
I'm seeing a lot of stuff like this (in hardcore):

Code:
Purchasing black cherry soda (3 @ 80)...
You acquire black cherry soda (3)
Purchases complete.
Using 3 black cherry soda...
You gain 28 Mojo Points
Finished using 3 black cherry soda.
Putting on woven baling wire bracelets...
Equipment changed.
Casting Disco Nap 1 times...
You gain 20 hit points
Disco Nap was successfully cast.
Putting on Cape of the Goblin King...
Equipment changed.
Putting on woven baling wire bracelets...
Equipment changed.
Casting Disco Nap 3 times...
You gain 60 hit points
Disco Nap was successfully cast.
Putting on Cape of the Goblin King...
Equipment changed.
Putting on woven baling wire bracelets...
Equipment changed.
Casting Disco Nap 1 times...
You gain 20 hit points
Disco Nap was successfully cast.
Putting on Cape of the Goblin King...
Equipment changed.

Any chance this could be made more efficient?
 
Could you post more information please. Give me the full output, including the part at the top where it says how many HP/MP you have and what target it is healing to.

It also might help if you could put the script in verbose mode. That is a variable you have to manually change at the top of the script in the options section.
 
Is it possible to tell the script never to use tonic water? I had one in my inventory to create a drink, but needed a cocktail garnishing. So to get the PP for casting it, the script used the tonic...
 
Datafile Update!

Somehow I failed to include banana spritzers in my data. They are there now though I doubt my script will ever use such an expensive restorative in aftercore. Inside ronin... well, you wouldn't have it if you didn't want to use your bananas that way, but I can't imagine why you would. This is not exactly the most exciting addition ever.

Of more significance is that I've added recovery data for Wolfman Nardz. It restores an insane amount of MP, so they might even be useful for someone. If anyone still has them left over from Arrrborween and is in ronin/hardcore, then I'd suggest you closet them ASAP if you don't want them used. Of course, you need at least 300MP before my script will want to use them, but be careful. In aftercore where you're more likely to need 300MP restoration it won't use them unless they're the cheapest restorative.

The datafile will automatically update, so you don't need to download anything. This is purely for your information.
 
Last edited:
I realize I'm in a minority position here, but is there any way to indicate to the script that "mp is for healing"? I'm a disco bandit with no combat skills. The only things I can cast with my mp are disco nap, disco power nap, and smooth movement. Having it obsessively save all my mp is a bit frustrating. It would also be great if I could tell it not to try to keep combat mp restores on hand, as they're not really of any use to me.

Something that's either related to the above, or is a bug (or a known lack of feature) is that it can't seem to handle mixed mp/hp item restores. I had it use a magi-wipe when I was at full mp, then follow it up with a phonics down. I edited the code to make it just always heal with skills, but that's definitely a kludge. I know from unfortunate experience that Mafia has a similar weakness (it really likes using a magi-wipe to regen mana, and incidentally heal to full, then cast disco power nap on top of that). I tried universalrecovery in large part to avoid it, but here's verbose mode from the last time this script did it to me:

Restoring MP! Currently at 218 of 267 HP, 6 of 220 MP, current meat: 7501774 ... Target MP = 16.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 32.727272 meat total.
Trying to use 1 ancient Magi-Wipes
Using 1 ancient Magi-Wipes...
You gain 54 hit points
You gain 55 Mojo Points
Finished using 1 ancient Magi-Wipes.
Current HP: 267, MP: 61
My meat: 7501774. Should be successfully healed...
Casting Disco Nap 1 times...
You gain 20 hit points
Disco Nap was successfully cast.
Current HP: 267, MP: 53
My meat: 7501774. Should be successfully healed...

A much more minor request: the magi-wipe/phonics down incident occured while I thought I was in mallcore, but apparently wasn't. It wasn't until I read through all the code comments that I discovered that I had to have Mafia set to buy items in the mall in order to actually get the cost analysis in effect. It might be helpful to have that note somewhere closer to the top, to make it easier to spot.

Sorry for all the complaints; the idea of the script is wonderful, and I would very much like it to work for me. Kudos to you for putting so much effort into it!
 
1. I'll consider your position that mp is useless except for healing. What is it that you'd want it to do different aside from not saving/purchasing combat mp restoratives?

2. I'm not really sure what to make of your comment. The snippet you show me is clearly in mallmode despite you saying that it is not. You also say that you've modified my code. How can I know what is going on under such circumstances? Please clarify what is going on before I start hunting for a bug. It seems quite possible that the bug is something you introduced. I'm not even sure why it is restoring HP from 218 to 267. I suspect there might be another line about that above the snippet that you posted, but even that clue is missing. Do you really have it set to restore HP at 85% health?

3. Do you really think that I should have a warning that universal_recovery will obey mafia's preferences? That's just playing nice with your stated preferences. If you want to hack it to ignore mafia's preferences, look for a line like this one around line 89. Delete the part in red where it checks for mafia's preferences.

Code:
boolean mallcore = mall && can_interact()[COLOR="Red"] && get_property("autoSatisfyWithMall").to_boolean()[/COLOR];
 
Last edited:
1) Well, I'd like it to use my mp to cast heals, until I'm out of mp, and not deliberately restore mp unless it's cost/item-effective for more heals (or is below the mp restore setting in mafia, of course). This seems to be the way it works in mallmode, but in my (admittedly limited) experience, it doesn't seem to work that way in non-mallmode.

2) It most definitely is in mallmode for that quote (at least, it bought stuff from the mall on its own initiative). I wasn't clear before: the mentioned episode of "overhealing mp using a mixed restorative" occurred when I wasn't in mallmode, but the quoted episode of "overhealing hp using a mixed restorative" occurred just a few hours ago, when I was in mallmode. They may be totally unrelated quirks, for all I know.

I ran a diff against a fresh download of Universal_recovery, and found a change that I couldn't understand why I made, so I replaced my recovery script with the fresh download, and ran mafia until it happened again (and neat, I now have additional price information showing up):

Restoring HP! Currently at 147 of 246 HP, 18 of 221 MP, current meat: 7515656 ... Target HP = 222.
In mallmode, best HP restorative is: gauze garter @ 127.5 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 180.0 meat total.
Mall price to restore 24MP is 79 meat.
Cast a healing skill.
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Restoring MP! Currently at 187 of 246 HP, 6 of 221 MP, current meat: 7515656 ... Target MP = 12.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 19.636364 meat total.
Trying to use 1 ancient Magi-Wipes
Using 1 ancient Magi-Wipes...
You gain 56 hit points
You gain 51 Mojo Points
Finished using 1 ancient Magi-Wipes.
Current HP: 243, MP: 57
My meat: 7515656. Should be successfully healed...
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Current HP: 246, MP: 45
My meat: 7515656. Should be successfully healed...

This occurred directly after a mafia-directed combat. I do, in fact, have my health recovery set to recover up to 90%. I'm fighting in an area with monsters that can 3-shot me, and I'd rather heal out of combat than in combat. That magi-wipe would have been perfect, if it hadn't then tried to cast the heal.

3) Well, my initial assumption would be that obeying mafia's preferences would mean just not buying from the mall. I'm fine with buying the heal items myself; in fact, I prefer it. But having it use completely different logic instead was unexpected. If I had known there was normally a mallcore notification in the CLI, I'd have been suspicious much earlier, but to be honest, I didn't even remember that mafia setting until I saw the script comment. I'll definitely make the change you suggested, as it will behave exactly how I'd like it to.
 
Thank you for your patience. I believe I've found the bug responsible for that behavior. I'm now considering how best to fix it.

1) Well, I'd like it to use my mp to cast heals, until I'm out of mp, and not deliberately restore mp unless it's cost/item-effective for more heals (or is below the mp restore setting in mafia, of course). This seems to be the way it works in mallmode, but in my (admittedly limited) experience, it doesn't seem to work that way in non-mallmode.
I'm puzzled. If you want it to "not deliberately restore mp" shouldn't you just set your MP restoration to "Do not auto-recover mana"? Is this some other consideration? Also, why should cost effectiveness be relevant in ronin?
 
I'm puzzled. If you want it to "not deliberately restore mp" shouldn't you just set your MP restoration to "Do not auto-recover mana"? Is this some other consideration? Also, why should cost effectiveness be relevant in ronin?

The "not deliberately restore mp unless it's cost/item-effective for more heals" is just a side note about behavior I'd definitely not like to see. I definitely have "Do not auto-recover mana" set, and to be fair, I've never seen Universal_recovery use a straight-up mana recovery item on me. And the "item/cost efficiency" bit wasn't meant to indicate anything new; it was just an abbreviated way of saying "under the same constraints as currently exist." I just wanted to make sure I wasn't implying that Universal_recovery should *never* restore mp, just that it should only do so when it was cost effective (in mallmode) or item effective (in non-mallmode).

My experience in non-mallmode is that it didn't ever use mana to heal. It ate magi-wipes and phonics downs (as they were the only restores I had on hand) to restore my health, and ignored the fact that my mana had been full for a while. For example, I just switched to non-mallmode and got the following results:

Requests complete.

Restoring HP! Currently at 160 of 246 HP, 216 of 222 MP, current meat: 7599590 ... Target HP = 222.
Try to heal HP from inventory.
Using 1 sugar shard...
You gain 17 hit points
You gain 9 Mojo Points
Finished using 1 sugar shard.
Using 1 phonics down...
You acquire an effect: Tingly Wrists (duration: 5 Adventures)
You gain 46 hit points
You gain 46 Mojo Points
Finished using 1 phonics down.

Even if it has "keep mana as full as possible" as one of its goals, shouldn't it have cast a disco nap before using the sugar shard?
 
Even if it has "keep mana as full as possible" as one of its goals, shouldn't it have cast a disco nap before using the sugar shard?

I'd done a lot of stress testing of prior versions of this script, but I haven't been actively doing so for a while. While I leave mafia set not to buy from mall, I allow this script to buy from mall by adapting the line Bale suggested you adjust. I just have to make sure that I adjust that line for every release of the script Bale puts out.

I have access to a clan account DB who is in aftercore and farming currently, but she's sufficiently healing via her nurse's hat presently. The only time the script fires off is after changing from elite guard uniform back to farming gear due to the increase in HPs comparitively. An example of this from last night:

Code:
 > Restoring HP! Currently at 605 of 895 HP, 579 of 579 MP, current meat: 18836 ... Target HP = 895.
 > In mallmode, best HP restorative is: scroll of drastic healing @ 333.33334 meat total.
 > In mallmode, best MP restorative is: ancient Magi-Wipes @ 445.09088 meat total.
 > Mall price to restore 90MP is 279 meat.
 > Cast a healing skill.

cast 8 Tongue of the Walrus
You gain 285 hit points
 > Current HP: 890, MP: 499
 > My meat: 18836. Should be successfully healed...

In this case, it is more cost effective, in mallmode, to use the Tongue skill she has permed rather than buy/use items. I do not have the disco nap skills for her as yet. So it seems fine to me, in this example. I'll have to look more closely at what happens though since your earlier example seemed a bit unusual to me.
 
I realize I'm in a minority position here, but is there any way to indicate to the script that "mp is for healing"? I'm a disco bandit with no combat skills. The only things I can cast with my mp are disco nap, disco power nap, and smooth movement. Having it obsessively save all my mp is a bit frustrating. It would also be great if I could tell it not to try to keep combat mp restores on hand, as they're not really of any use to me.

No combat skills? I've always found Moxious Maneuver to be pretty useful. And depending on how close to the survivable edge you like to run, disco face stab can also have a place. I guess if you're a high level DB and have no need of these things you don't have much other use for your MP, but DB's can easily consume large amounts of MP.
 
No combat skills? I've always found Moxious Maneuver to be pretty useful. And depending on how close to the survivable edge you like to run, disco face stab can also have a place. I guess if you're a high level DB and have no need of these things you don't have much other use for your MP, but DB's can easily consume large amounts of MP.

I did say I realized I was an unusual case ;)

And while I've sometimes used Moxious Maneuver in boss fights, it usually seems easier to just outmoxie any regular mobs. Similarly, my meat-starvedness means that by the time I have enough meat to consider combat skills, I can just plink everything to death for free. It may not be the most efficient path, but it's definitely the path of least resistance.
 
Universal recovery v 3.43 released!


Changelog:
version 3.43 December 3, 2009
  • improvements to healing logic
  • bugfixes related to healing MP for casting recovery spells
  • additional configuration option to ignore mafia's purchasing preference


lanthala, thank you for reporting that bug regarding the overhealing of HP while attempting to heal MP so that a healing spell can be cast. In the process of fixing that I found a whole host of related problems that could potentially make people's healing less than optimal. I think I got them all.

I've also added a simple option at the beginning of the script to ignore mafia's preferences for not buying from the mall and/or NPC stores. Now you can just set ignore_buy_pref to TRUE and it will purchase anything that looks helpful. That's much nicer than having to hack the script. Does that make you happy, Spiny?

I haven't yet added any sort of MP for healing only mode. I'm not sure if I'll add that or not since it seems rather niche.
 
Last edited:
I've also added a simple option at the beginning of the script to ignore mafia's preferences for not buying from the mall and/or NPC stores. Now you can just set ignore_buy_pref to TRUE and it will purchase anything that looks helpful. That's much nicer than having to hack the script. Does that make you happy, Spiny?

Cool. I'll check it out :)
 
Thank you for the mall-buying configuration option!

I installed the v3.43, and restarted Mafia, but something strange seems to be happening. Now, instead of accidentally overhealing, it appears to be deliberately overhealing:

Restoring HP! Currently at 174 of 262 HP, 34 of 240 MP, current meat: 9138145 ... Target HP = 210.
In mallmode, best HP restorative is: filthy poultice @ 61.2 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 169.09091 meat total.
Mall price to restore 12MP is 34 meat.
Cast a healing skill.
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Current HP: 254, MP: 10
My meat: 9138145. Should be successfully healed...

The first disco power nap should have brought me to my target hp by itself. Here's what happens when I run out of mp:

Restoring HP! Currently at 130 of 263 HP, 43 of 241 MP, current meat: 9049939 ... Target HP = 224.
In mallmode, best HP restorative is: filthy poultice @ 159.8 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 169.09091 meat total.
Mall price to restore 36MP is 102 meat.
Cast a healing skill.
Casting Disco Power Nap 3 times...
You gain 120 hit points
Disco Power Nap was successfully cast.
Restoring MP! Currently at 250 of 263 HP, 7 of 241 MP, current meat: 9049939 ... Target MP = 36.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 81.72727 meat total.
Trying to use 1 ancient Magi-Wipes
Using 1 ancient Magi-Wipes...
You gain 59 hit points
You gain 59 Mojo Points
Finished using 1 ancient Magi-Wipes.
Current HP: 263, MP: 66
My meat: 9049939. Should be successfully healed...
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Current HP: 263, MP: 54
My meat: 9049939. Should be successfully healed...

I've tried varying my desired hp heal percentage, but it consistently heals me for one disco power nap over the target hp, no matter what that target is. Is there a setting somewhere that's confusing it? All I changed after downloading it was the new mall-buy setting, the verbose setting, and the number of antidotes to buy.
 
I'll admit I'm not entirely shocked that my fixes aren't perfect because of how much I had to do to fix those problems. It was a lot harder than it looked. However I'm having trouble figuring out why it is misbehaving in the way that it is so I made a couple of less than efficient, but probably effective fixes to solve the issue.

Please try out 3.431
 
Yay! 3.1341 appears to have solved the magi-wipe problem:

Restoring HP! Currently at 173 of 265 HP, 10 of 242 MP, current meat: 8922910 ... Target HP = 212.
In mallmode, best HP restorative is: filthy poultice @ 66.299995 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 163.63637 meat total.
Mall price to restore 12MP is 33 meat.
Cast a healing skill.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 5.4545455 meat total.
Trying to use 1 ancient Magi-Wipes
Using 1 ancient Magi-Wipes...
You gain 53 hit points
You gain 53 Mojo Points
Finished using 1 ancient Magi-Wipes.
Current HP: 226, MP: 63
My meat: 8922910. Should be successfully healed...

However, when the script doesn't use a magi-wipe, it's still overhealing by one disco power nap:

Restoring HP! Currently at 124 of 265 HP, 63 of 242 MP, current meat: 8922880 ... Target HP = 212.
In mallmode, best HP restorative is: filthy poultice @ 149.6 meat total.
In mallmode, best MP restorative is: ancient Magi-Wipes @ 163.63637 meat total.
Mall price to restore 36MP is 99 meat.
Cast a healing skill.
Casting Disco Power Nap 3 times...
You gain 120 hit points
Disco Power Nap was successfully cast.
Casting Disco Power Nap 1 times...
You gain 40 hit points
Disco Power Nap was successfully cast.
Current HP: 265, MP: 15
My meat: 8922880. Should be successfully healed...

This isn't that much of an issue for me personally; I've just dropped down my heal target by 40hp.
 
Oh crap. I found the problem. I'm so stupid. Uploading 3.432 in a moment.

Edit: Uploaded new version. This should work like a charm. Now mixed HP/MP restoration should be perfectly accounted for. If it isn't, I'll cry.


Universal recovery v 3.432 released!


Changelog:
version 3.432 December 3, 2009
  • Made my previous version work properly!
 
Last edited:
Back
Top