Universal Recovery Script

That means mafia knows it's not multi-usable, right? Though it does also have:

That's what I thought too. What should mafia do when it knows something is not multi-usable and you try to use multiple? In this case it seems to try using multiple and quietly fails with no error or message indicating it failed.
 
My second part of that was a question, or I'd envisioned it to be something like... is "usable" supposed to be true if it's a single usable item?
 
Hello~

I seem to be having a similar error:

Restoring MP! Currently at 1272 of 1272 HP, 698 of 1066 MP, current meat: 117277609 ... Target MP = 1066.
Using 15 gold star...
Finished using 15 gold star.
Using 15 gold star...
Finished using 15 gold star.
Using 15 gold star...
Finished using 15 gold star.
Did not fully restore MP for some reason.


If I closet any gold stars in my inventory:

Restoring MP! Currently at 1272 of 1272 HP, 698 of 1066 MP, current meat: 117277609 ... Target MP = 1066.
Searching for "gold star"...
Search complete.
Stopped purchasing gold star @ 195.
Searching for "palm-frond fan"...
Search complete.
Purchasing palm-frond fan (10 @ 170)...
You acquire palm-frond fan (10)
Purchases complete.
Using 10 palm-frond fan...
You gain 396 hit points
You gain 393 Muscularity Points
Finished using 10 palm-frond fan.

Running latest version of UR and on Mafia 12377. Thanks in advance for any assistance. =)
 
That means mafia knows it's not multi-usable, right? Though it does also have:

It's also a mp restorer, which means it can go through different paths in mafia's code ... I remember noticing that hpmp restorers (used to?) override "usable" and "multiusable" and just assume(d?) multiusability, in at least one place in the source ...
 
The information that those items are single-use (and not multi-use) has been added in Mafia in r12402.

Bug squashed!
 
Was hoping the r12385 changes would have maybe fixed this but alas, still getting this issue in r12406. Is this a UR problem or a mafia problem?

Code:
Restoring MP! Currently at 241 of 245 HP, 221 of 442 MP, current meat: 178484 ... Target MP = 398.
Searching for "ancient Magi-Wipes"...
Search complete.
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
Using cached search results for ancient Magi-Wipes...
Purchasing ancient Magi-Wipes (4 @ 120)...
Stopped purchasing ancient Magi-Wipes @ 240.
 
The problem is that you can still purchase some magi-wipes from this... wonderful... shop. You just can't buy 4. And since there are several hundred total available in the store, mafia 'knows' that this price is right every time it does a lookup.

Solutions:
1) Mafia is changed to consider mall_price based on limited availability. Note: It may already do so, but the fact that this guy allows 8 (more than the 5-limit that mafia uses) may screw up the consideration.
2) You manually buy up to the item limit, whatever that is. UR will then skip the store, since it's no longer available to you. This only fixes one rollover though.
3) You blacklist the guy and never have to worry about it again.

Another possibility is that UR might be using historical_price rather than mall_price, meaning that mafia did actually fix this, but the script was written to save server hits and in so doing, causes way more in cases like this. In that case Bale would need a check on if the acquisition actually failed and switch from historical_price to mall_price in that case.
 
2) You manually buy up to the item limit, whatever that is. UR will then skip the store, since it's no longer available to you. This only fixes one rollover though.

This is what I've currently been doing to work around this issue and this does indeed allow UR to start working correctly again. The interesting thing (well, interesting to me) is if I do "acquire 4 ancient Magi-Wipes" from the gCLI while this situation is present, mafia tries to buy 4 from that store, fails and buys four from the next store instead of buying as many as it can from the first store. So I've learned to go to the purchases tab and just purchase them 1 at a time from that store.
 
Last edited:
Yeah, I've encountered that problem also. It becomes particularly noticeable during Crimbo or another event that causes people to use up restoratives like mad. It's about time I tried to fix it. Let me know if this works.

There is no revision 13.


Universal recovery v 3.10.14 released!


Changelog:
version 3.10.14 August 5, 2013
  • Work around the store limit problem


Download Universal Recovery v3.10.14 here: View attachment 7835
(Universal_Recovery.ash goes in the /scripts folder)​
 
Let me know if this works.

Thanks. I will try to get it to break tonight after rollover. Hopefully I won't be able to. :)

Sidenote: How is your work on 1Up coming? I'm curious to see what you'll come up with. Will 1Up fill the same general role as UR or will it be completely different in functionality?
Side-sidenote: Looking at the source for UR, I like the comment on the new section of code, it gave me a good chuckle. :D
 
Last edited:
Will 1Up fill the same general role as UR or will it be completely different in functionality?

1Up is going to do the exact same job as UR, except that it will be a lot easier for me to maintain and should run quicker. Quite frankly UR is a long rambling mess of patchwork. 1Up is only a quarter of its size and has almost no code in common. I guess I reached a point where writing a new script was more fun than maintaining an old one.


How is your work on 1Up coming?

1Up is coming along. I've just got to sort out the status effect curing code before I can start debugging it in earnest. I created a new method for handling that, but it's giving me a lot of trouble and I'm considering just copy/pasting the old code from UR for that part. Urgh. The rest is looking rather sweet though. It was fun to come up with a method that can handle any restorative in KoL without needing any code for special handling. grubs only work in birdform? No problem, just put a condition of effect#511 in the datafile along with the restorative values. The heart of dark chocolate can only be used if _darkChocolateHeart is false? Yup. that goes in the data file also!


Side-sidenote: Looking at the source for UR, I like the comment on the new section of code, it gave me a good chuckle. :D

Oh dear. I wasn't thinking anyone would actually read that!
 
The point is that when I look through my own code later because something broke, the comment will remind me why I did something. I'm not like zarqon who writes scripts because he enjoys it as a comedic medium.

Though it does make me happy to know that my comment made someone else's day a little more amusing.
 
Oh dear. I wasn't thinking anyone would actually read that!

I have made it a habit to compare scripts I've downloaded with the version I'm currently running with Winmerge to make sure I didn't make any stupid changes in my local copy that I want to keep. I do this even if I'm fairly certain I haven't made any changes since my memory seems to be getting less reliable and I've been burned once or twice by not doing this. One of the awesome benefits of the new SVN capabilities is not having to do this.

So far the newest version of UR hasn't encountered that error on any of my characters. Hopefully this means that the bug is thoroughly squashed.
 
I did have a character burn through over 100k meat in HC trying to heal... something, probably from the Battlefield Hippies... with Disco Power Nap today. Ah well. That'll teach me to let mafia run without full supervision. :(
 
My usual HC runs are 100% NPZR. :) It makes the average HC run net about 130-140k meat, and I never have to wait for BCA to meat-farm or abort. It's nice.

When Theraze logged in: Meat: 108,402

Shortly after: > Restoring HP! Currently at 163 of 596 HP, 222 of 333 MP, current meat: 108463 ... Target HP = 567.

A bit later that day: > Restoring MP! Currently at 739 of 739 HP, 58 of 457 MP, current meat: 136494 ... Target MP = 183.

After that 136k bit, it started using every MP restorative I had casting and recasting Disco Power Nap, and burned all the way down to:
> Insufficient meat to fully restore MP without wasting restoratives!
> Restoring MP! Currently at 739 of 739 HP, 3 of 457 MP, current meat: 14 ... Target MP = 12.

Here's the end of the last combat and the bit until it ran out of other things and just kept doing the DPN:
Code:
Round 17: Theraze wins the fight!
You gain 46 Fortitude
You gain 21 Mysteriousness
You gain 15 Cheek
16 hippies defeated; 976 down, 24 left.

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

[1260] The Battlefield (Frat Uniform)
Encounter: 

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

[1260] The Battlefield (Frat Uniform)
Encounter: 

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

[1260] The Battlefield (Frat Uniform)
Encounter: 

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

[1260] The Battlefield (Frat Uniform)
Encounter: 

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

[1260] The Battlefield (Frat Uniform)
Encounter: 

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points
 > Restoring MP! Currently at 739 of 739 HP, 58 of 457 MP, current meat: 136494 ... Target MP = 183.

[1260] Rest in your dwelling
You gain 39 hit points
You gain 40 Muscularity Points

[1260] Rest in your dwelling
You gain 39 hit points
You gain 40 Muscularity Points

[1260] Rest in your dwelling
You gain 40 hit points
You gain 40 Muscularity Points

use 1 carbonated soy milk
You gain 71 Muscularity Points

[1260] The Battlefield (Frat Uniform)
Encounter: 

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

cast 1 Disco Power Nap
You gain 40 hit points

[1260] The Battlefield (Frat Uniform)
Encounter:
In actual fact, mafia's counter was off... I'd killed all the hippies, and after selling my junk from the war, I killed The Dude immediately. Probably has to do with mafia only updating the war status when you actually check the page in the relay browser. Still no clue though why mafia/UR kept trying to heal when I was already at full health. Ah well. It's still worth the random meat burn. Least it didn't happen in SC/Aftercore.

Edit: As a sanity checker, maybe UR could abort if the player is trying to heal HP when it's already full? It wouldn't have fixed mafia being off on its counter, but it would have saved me 136k meat and a bunch of MP restore items. :)
 
Last edited:
I'm more curious why you didn't have any feelback from UR at that point. Something like, "> Restoring HP! Currently at 163 of 596 HP, 222 of 333 MP, current meat: 108463 ... Target HP = 567."

Suddenly UR's output disappeared? I wonder what else might have been casting disco power nap. Obviously UR was called to restore MP because we see that line.
 
Back
Top