Universal Recovery Script

lostcalpolydude

Developer
Staff member
A quick fix would be to add something like this to the start of UR and BatBrain.
Code:
boolean galaktik_cures_discounted() {return get_property("questM24Doc")  == "finished";}

Make it return false (or true) without checking anything instead for a quick fix, since the return value is completely useless. If the script actually tries to use it, it will abort from galaktik no longer being a CLI command.
 

fronobulax

Developer
Staff member
My thought when removing the function was that any script looking at it would not be getting the result it cared about, so the script would need updating to be useful regardless. I guess it could return a useless false value for now just to not cause scripts to abort?

Besides that, npc_price( item ) updates appropriately for everything there, so I feel like there shouldn't be as much need for that function.

Having butchered several scripts just to get them to run after I defined the function in ash, I believe that most of the uses are in order to determine price and using npc_price would be a much cleaner usage in ash. That said, there will be edge cases where a script caches a value or only sets it once and the quest is completed before npc_price is called again, but scripts can be written to avoid that.
 

Bale

Minion
Working on it. This is a huger change than I'd expect.

The lack of a function is most visible, but the script also makes good use of the galaktik services that were removed completely. :(
 

fronobulax

Developer
Staff member
Working on it. This is a huger change than I'd expect.

The lack of a function is most visible, but the script also makes good use of the galaktik services that were removed completely. :(

Thank you. I had not realized just how much I depended on UR until it didn't work and my quick fixes weren't.
 

Bale

Minion
After a few "How they heck does this work" moments, inevitably followed by "OH!" I've finally finished fixing the script.

I found a few things that don't work as well as they once did since NPC prices are no longer as inflexible as they were when I first wrote it. Those were fixed. (Will need to look for more of those in the future.)

Note that this script needs a new version of the recovery script, so if you update before rollover, please remember to delete /data/recoveryScript_map_v2.txt

I might not have fixed it as well as I'd like, so I look forward to bug reports.
 

Immelan

New member
I'm in an Ed run and keep getting:

Division by zero (Universal_recovery.ash, line 731)

Any thoughts on how to fix this?


Edit:
NM, something finally triggered and it downloaded a new map_v2 file and things work well again
 
Last edited:

Bale

Minion
Thank you. Fixed it. (last two fields should actually have been 0.0 and 10.0 ugh.)

Everyone should delete their copy of /data/recoveryScript_map_v2.txt so that it will fix itself off of zarqon's server.
 

Magus_Prime

Well-known member
With the current SVN version of Universal Recovery and the current map file I'm getting the following in a Bees Hate You run:

Code:
Restoring MP! Currently at 224 of 225 HP, 91 of 581 MP, current meat: 54586 ... Target MP = 552.
Division by zero (Universal_recovery.ash, line 994)
Autorecovery failed.

Any ideas?
 

Bale

Minion
Turn up verbosity and maybe I'll get a better clue. Copy/paste the following into the CLI (and hit enter):
Code:
set baleUr_Verbosity = 3
 

Magus_Prime

Well-known member
Here's what I get with verbosity set to three:

Code:
Calling Universal Recovery 3.14 for type=HP, amount=0
Calling Universal Recovery 3.14 for type=MP, amount=0
Restoring MP! Currently at 127 of 229 HP, 56 of 596 MP, current meat: 55781 ... Target MP = 567.
Try to heal MP from inventory.
Using 2 phonics down...
You acquire an effect: Tingly Biceps (5)
You acquire an effect: Tingly Wrists (4)
You gain 95 hit points
You gain 95 Mana Points
Finished using 2 phonics down.
Last attempt to purchase MP with meat.
Division by zero (Universal_recovery.ash, line 994)
Autorecovery failed.

This is with KoLmafia r15783 and the character is a Pastamancer with access to the guild and spare meat.

It's failing to restore MP. Here are my UR preferences:

Code:
baleUr_0trouble false
baleUr_AlwaysContinue false
baleUr_BirdThreshold 0.05
baleUr_DontUseHotTub false
baleUr_FistPurchase false
baleUr_HPtrouble false
baleUr_MPtrouble false
baleUr_Purchase 1
baleUr_UseInventoryInMallmode false
baleUr_UseMmjStock false
userbaleUr_Verbosity 3
baleUr_ZombieAuto 22
baleUr_ZombieTarget 55
 
Last edited by a moderator:

Ulti

Member
Is there a way to config the script to include "rest at the chateau" regardless of free rests remaining, as a fallback if out of other recovery sources?
 

Bale

Minion
Softcore, still in ronin, and auto-satisfy is enabled.

Magnus_Prime, I have not found the problem, but I've added some troubleshooting messages to the program that might give me a clue. I'm attaching a special copy to this post. Copy it over the version in your /scripts directory and leave verbosity at 3. When you get the error, there should (hopefully) be something interesting reported.
 

Attachments

  • Universal_recovery.ash
    84.9 KB · Views: 34

Bale

Minion
Is there a way to config the script to include "rest at the chateau" regardless of free rests remaining, as a fallback if out of other recovery sources?

Nope. Do you really think I should add that to occur under all circumstances?
 

Ulti

Member
Nope. Do you really think I should add that to occur under all circumstances?
well, with "Rest at your campground" and "Sleep on your clan sofa" available, I'd greatly enjoy such an addition so I get stats when resting.
 

Bale

Minion
Oh! That is a very good point. If either of those is enabled and there is a Chateau, it should rest there instead. That's just good sense.
 

Magus_Prime

Well-known member
Bingo:

Code:
Calling Universal Recovery 3.15 for type=HP, amount=0
Calling Universal Recovery 3.15 for type=MP, amount=0
Restoring MP! Currently at 248 of 315 HP, 39 of 839 MP, current meat: 112661 ... Target MP = 798.
Try to heal MP from inventory.
Last attempt to purchase MP with meat.
magical mystery juice : 24.5
black cherry soda : 0.0
Doc Galaktik's Invigorating Tonic : 10.0
Division by zero (Universal_recovery.ash, line 1000)
Autorecovery failed.

Now that I think about it the problem started after the Black Market was open.

Here's the entry from my copy of recoveryScript_map_v2.txt.

Code:
black cherry soda	0	0	9	11	0.0	10.0

I like the additional verbosity. Would you consider keeping it in the SVN version of the script?
 
Top