Universal Recovery Script

Winterbay

Active member
The script got stuck in an infinite loop today while trying to buy Monstar energy beverage:

Code:
> Restoring MP! Currently at 614 of 971 HP, 178 of 988 MP, current meat: 61575 ... Target MP = 741. (taken from the log as it had scrolled off the screen when I noticed)
Using cached search results for Monstar energy beverage...
Purchasing Monstar energy beverage (8 @ 550)...
Stopped purchasing Monstar energy beverage @ 1,000.
Using cached search results for Monstar energy beverage...
Purchasing Monstar energy beverage (8 @ 550)...
Stopped purchasing Monstar energy beverage @ 1,000.
Using cached search results for Monstar energy beverage...
Purchasing Monstar energy beverage (8 @ 550)...
Stopped purchasing Monstar energy beverage @ 1,000.
Using cached search results for Monstar energy beverage...
Purchasing Monstar energy beverage (8 @ 550)...
Stopped purchasing Monstar energy beverage @ 1,000.

and so on until I stopped it. It appears that there was a store with a limit in it (10@550) and then the next is 1k a pop and after it had used up those cheap ones it got stuck in this loop.

Edit: Hmm... I bought a lot of them to see if that helped and it did, for a while, after which it got stuck on trying to buy fermented soy milk instead which gave the same problem (and also has a limited shop of 10@550).
 
Last edited:

Winterbay

Active member
It seems to have solved itself for now at least. That said I did remove the script as my recovery script for a while there since it was failing so hard and then I started to notice that my farming multi ran out of meat all the time. Noting that Mafia seemed to use Doc Galatic for everything I remembered that I had removed it. Back in place it is now saving me tons of meat.
Thanks! :)
 

icefall5

Member
Is there any way that I can tell it to use the hot tub instead of buying items every time it restores? It restored me MANY times today, but it only used the hot tub once.
 

AlbinoRhino

Active member
I would like to see the ability to use the hot tub more, as well. It seems to only use it when there is also a negative status effect to be removed ? It seems a shame to constantly spend meat on HP while a source of free HP just goes to waste.
 

slyz

Developer
If the hot tub isn't used, you should consider lowering your HP restoration threshold - if you can survive it. UR uses it when you have less than 10% of your max HP or when you are beaten up.

UR will use the hot tub more freely towards the end of your day (when your adventures are running low). In run, you probably have more HP towards the end of the day, so unless all the tubs aren't used up, this saves you meat.

EDIT: you should also check your baleUr_DontUseHotTub zlib variable (set it to false by typing "zlib baleUr_DontUseHotTub = false" in the gCLI).
 
Last edited:

Bale

Minion
If you've got plenty of adventures left it will only use the hot tub when you are at 10% of your maximum HP so that you can maximize your use of it. However, when adventures run out it will use the hot tub more frequently. Whenever your remaining adventures (it predicts values for food, drink and spleen that you haven't yet consumed) are less than ten times your remaining soaks it will prefer the hot tub. The calculation is this:

PHP:
// Shall I restore HP with the Hot Tub? Note that as adventures run out, it becomes more important to use up soaks
boolean use_hot_tub() {
	int hotTubSoaks = get_property("_hotTubSoaks").to_int();
	if(hotTubSoaks > 4) return false;
	if(my_hp() < my_maxhp() /9) return true;
	int expec_adv = my_adventures() + 3.5 * (fullness_limit() - my_fullness()) 
	  + 3.5 * (inebriety_limit() - my_inebriety()) + 1.75 * (spleen_limit() - my_spleen_use());
	return expec_adv < 10 * (5 - hotTubSoaks);
}

By the end of the day I hope that will use up all your soaks in a reasonably efficient manner.


EDIT: you should also check your baleUr_DontUseHotTub zlib variable (set it to false by typing "zlib baleUr_DontUseHotTub = false" in the gCLI).

That won't work since this script does not use zlib. :) The command you want is:
set baleUr_DontUseHotTub = false
 
Last edited:

AlbinoRhino

Active member
Hmmm. Perhaps it is the spleen predictions that cause it to not use the tub then. Does the script allow for HCO, and, if so, does it allow for not having any adventure-providing spleen items ?
 

Winterbay

Active member
Hmmm. Perhaps it is the spleen predictions that cause it to not use the tub then. Does the script allow for HCO, and, if so, does it allow for not having any adventure-providing spleen items ?

fullness_limit() and inebriety_limit() will return 0 if you are in HCO so those would get 0 and thus help your case. It does not, as far as that code snippet goes, take into account if you have or not have anyway to generate spleen items.
 

AlbinoRhino

Active member
So... if I change the 1.75 multiplier in that code to a 0, I can make the script use the hot tub based on my actual number of adventures ?
 

Bale

Minion
For some reason I wanted this script to be a single download dependent on no other scripts. Probably to make it easier to install for newer users since it chances something basic about mafia's functions and I don't want mafia throwing an error every time it tries to restore just because zlib needs updating. I compromised a teeny bit by adding a relay script to configure options, but that is optional.
 
Top