Universal Recovery Script

fronobulax

Developer
Staff member
Bale the 4CR in GD said:
I can tell you why it would be using Medicinal Herbs instead of coccoon. That's because of a change I recently made since I figure nobody would specifically check the box to use them unless their spleen didn't have any better usage. I came to that conclusion recently while playing a new character with few skills and no spleen familiar. I think that is the right choice.

Would you elaborate please? My knee-jerk reaction is that if I have cocoon and enough MP that casting it would not trigger a restore of MP then it has to be better than herbs that cost meat. If we start using opportunity costs, which befuddle so many discussions of what's best, then if the cost per MP is low enough I could still see cocoon as being best.

I tend to spleen before adventuring so if there is spleen available then it probably means I have nothing better which makes this a philosophy question not a practical one, but... And what's a spleen familiar?

Thanks.
 

slyz

Developer
A spleen familiar is a familiar that drops spleen items (or items that allow you to get spleen items, like a Game Grid Token).
 

Arashmin

New member
So I sorted out most of my issues with this script and it's working mostly excellently, but there is a few things I wanted to note/inquire on (note: this is all based on yesterday, after I broke prism and took all my stuff out from Hagnk's)

-Is there any way to disable the script from using soda water altogether? I have a bunch built up from ascensions mostly for random mixing purposes, and the MMJ is almost always better. It seems to like to use soda water when it's trying to cast cocoon when my MP was 13, using a single one to recover up to cast cocoon. I had it set to not restore MP at all, but I guess in this case it needed to since cocoon was the optimal healing choice, yet did so in a way that wasn't very cost efficient. And this was while in a myst run, though admittedly I did have the option for purchasing set to none, now set to purchase from NPC only. I've always had the option to use MMJ's at any time enabled, since I have a lot of those stockpiled too.
-Is there a way to make the script not heal until you've started adventuring? The case where it used the soda water to cast Cocoon was when I was changing outfits from a weak hardcore outfit into low-level aftercore gear, which consists of a suite of IotM's that make my HP/MP increase significantly. Also, in this case it used the soda water and not Oscus's Neverending Soda, which I have in my inventory and made sure to enable from the start (like MMJ's)

I can see why both options would be good for some adventurers, but personally I would prefer a little control over certain aspects like that.
 

Bale

Minion
The first one: Are you saying it uses soda water from your inventory when you are in aftercore? (You say that it is built up from ascensions which implies aftercore, but then you say it was in a myst run which implies hardcore/ronin.)

The second: From what you say, I cannot be sure why it was healing, but the script only restores when mafia tells the script to restore. My script doesn't trigger itself. If you are auto-adventuring, then mafia invokes restoration before the adventure to ensure you are ready to face trouble. I really have no idea how to detect that you don't want it to do that.
 

Arashmin

New member
Oops, sorry for the confusion there. This occurred while in aftercore; I was just coming off of a myst run, and had the shop available with MMJs in them, as well as a bunch of MMJs (and soda waters) in stock. From what it seemed to be doing, it did calculate correctly that in order to cast cocoon, it needed to reach 18 MP, and in this case it assumed that the cheapest method to do that was by using one of the soda waters I had available in my inventory, despite having a free source (neverending) and MMJs available. I had also set it up to otherwise not restore MP.

For the second, I was preparing to auto-adventure, but had not yet initiated it so... it was right after manually changing the gear. I do have it set to auto-heal while manual adventuring, so perhaps this is more a case of when exactly mafia think is the best time to heal when the option to auto-heal is selected.

Thinking about the two issues, perhaps a better suggestion then would be to alert the player if they have their MP regen set to 0% and MP is the needed for the best option to heal, instead of just assuming to regen MP?
 
Last edited:

Winterbay

Active member
I think the problem here is that you had it set up to otehrwise not restore MP which meant that it decided to only restore the amount you needed to do the cast of coccoon. The cheapest way to do that without voiding your "do not restore" setting was probably soda water since everything above what was just needed would've been seens as wasted sicne you had specified that you didn't want more than that. But I may be wrong...
 

slyz

Developer
despite having a free source (neverending)
Universal Recovery uses in these conditions:
PHP:
if(item_amount($item[Oscus neverending soda])>0 && get_property("oscusSodaUsed") == "false"
  && (my_mp()+300 <= my_maxmp() || my_mp() < my_maxmp()/8.0) && contains_text(mpAutoRecoveryItems, "neverending soda"))
which means:
- you have the item in your inventory
- you haven't used it today
- you are missing more than 300 MP to hit your max MP OR you current MP is less than 1/8th of your max MP
- you checked "Oscus's neverending soda", either in relay_Universal_Recovery or in Mafia HP/MP Restore tab


perhaps this is more a case of when exactly mafia think is the best time to heal when the option to auto-heal is selected.
Do you mean that Mafia started the recovery process right after changing the outfit? You hadn't used the "adventure" button nor issued any CLI command?

alert the player if they have their MP regen set to 0% and MP is the needed for the best option to heal, instead of just assuming to regen MP?
Why? If the script decided using a skills was the cheapest way to restore HP, why stop to bother the user before doing it?
 
Last edited:

Pikolo

New member
Line 174

I have also received this error a few times over the last couple days. When it happens, I need to restart mafia before I can use any adventures.

Code:
Map modified within foreach (Universal_recovery.ash, line 174)

Edit: I deleted recoveryScript_map_v2.txt from Mafia's /data folder as I saw recommended in previous posts. It seems to have stopped the error.
 
Last edited:

Arashmin

New member
I would've met all four of those conditions you mention for Oscus's soda. My current MP was 13, my max MP would've been, with elder, marginally insane and cosmic ugnderstanding, as well as 10/10 on slimy synapses for 150 myst on a sauceror, that's about 390 or so MP right there. I also had navel and GAP on. I don't think it bases it on max MP then. It could be restoring it based on the maximum needed MP for recovery, though, which explains why it didn't qualify for that particular point in the list and therefore didn't use it.

And yes, I do mean that it healed before I could even do anything after changing the outfit. It saw that I was in the red as per the UR script settings, and acted accordingly. Now, interestingly enough, it was not in the qualifications to heal as per Mafia itself under HP/MP Usage.

And the reason I suggested it stop to bother the player is if the script is going to recover MP in a way that may not suit the need of the player, i.e. by using soda water. If it's an optional thing, then only those who want it would use it, but I could see how it might be against the nature of the script. Maybe a better optional setting would be 'Always use MMJ before using soda water, even if it heals more than the target MP"?
 

Bale

Minion
IAnd yes, I do mean that it healed before I could even do anything after changing the outfit. It saw that I was in the red as per the UR script settings, and acted accordingly. Now, interestingly enough, it was not in the qualifications to heal as per Mafia itself under HP/MP Usage.

There is only one set of settings to heal. The mafia settings panel simply does not update automatically when you change them with the relay browser. If you were to log out and log in again you'd see the mafia window now displays what you set with the relay script. I don't recommend that you do this, just trust that there is one set of settings even though one of the displays for that isn't updated reliably.

The relay browser configuration script is correctly displaying the only numbers that matter, even if you were to disable UR, it would still be correct.
 

Pikolo

New member
I got the same error again today, again requiring a restart of KoLmafia before I can spend any adventures. Any recommendations or hints from the others who have had the same error?

BTW, this is my second post here, but I have been using mafia for a couple years. It is an awesome tool, and ash scripting has saved me a lot of time. Thank you to the devs and script writers!

I have also received this error a few times over the last couple days. When it happens, I need to restart mafia before I can use any adventures.

Code:
Map modified within foreach (Universal_recovery.ash, line 174)

Edit: I deleted recoveryScript_map_v2.txt from Mafia's /data folder as I saw recommended in previous posts. It seems to have stopped the error.
 

Arashmin

New member
Ah, okay, I see that now Bale. I think the settings were modified by me in-run through Mafia prior to ascending, so that would explain the difference.

You didn't mention if you checked "Oscus's neverending soda", either in relay_Universal_Recovery or in Mafia HP/MP Restore tab.

...I thought it was inferred. Yes, it was selected in the UR interface to use it.
 
Last edited:

icefall5

Member
I'm getting caught in an infinite loop with the new version.
KoLmafia said:
Using cached search results for ancient Magi-Wipes...
Desired purchase quantity not reached (wanted 2, got 0)
Using cached search results for ancient Magi-Wipes...
Desired purchase quantity not reached (wanted 2, got 0)

etc.
Ancient Magi-Wipes are not selected in HP/MP Usage, so I don't know what to do.
 

zarqon

Well-known member
This happens for all mall purchases, not just using UR. It will probably be fixed fairly soon, but in the meantime using a slightly older revision of mafia will fix the issue.

EDIT: Or, you can just buy a lot of whatever restorative UR wants to get from the mall in the relay browser, and then it will work fine.
 
Last edited:

Bale

Minion
At the moment KoLmafia-9716.jar is recommended.

PS. Will have a new version with Way of the Fist support later. It'd be nice to not purchase restoratives in Fistcore. (By default -- that can be changed with the relay configuration script.) Meat is just too precious. I'm not exactly happy with the way I'm supporting it right now though so give me a bit.
 

Bale

Minion
Here's a little gift for everyone that doesn't want to waste meat during the new Fistcore challenge path. This will prevent all purchases. If anyone finds the script illicitly purchasing something during fistcore please let me know. Please note that KoLmafia will purchase an antidote if you're adventuring in a poisonous monster area (if NPC purchases are enabled) -- that's not me! In case anyone wants the script to purchase items for you I added an option configurable with the relay configuration script.



Universal recovery v 3.9 released!
Universal recovery Configuration UI v1.2 released!



Changelog:
version 3.9 August 19, 2011
  • Turn off all purchases during "Way of the Surprising Fist"
  • Add option to script controlled by relay_Universal_recovery v1.2 to enable purchasing during "Way of the Surprising Fist"
  • Will only use medicinal herbs to fill up the extra 3 spleen if you have a spleen familiar and are in ronin/hardcore. If you have mall access it will still use your entire spleen as before


Download Universal Recovery v3.9 here:
(Universal_Recovery.ash goes in the /scripts folder)
Download Universal Recovery Configuration relay UI v1.2 here:
(Universal_Recovery.ash goes in the /relay folder)​
 
Last edited:

stannius

Member
Speaking of antidotes, I seem to end up with multiple antidotes (up to 4 or so) in inventory. Do you know if that's mafia, UR, or both?
 
Top