Universal Recovery Script

I believe that is the bug I fixed in 2.45 that only crops up if you have no healing skills. Are you using version 2.45? Do you have healing skills?

yes, i'm using version 2.45 and no i have no healing skills.
level 23 Sauceror, no healing skills permed
 
Last edited:
I believe that is the bug I fixed in 2.45 that only crops up if you have no healing skills. Are you using version 2.45? Do you have healing skills?

I'm sorry, but I don't understand your question. What integers are being set?

Oh, that is not a good question! I wonder if there is something else asking me, but when I run this script, I get 2 pop-up windows.

The first says Please input a value for string type

The second says Please input a value for int amount

This is the only script I am running on this machine.

Thanks!
 
Oh. I see your problem now. Please don't run the script that way--it's not a good idea. Mafia knows how to run this script automatically, if you set it up properly. To use this script, put Universal_recovery.ash in the /script directory and put recoveryScript_map.txt in the /data directory. Then in the gCLI type:
set recoveryScript = Universal_recovery

After you do that it mafia will automatically recover according to these options:
recovery_options.png


If you really want to run the script manually you can activate it with the restore command with the parameters hp, mp, or both. That will cause it to recover up to your chosen restoration target or +1 if you are already at your restoration target.

If you want greater control over how many hp, mp you receive in cli you can use the commands ash restore_mp(x) and ash restore_hp(x) where x is the target for restoration.
 
Hey Bale, thanks again for all your hard work on this... It looks like I somehow stumbled across another division by zero issue.

Code:
> restore hp

Finished using 1 palm-frond fan.
Visiting Doc Galaktik...

Restore 33 HP at Doc Galaktik's
Current HP: 49, current MP: 40... restoring HP! Target = 92
Current HP: 49, current MP: 40... restoring MP! Target = 80
Using 3 Knob Goblin seltzer...
You gain 33 hit points
Cure purchased.
You gain 30 Mojo Points
Finished using 3 Knob Goblin seltzer.
Purchasing black cherry soda (2 @ 80)...
You acquire black cherry soda (2)
Purchases complete.
Using 2 black cherry soda...
You gain 20 Mojo Points
Finished using 2 black cherry soda.
You don't have a skill matching "1 none"
Division by zero (Universal_recovery.ash, line 673)
Autorecovery failed.

Let me know if you need any more info, and I'll do my best to hunt down anything you need to help pinpoint and reproduce it.
 
Sorry about the delay, i'm now in kittycore, but i had the restore MP issue again. Here is the output from the CLI:

---------------------------------------------------------------

Current HP: 21, current MP: 4... restoring HP! Target = 47
Current HP: 21, current MP: 4... restoring MP! Target = 40
Visiting Doc Galaktik...

Restore 36 MP at Doc Galaktik's
You gain 36 Mojo Points
Cure purchased.
Casting Disco Nap 1 times...
You gain 20 hit points
Disco Nap was successfully cast.
Current HP: 41, current MP: 32... restoring MP! Target = 40
Visiting Doc Galaktik...

Restore 6 MP at Doc Galaktik's
You gain 6 Mojo Points
Cure purchased.
Insufficient meat to fully restore MP without wasting restoratives!

---------------------------------------------------------------
my settings:

Auto-recover HP at 50%
Try to recover up to 90%

Do not auto recover MP
Try to recover up to 0% (although this also happened with other values)

It started the healing process when i had 21/52 HP and 2/42 MP, and it ended with 41/52 HP and 38/42 MP

(i also had 16 meat left at the end, but that is not important i guess)

I'm OK with the script healing only up to 41 (that's kinda why I left it at 'recover up to 90%), but i guess that the fact that it tries to restore MP even after healing when MP is not to be recovered isn't the correct behavior. There also was enough MP left to heal another 20 HP in this case.

I hope this helps, please ask any other information you might need.
 
I've been off ash programming for a while, but I intend to get back to updating URS soon and I'll try to attend to these bugs.
 
I love this script! Thanks again for putting all this effort into making such a wonderful script. I found a few typo/bugs at line 195, 209, and 517 here is the code:
PHP:
if(type="HP") {
...
}
I was getting errors saying "Expected ), found = (Universal_recovery.ash, line 195)"
so I changed it to:
PHP:
if(type=="HP") {
...
}
and we are back in the money/meat!

Thanks again!
 
Please do so. An update to kolmafia made it so that = is no longer the same as == in a boolean expression.
 
Last edited:
Universal recovery v 2.5 released!

This update requires that the user download a new data file!
Please download recoveryScript_map_v2.txt and place it in your /data directory.

Changelog:
version 2.5 April 21, 2009
  • Fixed compatibility with KolMafia revision 7185
  • Lots of bugfixes
  • Removed vestigial maps left from before switch was implemented, to increase speed
  • Updated mapfile to speed up processing speed by pre-calculating average healing
  • Some improvements to recovery logic
  • Allow a small amount of wastage to save meat costs
 
Mallcore Mode: It will even balance the cost of restoring 20MP to cast Cannelloni Cocoon vs the cost of a scroll of drastic healing (and other HP healing items)

Hi, I've been trying out the script and enjoying it. Just some feedback about scroll of drastic healing vs. Cocoon:

I've been basementing in aftercore. The script has never cast Cocoon, preferring every time to purchase a scroll of drastic healing for ~210. (Not sure if the script takes into account that the scroll is re-usable ~1/3 of the time, which reduces its effective cost to about ~140).

It may well cost more than 140 to restore exactly the 20 MP that Cocoon would cost. But I've been doing bulk MP restores (for Festering Powder tests) at a cost of about 3 meat/MP. So the actual "cost" of those 20 MP is ~60 meat.

Put it another way, I could buy a carbonated water lily or Magi-wipes for ~185 -- less than a scroll of drastic healing -- and restore 50 or 60 MP.

Not a complaint, just a data point FYI...

-----

BTW, my "HP/MP Usage" settings are:

Auto-recover health at 40%
Try to recover up to 95% health
Recast buffs until 90%
Do not auto-recover mana
Try to recover up to 10% mana
Use these restores: Cannelloni Cocoon IS checked
Character is L27 (although max HP and max MP vary due to changing buffs)


-Th3Y thank you...
 
Last edited:
It may well cost more than 140 to restore exactly the 20 MP that Cocoon would cost. But I've been doing bulk MP restores (for Festering Powder tests) at a cost of about 3 meat/MP. So the actual "cost" of those 20 MP is ~60 meat.
That's an interesting point. I'm going to have to consider how that idea should be implemented... Perhaps a boolean flag in the script for always_cocoon?

Put it another way, I could buy a carbonated water lily or Magi-wipes for ~185 -- less than a scroll of drastic healing -- and restore 50 or 60 MP.
I may have to look at that code. I admit I don't do a lot of aftercore testing.
 
That's an interesting point. I'm going to have to consider how that idea should be implemented... Perhaps a boolean flag in the script for always_cocoon?

One idea that comes to mind would be to maintain a "bulk MP cost" variable as follows: simulate what it *would* cost to restore a substantial portion of max MP (50%, 90%, 100%, whatever), and use that rate as the cost-per-MP that you use when comparing the cost of casting a healing spell.

-----------

A separate comment: one of my bulk MP restores triggered a purchase of 156 Nardz energy potions to restore 9346 MP. That's cool, but the initial Nardz cost 195 each while the price of subsequent ones gradually increased up to 999 each because the large-quantity purchase bought out all the lowest-cost offerings. If you want to avoid that sort of price creep, consider purchasing no more than, say, 10 of any one item at once, then use those, then recursively recalculate a new restore of the remaining HP or MP (since some other item may now be more price-efficient). Again, not a complaint, just a data point FYI...


-Th3y thank you
 
Universal recovery v 2.51 released!

Fixed a rather unpleasant little bug that I introduced in this version which prevents mp from being restored. I was trying to improve something, but it didn't work out and I only half-removed my improvement. Oops!
 
One idea that comes to mind would be to maintain a "bulk MP cost" variable as follows: simulate what it *would* cost to restore a substantial portion of max MP (50%, 90%, 100%, whatever), and use that rate as the cost-per-MP that you use when comparing the cost of casting a healing spell.
That's an extremely interesting suggestion. I'm going to have to figure out the best way of doing this for version 2.6

If you want to avoid that sort of price creep, consider purchasing no more than, say, 10 of any one item at once, then use those, then recursively recalculate a new restore of the remaining HP or MP (since some other item may now be more price-efficient).
Just added this suggestion into my script. You'll get the improvement in my next release.

Please keep making suggestions for mallcore mode. My lack of time in aftercore has doubtlessly kept me from figuring out some of how it should work.
 
Universal recovery v 2.6 released!

Changelog:
version 2.6 April 23, 2009
  • Mallcore Mode improvements
  • Improved handling of mummy wrapping, Palm frond and six-pack of New Cloaca-Cola
  • Faster
  • Bugfixes involving skill use

Th3y made me do it! Thanks to inspiration th3y provided I found myself feverishly working on making mallcore mode actually work. I also added some speed enhancements while I was at it. I really appreciated the feedback since th3y taught me some important lessons in aftercore thinking. Unfortunately I spend so little time in aftercore that I feel the mallcore part of the script is its weakest link.

Once again, please provide me some feedback about how it works so that I can continue to improve.
 
Does this script use the massage from the nuns for recovery?

It just recovered MP for me via the nuns, so the answer is yes.

Feedback: Personally, I would prefer for the nuns to be one of the methods for which the script consults the "use these restores" checkboxes (i.e. don't use nuns if "visit the nuns" is not checked)...

-Th3Y thank you
 
Last edited:
Universal recovery v 2.6 released!

Report from the field: under 2.6 "mallcore" the script now uses Cannelloni Cocoon for me rather than buying scrolls of drastic healing.

Also, a large MP restore was accomplished piece-wise by buying 10 carbonated water lily at a time. I was curious to see whether price creep would cause the script to switch to a different item mid-stream, but the price only went up by a few meat by the end of the purchases so that wasn't really tested.

-Th3y thank you
 
Last edited:
Feedback: Personally, I would prefer for the nuns to be one of the methods for which the script consults the "use these restores" checkboxes (i.e. don't use nuns if "visit the nuns" is not checked)...
That's actually on my "to do" list. I just haven't gotten to it since it's comparatively boring. ;) However, hearing that someone really wants it gives me more incentive.

Report from the field: under 2.6 "mallcore" the script now uses Cannelloni Cocoon for me rather than buying scrolls of drastic healing.
YAY! Success. That's a direct result of your suggestion for how to do a better computation of the meat value for MP. Thanks.

Also, a large MP restore was accomplished piece-wise by buying 10 carbonated water lily at a time. I was curious to see whether price creep would cause the script to switch to a different item mid-stream, but the price only went up by a few meat by the end of the purchases so that wasn't really tested.
Shame that it didn't replicate the Nardz experience so we could see some action, but theoretically it should switch mid-stream. I did some testing to make sure that my script will be using the updated price (even if it hasn't yet bought an item at the updated price), but testing isn't the same as proof. Please keep me updated as you get more data points.
 
Last edited:
Back
Top