Universal Recovery Script

Donavin69

Member
Restoring HP! Currently at 876 of 1764 HP, 885 of 4639 MP, current meat: 563272 ... Target HP = 1676.
Casting Cannelloni Cocoon 1 times...
You gain 888 hit points
Cannelloni Cocoon was successfully cast.
Restoring MP! Currently at 1764 of 1764 HP, 865 of 4639 MP, current meat: 563272 ... Target MP = 866.
Using 1 Oscus's neverending soda...
You gain 275 Mana Points
Finished using 1 Oscus's neverending soda.

Request 3 of 91 (Hobopolis: Exposure Esplanade) in progress...
.
.
.
Restoring HP! Currently at 825 of 1764 HP, 1152 of 4639 MP, current meat: 563272 ... Target HP = 1676.
Casting Cannelloni Cocoon 1 times...
You gain 939 hit points
Cannelloni Cocoon was successfully cast.
Restoring MP! Currently at 1764 of 1764 HP, 1132 of 4639 MP, current meat: 563272 ... Target MP = 1133.
Searching for "palm-frond fan"...
Search complete.
Purchasing palm-frond fan (1 @ 495)...
You acquire an item: palm-frond fan
Purchases complete.
Using 1 palm-frond fan...
You gain 43 hit points
You gain 41 Mana Points
Finished using 1 palm-frond fan.

Request 5 of 91 (Hobopolis: Exposure Esplanade) in progress...
.
.
.
Restoring HP! Currently at 877 of 1764 HP, 1174 of 4639 MP, current meat: 562777 ... Target HP = 1676.
Casting Cannelloni Cocoon 1 times...
You gain 887 hit points
Cannelloni Cocoon was successfully cast.
Restoring MP! Currently at 1764 of 1764 HP, 1154 of 4639 MP, current meat: 562777 ... Target MP = 1155.
Using cached search results for palm-frond fan...
Purchasing palm-frond fan (1 @ 495)...
You acquire an item: palm-frond fan
Purchases complete.
Using 1 palm-frond fan...
You gain 38 hit points
You gain 43 Mana Points
Finished using 1 palm-frond fan.

Request 6 of 91 (Hobopolis: Exposure Esplanade) in progress...
 
Last edited:

Theraze

Active member
Well, I'd probably suggest the pain of running an adventure (not your first, but one where it's already decided on items) at UR Verbosity 3 and then posting the whole MP restoration part. It (probably) won't be enough to know exactly why it is forcing it, but should help a lot more. :) Thanks!
 

Donavin69

Member
I run at Verbosity 3 all the time, I could turn it up if you think it would give any more information (although when I did that I didn't see anything)

I did notice something after I re-disabled UR, this might not be a UR problem, but maybe a new mafia bug. After UR was disabled, once mafia casts cocoon, it gives an error message 'Unable to recover' (I'll try to capture that with a debug log later)
 

Theraze

Active member
Ah... if mafia is requesting 1 mp, then UR recovering it makes sense. But yeah, if you want (at least me to try to give) further attempted debugging on this, need more info. If it is actually an UR bug. :)
 

Theraze

Active member
So, regarding UR and New Cloaca Colas, I disabled the current UR special handling code, as follows:
Code:
#	case $item[New Cloaca-Cola]:
#		if(q > item_amount(it))
#			use(ceil((q - item_amount(it))/6.0), $item[six-pack of New Cloaca-Cola]);
#	case $item[six-pack of New Cloaca-Cola]:
#		use(q, $item[six-pack of New Cloaca-Cola]);
#		use(min(q*6, inv_quant($item[New Cloaca-Cola], amount, "MP")), $item[New Cloaca-Cola]);
#		break;
Basically, just stop all special New Cloaca-Cola handling. And shockingly, for the first time I can recall... UR actually used a single can of New Cloaca Cola. Amazing! :)

Looking at the code, there's no time when it would ever try to USE NCC if it's the best option. It'll break six-packs. It'll consider drinking entire six-packs. It won't use single cans. I think what we need is putting the use-case from default in as well as a break. Like so:
Code:
	case $item[New Cloaca-Cola]:
		if(q > item_amount(it))
			use(ceil((q - item_amount(it))/6.0), $item[six-pack of New Cloaca-Cola]);
		use(q, it);
		break;
Basically, if UR decides it wants to use NCC, break out as many six-packs as needed, then use it, and stop thinking about it. Don't fall into the next case, where it ALWAYS uses a six-pack whether or not we need to (or have one).

Edit: Example from today...
Restoring MP! Currently at 287 of 371 HP, 33 of 189 MP, current meat: 18153 ... Target MP = 76.
Using 1 six-pack of New Cloaca-Cola...
You acquire New Cloaca-Cola (6)
Finished using 1 six-pack of New Cloaca-Cola.
Using 1 New Cloaca-Cola...
You gain 159 Muscularity Points
Finished using 1 New Cloaca-Cola.
 
Last edited:

fronobulax

Developer
Staff member
Any specifics? Class, if you're in a challenge run, any meat constraints, etc, etc, etc...

Looks like the line throwing the error is trying to compute meat per MP so which restores you have available/allowed would help us disgnaose. But if you want this solved you need to give us more to work with.
 

Magus_Prime

Well-known member
When on the new challenge path UR "thinks" it has access to the guild store, if the character would open it, and the ability to purchase magical mystery juice.

As a temporary measure I added a check for the new challenge path on line 107.
 
Last edited:

Bale

Minion
Yup. Just fixed the problem. (And ensured that future unknown mysticality classes would not have that problem either.) Enjoy!


Universal recovery v 3.10.7 released!


Changelog:
version 3.10.7 February 16, 2013
  • Avatar of Jarsberg does not have access to MMJ


Download Universal Recovery v3.10.7 here: View attachment 7408
(Universal_Recovery.ash goes in the /scripts folder)​
 

Theraze

Active member
Still has the issue where Zombiecore can cause divide by zero errors because you don't have any available restoration values for meatperhp or meatpermp. I have the following:
Code:
string meatpermp() {
	switch {
	case zombie:
		return (have_skill($skill[summon horde]) ? "80.0" : "100.0");
	case buy_mmj:
Code:
float meatperhp() {
	if(zombie)
		return (100.0 / (my_maxhp() / (have_skill($skill[summon horde]) ? 8 : 10)));
	if(galaktik_cures_discounted() && contains_text(hpAutoRecoveryItems, "curative nostrum"))
Also, it still has the New Cloaca Cola bug where it's missing a use/break so it bleeds from using the individual item into using six-packs. It partially would make sense to go the other way, but always breaking a six pack is NOT the right way to use a single in-inventory NCC can.
Code:
	case $item[New Cloaca-Cola]:
		if(q > item_amount(it))
			use(ceil((q - item_amount(it))/6.0), $item[six-pack of New Cloaca-Cola]);
		use(q, it);
		break;
	case $item[six-pack of New Cloaca-Cola]:
 

Bale

Minion
Thank you very much for posting your fixes. I'll look at them and if I agree I'll add them to the code next week. Too much to do right now.
 

Theraze

Active member
Not a problem. I put them back into my copy, but find it helpful to hear why stuff is the way it is, if there's a reason. :)

The basic reasoning behind the top two is that Galaktik isn't available during Zombiecore, so when it falls back on Galaktik from the heal-list as its check... well, there's nothing there. So it fails, painfully.

The New Cloaca Cola thing is interesting. What the release code does is breaks up enough 6-packs to succeed in using as many individual cans as are needed. Then, it doesn't use them, but falls into the six-pack handling, where it always breaks up that number (usually one) of six-packs again and then tries to use 6 times as many individual cans as it actually calculated... I just eliminated the weird-bleed and let each case (six pack or individual cans) use the amount that it actually calculated as being useful. :)

But yes, please take a look when you have time and if I screwed something up horribly, let me know so I don't keep messing things up for me. Working is good. :)
 

Theraze

Active member
For that, go to this:
Code:
int disco = to_int(have_skill($skill[Disco Nap]))
	+ 2* to_int(have_skill($skill[Disco Power Nap]))
	+ to_int(have_skill($skill[Executive Narcolepsy]));
and just change the bottom line to:
Code:
	+ to_int(have_skill($skill[Executive Narcolepsy]))
	+ 10*to_int(have_skill($skill[Food Coma]));

The mp restore still needs touching though... Hmm....

Edit: Looks like the affected AoJ sections would be either rest_mp or numeric_modifier("Base Resting MP"). If the second is set by mafia automagically, UR knows about it and everything works perfectly. If it isn't, then we need to override it.
 
Last edited:

Theraze

Active member
Great! Then the only thing you (Magus_Prime or any user who wants UR to auto-rest) need is to update UR to let it know that it gets 10 additional rests. :)
 

Bale

Minion
Thanks Theraze.

Universal recovery v 3.10.8 released!


Changelog:
version 3.10.8 February 26, 2013
  • Properly enjoy a Food Coma in Avatar of Jarsberg
  • Theraze's fixes for Zombiecore and new Cloaca-Cola


Download Universal Recovery v3.10.8 here: View attachment 7445
(Universal_Recovery.ash goes in the /scripts folder)​
 

Magus_Prime

Well-known member
I don't know whether this should go in the UR thread or in the BBB thread so I'm going to post it in both places. My character was beaten up and I wasn't able to autorecover.

Code:
Running ZLib version: r37 (current)
Running Best Between Battle Script Ever version: 2.6 (current)
You don't have any spooky putty monsters.
Beaten Up cannot be removed with an available item or skill...
You need 1 more soft green echo eyedrop antidote to continue.
Autorecovery failed.

Autorecovery failed.

UR is set to allow use of the campground, which should have removed beaten up. I even had free rests remaining. The hot tub was also available.

Any thoughts?
 
Last edited:

Theraze

Active member
Doesn't look like UR is aware (yet) that cure_beatenup also needs to consider the campground. Since that was a relatively recent KoL change, and not one that was specifically pointed out to Bale yet. :)
 
Top