Universal Recovery Script

What does this script do in terms of keeping items to fight the shadow, if at all? Do I need to put the items I want to use for the shadow in the closet?

I was very surprised when it used a red potion, and then realized that I had funkslinging and four gauze garters, so there was really no problem. Oh, I might have even had a scented massage oil.
 
What does this script do in terms of keeping items to fight the shadow, if at all? Do I need to put the items I want to use for the shadow in the closet?

I was very surprised when it used a red potion, and then realized that I had funkslinging and four gauze garters, so there was really no problem. Oh, I might have even had a scented massage oil.

If you don't have funkslinging it will conserve 4 red potions for you. If you do have funkslinging it will save a total of 5 gauze garters and filthy poultices instead. No worries about the closet.
 
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.
Just want to state here that I would love to see the nuns preference checked as well as the pixel potion preferences (all 3 colors). It would save me the trouble of closeting my potions and remembering to comment out the calls to visit_nuns every time I update the script. I never want to visit the nuns during normal adventuring.

I've been using 2.45 and it has been purchasing far too many MP restorers - sometimes enough to restore more than my max MP, even if I just needed to cast tongue of the walrus twice. Is this fixed in later versions?
 
Just want to state here that I would love to see the nuns preference checked as well as the pixel potion preferences (all 3 colors). It would save me the trouble of closeting my potions and remembering to comment out the calls to visit_nuns every time I update the script. I never want to visit the nuns during normal adventuring.
Nuns, red potions, gauze garters and filthy poultices all have their preferences checked in the next version. It's just waiting for a few more things before I release it:

I've been using 2.45 and it has been purchasing far too many MP restorers - sometimes enough to restore more than my max MP, even if I just needed to cast tongue of the walrus twice. Is this fixed in later versions?
Can you please post a session log of that bug? It's been reported, but I'm afraid I haven't been able to make it happen for me. Were you in ronin when it happened? What were your current and max HP/MP at the time? I really want to fix that!
 
Last edited:
Nuns, red potions, gauze garters and filthy poultices all have their preferences checked in the next version.

Just to be clear, I presume that in hardcore mode it will reserve a couple of red pixel potions or garters/poultices as described a few posts back, even if you have "use" checked for them. Is that correct?

-Th3Y thank you
 
Nuns, red potions, gauze garters and filthy poultices all have their preferences checked in the next version. It's just waiting for a few more things before I release it:
I can't wait!

Can you please post a session log of that bug? It's been reported, but I'm afraid I haven't been able to make it happen for me. Were you in ronin when it happened? What were your current and max HP/MP at the time? I really want to fix that!
I was in hardcore. I will dump all my HP/MP restoration from my last session:

> Current HP: 131, current MP: 1... restoring MP! Target = 14

buy 2 black cherry soda at market price from Black Market
You acquire black cherry soda (2)

use 2 black cherry soda
You gain 19 Muscularity Points
Note: this worked fine
> Current HP: 70, current MP: 17... restoring HP! Target = 273
> Current HP: 70, current MP: 17... restoring MP! Target = 140

buy 13 black cherry soda at market price from Black Market
You acquire black cherry soda (13)

use 13 black cherry soda
You gain 134 Muscularity Points

cast 9 Tongue of the Walrus
You gain 330 hit points
Note: 140 MP was requested to cast 9 tongues, which is wrong. Furthermore, 9 tongues was wrong - the right number was 5 or 6
> Current HP: 270, current MP: 9... restoring MP! Target = 11

use 1 ancient Magi-Wipes
You gain 57 hit points
You gain 60 Muscularity Points
Note: Normally, using magi-wipes to restore 2 MP would be considered overkill.
> Current HP: 116, current MP: 58... restoring HP! Target = 267

use 1 ancient Magi-Wipes
You gain 50 hit points
You gain 53 Muscularity Points
> Current HP: 166, current MP: 111... restoring MP! Target = 130

buy 2 black cherry soda at market price from Black Market
You acquire black cherry soda (2)

use 2 black cherry soda
You gain 22 Muscularity Points

cast 6 Tongue of the Walrus
You gain 212 hit points
Note: A little harder to see what's going on here. I'm attempting to restore HP. It uses a magi-wipe, then moves to tongues. The script decides to cast 6 tongues instead of the correct 3-4, and then requests 130 MP to pay for 6 tongues, which is incorrect
> Current HP: 139, current MP: 62... restoring HP! Target = 267
> Current HP: 139, current MP: 62... restoring MP! Target = 130

buy 8 black cherry soda at market price from Black Market
You acquire black cherry soda (8)

use 8 black cherry soda
You gain 82 Muscularity Points

cast 6 Tongue of the Walrus
You gain 203 hit points
Note: Another case of overcasting tongues and overestimating tongue's MP cost

... and by now you get the point.

I can't test more, because I'm out of HC for a basement dive.
 
Just to be clear, I presume that in hardcore mode it will reserve a couple of red pixel potions or garters/poultices as described a few posts back, even if you have "use" checked for them. Is that correct?
Absolutely! If you want to use them it will still refuse to use up items needed for the shadow if you're in ronin/hardcore.

I was in hardcore. I will dump all my HP/MP restoration from my last session:
Thank you very much. Those were interesting data. It has given me a new idea of where to look for the problem, so cross your fingers.

Could you PLEASE tell me what your max mp was? At least estimate it for me.

You didn't specify, but I assume you're using the most recent version of my script.
 
Last edited:
Thank you very much. Those were interesting data. It has given me a new idea of where to look for the problem, so cross your fingers.

Could you PLEASE tell me what your max mp was? At least estimate it for me.

You didn't specify, but I assume you're using the most recent version of my script.
My max MP was 144 at the beginning of the session, and 142 at the end (after ascension). I think it stayed in the 140-180 range. I'm pretty sure that the target MP was more than my max MP for some of the tongue-fests. I'd dive into your code myself, but I have finals coming up.
 
I've been hanging out in aftercore testing and testing and testing. I've been working on a specialized modification of version 2.6 just to do more testing under difficult to duplicate conditions. For instance, I've deleted the ability to use Cocoon just so it will use multiple tongues instead.

I notice that you're not attempting to restore maximum HP. (KolMafia wouldn't cast the skill that many times or restore that many hp if it was wasting recovery.) What healing settings are you using? I've been trying variations in hopes of hitting your bug.

I've never once managed to duplicate the bug you've described. The script always uses the correct number of spells, and knows how many mp it should take.

Please check for me the version of the script you're using. It is in the comment on line 1. Also, please tell me what version of mafia you are using. I'm going crazy trying to make it mess up!

> Current HP: 270, current MP: 9... restoring MP! Target = 11

use 1 ancient Magi-Wipes
You gain 57 hit points
You gain 60 Muscularity Points
Note: Normally, using magi-wipes to restore 2 MP would be considered overkill.
If your maximum mp is greater than 69 this is not a bug because nothing is wasted. The script worked properly here.
 
Last edited:
Even with the last version, it still refuse to heal beaten up if tongue of the walrus is the only thing available (it uses tiny house properly for example). And when clicking on the links to uneffect half-eaten brain nothing happens (I expect it to cast tongue of the walrus, as it removes it).
No big deal but slightly annoying (mostly the beaten-up part).
It also does things that looks strange to me like casting tongue 2 or 3 times, then casting cocoon. I think it would be mor logical to directly cast cocoon...
 
Last edited:
I've been hanging out in aftercore testing and testing and testing. I've been working on a specialized modification of version 2.6 just to do more testing under difficult to duplicate conditions. For instance, I've deleted the ability to use Cocoon just so it will use multiple tongues instead.
I haven't observed the bug in aftercore, but it has been happening consistently in hardcore.

I notice that you're not attempting to restore maximum HP. (KolMafia wouldn't cast the skill that many times or restore that many hp if it was wasting recovery.) What healing settings are you using? I've been trying variations in hopes of hitting your bug.
I believe I had HP recovery set to 70%, which is roughly consistent with my logs.

I've never once managed to duplicate the bug you've described. The script always uses the correct number of spells, and knows how many mp it should take.
I'd love to say my experience has been the same.

Incidentally, here's another, unrelated problem that cam up in aftercore:
Current HP: 463, current MP: 25... restoring HP! Target = 639
Casting Tongue of the Walrus 3 times...
You gain 113 hit points
Tongue of the Walrus was successfully cast.
Current HP: 576, current MP: 4... restoring MP! Target = 14
Searching for "carbonated water lily"...
Purchasing carbonated water lily (1 @ 175)...
You acquire an item: carbonated water lily
Purchases complete.
Using 1 carbonated water lily...
You gain 64 Muscularity Points
Finished using 1 carbonated water lily.
Casting Tongue of the Walrus 1 times...
You gain 40 hit points
Tongue of the Walrus was successfully cast.
Searching for "scroll of drastic healing"...
Purchasing scroll of drastic healing (1 @ 214)...
You acquire an item: scroll of drastic healing
Purchases complete.
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
Note: Max HP was 639

Please check for me the version of the script you're using. It is in the comment on line 1. Also, please tell me what version of mafia you are using. I'm going crazy trying to make it mess up!
Script v2.6, mafia r7189.

If your maximum mp is greater than 69 this is not a bug because nothing is wasted. The script worked properly here.
I see. That's fine then.
 
I haven't observed the bug in aftercore, but it has been happening consistently in hardcore.
I know. I locked the script into hardcore mode to duplicate the experience. Though mallcore does still use the same method of calculating skill usage and MP recovery for skill usage... Very puzzled. I'll play with it for another day.

Incidentally, here's another, unrelated problem that cam up in aftercore:
That's... interesting.


And when clicking on the links to uneffect half-eaten brain nothing happens (I expect it to cast tongue of the walrus, as it removes it).
That has nothing to do with me, file a KolMafia bug report with Veracity.

It also does things that looks strange to me like casting tongue 2 or 3 times, then casting cocoon. I think it would be mor logical to directly cast cocoon...
Agreed. I thought I'd cleared up that issue by revision 2.6... I'll have to figure out why it would still be doing that.
 
I know. I locked the script into hardcore mode to duplicate the experience. Though mallcore does still use the same method of calculating skill usage and MP recovery for skill usage... Very puzzled. I'll play with it for another day.
I just did the same and failed to reproduce the bug. Color me puzzled.
 
Universal recovery v 2.7 released!

Changelog:
version 2.7 April 27, 2009
  • Scroll of drastic healing is re-used 1/3 of the time, so now mallcore mode acounts for that in the price
  • Drastically increased ability to control script functions in hardcore mode
  • Will make really thick bandages from mummy wrappings if you select them in preferences
  • Added ability to use Clan Sofa in case you really want to waste turns resting there
  • Bug fixing

Since more preferences are being checked by the script, please make sure you have the proper choices for them. These are the settings I use:
Now you can configure recovery to refuse making use of Doc Galaktik's services, so make certain his Nostrum and Tonic are enabled unless you really don't want that form of healing. Please note that in mallcore mode it will always use the cheapest item, even if you don't have it selected in preferences. Since you can always buy more of anything you want, it will only conserve your meat.

I think I've figured out where pioupiou's pet bug must be coming from even though I cannot figure out the exact conditions to trigger it. I've replaced those lines of code with something that cannot respond by increasing the number of times you cast a spell in the hopes that it will kill the bug. Please test it for me since I'm about 75% sure it is cured.
 
Bale, using 2.7 on r7205 gave me the following error while trying to recover MP.

Internal error: field index out of bounds (Universal_recovery.ash, line 984)

I was able to work around it, so it doesn't seem to be a serious error.
 
Uh. What?! I totally don't understand that.

Did it have any output before that error? How did you work around it?
 
I forget what exactly I did. It may have had something to do with charpane in the relay browser. I haven't played yet today so I'll take better notes, though I'll be using r7208 instead. Hopefully it was just random weirdness.
 
Last edited:
Here's what I noticed.

In r7192 and r7205, If I get out of a battle and need to restore MP, but don't have any MP restoration items, the script hangs and prevents me from adventuring. I think the only work arounds I found were either buy restoratives myself or disable the script.

In r7196 and r7208, it seems like the same problem might be what is causing mafia to close itself without warning (see here). At very least it looks like lines from the recovery script are being appended to the end of the debug logs I have of the crashes.

I have no possible idea why this would be. I'm just describing what I'm seeing.

I noticed that the error line I mentioned above occurs in the portion of the script where it tries to determine the most efficient way to restore MP using meat. This correlates with what I have observed.

Line 984:
} else if(my_meat() >= 80 && heal[$item[Regular Cloaca Cola]].minmp + my_mp() <= my_maxmp()) {

Is "heal[$item[Regular Cloaca Cola]].minmp" some kind of array that wasn't fully populated, causing the out of bound error?
 
Is "heal[$item[Regular Cloaca Cola]].minmp" some kind of array that wasn't fully populated, causing the out of bound error?

heal is a map that is populated on line 108

Code:
	if(! file_to_map("recoveryScript_map_v2.txt",heal))	// This sets all simple restorative values from an external file.

Anyway, I tested it and heal[$item[Regular Cloaca Cola]].minmp has a value of 7, just like it is supposed to. That's why I'm completely befuddled.

In r7192 and r7205, If I get out of a battle and need to restore MP, but don't have any MP restoration items, the script hangs and prevents me from adventuring. I think the only work arounds I found were either buy restoratives myself or disable the script.

In r7196 and r7208, it seems like the same problem might be what is causing mafia to close itself without warning (see here). At very least it looks like lines from the recovery script are being appended to the end of the debug logs I have of the crashes.
Never seen any of those errors either. Nor has anyone else ever reported them. Once again I cannot imagine how they would exist. All I can think is that there is some incompatibility with Ubuntu.
 
Back
Top