Universal Recovery Script

Then I greatly appreciate your magnanimosity in allowing (nay, facilitating) some of us to cheat to such an awesome extent. :)

The way I see it: why remember something every time when you could just remember it once?
 
Hey - among other things, I have years of experience implementing programming language development environments. LISP, mostly. ASH is simply my current outlet for doing that kind of development. I don't especially want to WRITE stuff in ASH. I want to write ASH itself and make it pleasant for OTHERS to write programs using it.

I am very impressed with what you-all have accomplished using it.

I was joking, obviously (and you obviously recognized it). Except, it is true that I don't use scripts - with the exception of Ahlifar's Slime Tube script, which I used for at least my last 25 solo runs, including my Slimeling run - and with the additional exception of one or another 11-table script I used every day during Crimbo this last year.

I really should check out this (and your) scripts...
 
Well, I'm very proud of this script, so I'd be happy if you checked it out only to be impressed by how involved it is.
 
Be careful V -- it's a slippery slope. Use UR and you'll find you don't want to operate without it. Use SS and you'll happily discard most of the rest of your CCS. Use BBB and get used to not needing to do quite a lot of annoying little between combat activities from your runs. Soon you'll be scripting everything! :)

On the note of making it pleasant for us scripters... there are a couple things which I'd really like to be accessible in ASH...
 
Lol! Yeah, it is a bit addictive, but I find I can frequently make do without too much scripting aside from UR. Though SmartStasis does become indispensable when I'm dealing with a stasising familiar. You really should have tried it out during your stocking mimic run.
 
Why would the script choose to use 5 filthy poultices (~100 HP, 200 Meat in the Mall) instead of a single scroll of drastic healing (>500 HP, with my current max HP and <% for recovery, and only 600 Meat in the Mall)?
 
I have no idea.

I'd appreciate it if you'd post your session log for that error and maybe I can figure it out.
 
I see a bug, this happened when i was using ascend.ash URS was trying to heal me by resting in the campground, the problem was that i didn't have any adventures left....THis loop did not stop unit i aborted

Code:
[COLOR="Lime"]Restoring HP! Currently at 4 of 67 HP, 42 of 56 MP, current meat: 17521 ... Target HP = 67.[/COLOR]
Campground request 1 of 1 in progress...

[658] Rest in your dwelling

Campground request 1 of 1 in progress...

[658] Rest in your dwelling

Campground request 1 of 1 in progress...

[658] Rest in your dwelling

Campground request 1 of 1 in progress...
 
Ooooh! Good catch. Fortunately it's really simple to fix.

I've been doing another few bugfixes lately, but I don't feel like making an actual release so I'll just post it here for the sake of my most attentive users.

Edit: Attachment removed.
 
Last edited:
Hey, not sure why it didn't recognise I have lab access (perhaps because I am already wearing the kge pants?), as well as already having 2 anti-anti-antidotes.

Thanks for the great script!

Log:

---------------

> restore mp

Purchasing anti-anti-antidote (2 @ 30)...
You acquire anti-anti-antidote (2)
You spent 60 Meat
Purchases complete.
1149 prices updated from http://zachbardon.com/mafiatools/updateprices.php?action=getmap
0 prices updated from http://nixietube.info/mallprices.txt
Pricelist updated.
_meatpermp => 17.0
_meatperhp => 4.857143
_version_BalesUniversalRecovery => 3.52
Restoring MP! Currently at 141 of 141 HP, 10 of 72 MP, current meat: 5678 ... Target MP = 36.
Visiting Doc Galaktik...

Restore 26 MP at Doc Galaktik's
You gain 26 Muscularity Points
You spent 442 Meat
Cure purchased.
 
Wearing the pants is irrelevant. It checks if you own the outfit, not any individual piece of it. The only way that could fail is if mafia is confused about your inventory, you don't have the key or else one of your stats is too low to wear one of the outfit pieces.

I suspect though that my script noted your HP would be reduced while wearing the outfit and declined to do so. This is rare early in the game because the outfit itself raises HP, but possible. Late in the game it becomes likely due to the war outfits, but by then you have access to the Black Market so it doesn't matter.

Concerning the antidotes, my script decides to have 4 antidotes on hand once your meat is greater than 5000. It figures the cost is low enough to afford the extra insurance against really bad luck.
 
What I notice is that the script went to doc and spent 442 meat for 26 MP. Using the lab, 50 MP could have been purchased for 400 meat, and even if 20 MP is spent on tongue (which deathprog has, at least on that character), it's still a better deal. Hopefully the only possibility is that the lab was not accessible.
 
I think that I confused mafia by getting the kge outfit on one computer then starting to play on another. Though perhaps your script checks for the outfit independently?

I would indeed have lost a lot of hp from equiping kge though - I have a brimstone bunker this run (yay!). So that may well be it. Always interesting to see what unusual situations can crop up and to understand them, thanks!
 
For some reason mafia thinks that i have a scroll.....or it doesn't use one even though it says it does......i sometimes get this but never bothered mentioning it

Code:
[COLOR="SeaGreen"]Restoring HP! Currently at 106 of 1180 HP, 632 of 971 MP, current meat: 5223400 ... Target HP = 1180.[/COLOR]
_meatperhp => 0.54003674
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
[COLOR="Red"]Did not fully restore HP for some reason.[/COLOR]
[COLOR="SeaGreen"]
Restoring HP! Currently at 106 of 1180 HP, 632 of 971 MP, current meat: 5223400 ... Target HP = 1180.[/COLOR]
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
[COLOR="Red"]Did not fully restore HP for some reason[/COLOR]
 
Last edited:
Honestly I'm not sure what I can do to protect you from mafia's mistaken idea of your inventory. I'm just glad that my code knows to surrender after a few tries instead of keeping you trapped in an infinite loop.

Also, please stop using the color Lime for your green. It's too bright and hurts me when I try to read it. Use the SeaGreen above that, or the regular green above that one. They're both much more readable.
 
What I notice is that the script went to doc and spent 442 meat for 26 MP. Using the lab, 50 MP could have been purchased for 400 meat.

This is totally anecdotal, but this happened to me on my last ascension as well. I had the outfit and it seemed like sometimes the script would go to the lab, and sometimes to galaktik. I don't think it was entirely an inventory sync issue because my impression is that it would do both in the same session. If it helps, I had the impression that going to galaktik was more likely to happen when the target was for a relatively few HP/MP (in the range of 20-30).

In my next ascension, I'll try to get some more meaningful data/logs for you. But for now, my point is that the previous poster is not crazy (or at least, we're both crazy).
 
Last edited:
OK, I'm getting a lot of trips to Galaktik in my current ascension. I'm a L8 DB in softcore, still in ronin. I edited the script to set both verbose = true and super_verbose = true.

In the attached session excerpt, when 9, 10, or 24 MP are wanted, it's going to Galaktik (even with knob seltzer in inventory), and when 40 MP are wanted, it's using seltzers.

Note: I exited KoLmafia and restarted immediately" before making the below requests. I've included the "player snapshot" that mafia generated in the log, but moved it to the bottom of this excerpt.

Code:
 > Calling Universal Recovery for type=MP, amount=20
 > Restoring MP! Currently at 84 of 107 HP, 11 of 80 MP, current meat: 7462 ... Target MP = 20.
 > Try to heal MP from inventory.
 > Last attempt to purchase MP with meat.

Restore 9 MP at Doc Galaktik's
You gain 9 Mojo Points
You spent 153 Meat

cast 1 The Sonata of Sneakiness
You acquire an effect: The Sonata of Sneakiness (duration: 10 Adventures)
 > Calling Universal Recovery for type=MP, amount=10
 > Restoring MP! Currently at 84 of 107 HP, 0 of 80 MP, current meat: 7309 ... Target MP = 10.
 > Try to heal MP from inventory.
 > Last attempt to purchase MP with meat.

Restore 10 MP at Doc Galaktik's
You gain 10 Mojo Points
You spent 170 Meat

cast 1 Smooth Movement
You acquire an effect: Smooth Movements (duration: 10 Adventures)
 > Calling Universal Recovery for type=MP, amount=24
 > Restoring MP! Currently at 84 of 107 HP, 0 of 80 MP, current meat: 7139 ... Target MP = 24.
 > Try to heal MP from inventory.
 > Last attempt to purchase MP with meat.

Restore 24 MP at Doc Galaktik's
You gain 24 Mojo Points
You spent 408 Meat
outfit Knob Goblin Elite Guard Uniform

buy 2 Knob Goblin seltzer at market price from Knob Goblin Laboratory
You acquire Knob Goblin seltzer (2)
You spent 160 Meat
custom outfit Backup

cast 12 The Moxious Madrigal
You acquire an effect: The Moxious Madrigal (duration: 120 Adventures)
 > Calling Universal Recovery for type=MP, amount=40
 > Restoring MP! Currently at 79 of 107 HP, 0 of 80 MP, current meat: 6571 ... Target MP = 40.
 > Try to heal MP from inventory.

use 2 Knob Goblin seltzer
You gain 19 Mojo Points
 > Last attempt to purchase MP with meat.
outfit Knob Goblin Elite Guard Uniform

buy 9 Knob Goblin seltzer at market price from Knob Goblin Laboratory
You acquire Knob Goblin seltzer (9)
You spent 720 Meat
custom outfit Backup

use 3 Knob Goblin seltzer
You gain 35 Mojo Points

cast 1 Aloysius' Antiphon of Aptitude
 > Calling Universal Recovery for type=HP, amount=101
 > Restoring HP! Currently at 79 of 107 HP, 54 of 80 MP, current meat: 5851 ... Target HP = 102.
 > Try to heal HP from inventory.

use 1 cast
You gain 20 hit points

buy 1 Doc Galaktik's Ailment Ointment at market price from an NPC Store
You acquire an item: Doc Galaktik's Ailment Ointment
You spent 60 Meat

use 1 Doc Galaktik's Ailment Ointment
You gain 9 hit points

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
               Player Snapshot
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

 > moon

February 4, 2010 - Carlvember 1

Ronald: new moon
Grimace: new moon

Labór Day: 5 days
Valentine's Day: 10 days
Halloween: 15 days
Feast of Boris: 22 days
Yuletide: 27 days
Festival of Jarlsberg: 32 days
St. Sneaky Pete's Day: 41 days
Oyster Egg Day: 57 days
El Dia De Los Muertos Borrachos: 65 days
Generic Summer Holiday: 74 days
Dependence Day: 83 days
Arrrbor Day: 91 days


Moxie bonus today and yesterday.


 > status

Name: y0u
Class: Disco Bandit

Lv: 8
HP: 84 / 107
MP: 11 / 80

Mus: 40 (35), tnp = 34
Mys: 40 (35), tnp = 38
Mox: 106 (59), tnp = 42

Advs: 46
Meat: 7,462
Drunk: 0


 > equipment

Hat: miner's helmet
Weapon: diamond-studded cane
Off-hand: pilgrim shield
Shirt: (none)
Pants: Boss Bat britches

Acc. 1: Mr. Accessory Jr.
Acc. 2: tap shoes
Acc. 3: ring of conflict

Pet: RoboGoose (27 lbs)
Item: little box of fireworks

 > skills

Uncategorized
 - Abs of Tin
 - Marginally Insane
 - Moxious Maneuver
 - Natural Born Scrabbler
 - Rainbow Gravitation
 - Slimy Synapses
 - Thrift and Grift
 - Transcendent Olfaction
 - Vent Rage Gland

Seal Clubber
 - Claws of the Otter
 - Claws of the Walrus
 - Clobber
 - Double-Fisted Skull Smashing
 - Eye of the Stoat
 - Hide of the Walrus
 - Lunging Thrust-Smack
 - Musk of the Moose
 - Northern Exposure
 - Pulverize
 - Rage of the Reindeer
 - Seal Clubbing Frenzy
 - Snarl of the Timberwolf
 - Super-Advanced Meatsmithing
 - Tongue of the Walrus

Turtle Tamer
 - Amphibian Sympathy
 - Armorcraftiness
 - Cold-Blooded Fearlessness
 - Empathy of the Newt
 - Hero of the Half-Shell
 - Jingle Bells
 - Patience of the Tortoise
 - Shieldbutt
 - Skin of the Leatherback
 - Tao of the Terrapin
 - Tenacity of the Snapper
 - Toss
 - Wisdom of the Elder Tortoises

Pastamancer
 - Cannelloni Cannon
 - Cannelloni Cocoon
 - Entangling Noodles
 - Flavour of Magic
 - Leash of Linguini
 - Manicotti Meditation
 - Pastamastery
 - Spirit of Bacon Grease
 - Spirit of Cayenne
 - Spirit of Garlic
 - Spirit of Peppermint
 - Spirit of Ravioli
 - Spirit of Rigatoni
 - Spirit of Wormwood
 - Springy Fusilli
 - Transcendental Noodlecraft

Sauceror
 - Advanced Saucecrafting
 - Elemental Saucesphere
 - Expert Panhandling
 - Impetuous Sauciness
 - Jabañero Saucesphere
 - Saucegeyser
 - The Way of Sauce
 - Wave of Sauce

Disco Bandit
 - Advanced Cocktailcrafting
 - Ambidextrous Funkslinging
 - Disco Aerobics
 - Disco Dance II: Electric Boogaloo
 - Disco Dance of Doom
 - Disco Fever
 - Disco Nap
 - Disco Power Nap
 - Heart of Polyester
 - Mad Looting Skillz
 - Nimble Fingers
 - Overdeveloped Sense of Self Preservation
 - Smooth Movement
 - Suckerpunch
 - Superhuman Cocktailcrafting

Accordion Thief
 - Aloysius' Antiphon of Aptitude
 - Carlweather's Cantata of Confrontation
 - Fat Leon's Phat Loot Lyric
 - The Magical Mojomuscular Melody
 - The Moxious Madrigal
 - The Ode to Booze
 - The Polka of Plenty
 - The Power Ballad of the Arrowsmith
 - The Sonata of Sneakiness
 - Ur-Kel's Aria of Annoyance

Gnome Trainer
 - Cosmic Ugnderstanding
 - Gnefarious Pickpocketing
 - Gnomish Hardigness
 - Powers of Observatiogn
 - Torso Awaregness

Mr. Skills
 - Summon Candy Hearts
 - Summon Love Song
 - Summon Party Favor
 - Summon Snowcones
 - Summon Stickers
 - Summon Sugar Sheets
 - Summon Tasteful Items


 > effects

3 of 3 AT buffs active.
♫ The Sonata of Sneakiness
Smooth Movements
Disco State of Mind (2)
Jingle Jangle Jingle (4)
♫ Fat Leon's Phat Loot Lyric (7)
♫ The Moxious Madrigal (7)
Peeled Eyeballs (8)
Leash of Linguini (9)
Butt-Rock Hair (10)
On the Trail [zombie waltzers] (29)


 > modifiers

ML: +10
Enc: -20.00%
Init: +0.00%

Exp: +3.00
Meat: +30.00%
Item: +100.00%


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
Here's one more excerpt. Requesting 20 MP, it uses 1 remaining seltzer in inventory, then goes to Galaktik to finish.

I don't think that mafia is unaware that I have the KGE uniform in inventory, because when I manually instruct to buy seltzer, mafia switches outfits just fine. I do have a pilgrim shield equipped, so it is the case that I lose max HP by changing outfits. But I submit that the cost of losing (and possibly having to re-obtain) the HP may well be less than the extra cost to use Galaktik instead of seltzer.

By the way, I am using Universal recovery 3.52 and KoLmafia build 8066.

Code:
 > Calling Universal Recovery for type=MP, amount=10
 > Restoring MP! Currently at 108 of 108 HP, 9 of 82 MP, current meat: 6258 ... Target MP = 10.
 > Try to heal MP from inventory.

use 1 Knob Goblin seltzer
You gain 11 Mojo Points

cast 1 Smooth Movement
You acquire an effect: Smooth Movements (duration: 10 Adventures)
 > Calling Universal Recovery for type=MP, amount=20
 > Restoring MP! Currently at 108 of 108 HP, 10 of 82 MP, current meat: 6258 ... Target MP = 20.
 > Try to heal MP from inventory.

use 1 Knob Goblin seltzer
You gain 11 Mojo Points

cast 1 The Sonata of Sneakiness
You acquire an effect: The Sonata of Sneakiness (duration: 10 Adventures)
 > Calling Universal Recovery for type=MP, amount=24
 > Restoring MP! Currently at 108 of 108 HP, 1 of 82 MP, current meat: 6258 ... Target MP = 24.
 > Try to heal MP from inventory.

use 1 Knob Goblin seltzer
You gain 11 Mojo Points
 > Last attempt to purchase MP with meat.

Restore 12 MP at Doc Galaktik's
You gain 12 Mojo Points
You spent 204 Meat
 > Calling Universal Recovery for type=MP, amount=40
 > Restoring MP! Currently at 108 of 108 HP, 24 of 82 MP, current meat: 6054 ... Target MP = 40.
 > Try to heal MP from inventory.
 > Last attempt to purchase MP with meat.

Restore 16 MP at Doc Galaktik's
You gain 16 Mojo Points
You spent 272 Meat
outfit Knob Goblin Elite Guard Uniform

buy 10 Knob Goblin seltzer at market price from Knob Goblin Laboratory
You acquire Knob Goblin seltzer (10)
You spent 800 Meat
custom outfit Backup
 
Last edited:
Back
Top