Recovery Script for Hardcore

Status
Not open for further replies.

Bale

Minion
In build 6461 JasonHarper added support for user defined recovery scripts to over-ride KoLmafia's HP/MP restoration mechanism. When KolMafia version 12.7 was released on Dec 7, 2008, the feature became part of the official release. As long as your version of kolMafia is 12.7 or later, you can use this script.

Finally I have a healing script that supports my style of play. If the user is in HC or Ronin and resources are scarce, they must be used efficiently and thoroughly. Since MP are the most valuable resource it will attempt to use healing items rather than waste them. It allows me to play care-freely yet still recover with utmost efficiency, as if I was micromanaging my healing. This script will account for any combination or lack of skills, so it can be used by any character. Truly unskilled characters can even tell it to waste adventures resting at the campground, though that obviously is not recommended for most characters.

Someone who is used to long softcore farming runs might be a bit dismayed by the scripts propensity to use every single healing item existing in inventory rather than purchase mmj, but the script assumes that meat is valuable and any items in inventory are there for use. If that's a problem, you can put any healing items into your closet to keep the script from using them, but this script is probably not for you, even though you might appreciate the efficient way that it makes use of the nuns. It has a bit of support for aftercore, but really is not primarily intended for that purpose.

Early discussion of this script's development was in this thread. While I am extremely happy with its current abilities, I am always eager to hear comments and suggestions for improvement. Right now I'm working on a variant for farmers, but it requires a lot more work than you'd suspect.

To use this script, put hardcore_recoveryScript in the /script directory and put restore_map.txt in the /data directory. Then in the gCLI type:
set recoveryScript = hardcore_recoveryScript

If you ever want to turn the script off again, use the gCLI command: set recoveryScript =

Updates:
version 1.1 - November 27, 2008
- Various Bugfixes, Various Optimizations, and reserves healing items to fight your shadow.
Now will not use restoratives needed to beat the shadow regardless of them being in the closet. It will reserve 4 red pixel potions if you don't have funkslinging or if you do have ambidextrous funkslinging it will reserve 5 gauze garter and/or filthy poultices.

version 1.2 - December 4, 2008
- More bugfixes and small improvements.
Now it expends adventures resting if checked in preferences -- this is not recommended unless your character is very low skill.

version 1.3 - December 5, 2008
- Found another bug... pesky things! Killed it.
- Multi-cast healing skills instead of casting them once, again and again.
- Will not switch to knob goblin elite guard uniform if that would lower maxMP or HP below current levels.

version 1.4 - December 18, 2008 -- Alert: This version requires updating the mapfile: recoveryScript_map
- Will always attempt to keep one combat usable MP recovery item in reserve, just in case of trouble.
- Some more aftercore/out-of-ronin support:
- If there is mall access, likes to use canneloni cocoon even when there are items to heal hp.
- If you have mall access, but don't have a tongue, tiny houses will be used for curing beaten up ONLY,
that way you can just buy a lot of tiny houses and not worry that they'd be used for healing mp.
- I learned that the boolean returned by use is less useful than I thought it should be. Oops! Bugfix.

version 1.5 - December 28, 2008
- Minor improvements, fixed various and sundry bugs.

version 1.6 - Jan 15, 2009
- Many efficiency improvements and bug fixes.
- Drastically improved healing of small amounts.
- Now will only use a disco rest if you have a campground dwelling of some sort.

version 1.6.1 - Jan 15, 2009
- Fixes two bugs added with the previous update.

version 1.6.2 - Jan 16, 2009
- Fixes one more bug added by the previous update.

version 1.6.3 - Jan 19, 2009
- I hate this bug more than this bug hates me!

version 1.7 - Jan 29, 2009
- Fixed integer round-off bug that was causing the wrong choice of healing skills.

version 1.8 - February 11, 2009
- As of revision 6926 KolMafia added the ability for this script to prevent normal healing. This is important to keep from using up items or free rests that are being reserved.
- Improved handling of aftercore healing.
- If you've got both massage oil and a scroll of drastic healing, it will chose the scroll now.
- Major update to the "combat healing" reserve.
- Properly handle healing at the unlucky entryway. (Or other places where less than default healing is requested.)
- Various bugs that I'm too embarassed to enumerate.

version 1.9 - February 20, 2009
- More fine tuning of the "combat healing" reserve.
- Properly uses SGEEA when beaten up if you don't have Olfaction or tongue.
- Fixed problem with using nuns for recovery with the war is still ongoing.
- What to do when there are only 6 hp left to heal? I figured it out!
- Cast Canelloni Cocoon instead of 2 Walrus Tongues if both will restore full HP.

Version 1.99 FINAL - February 26, 2009
- Reduced CLI feedback since it is irrelevant to most users.
- Fixed a few bugs and generally perfected it.

RecoveryScript_map.txt - February 11, 2009
- Updated to include Nardz energy beverage.

RecoveryScript_map.txt - February 20, 2009
- Updated to include cotton candy items.
 

Attachments

Last edited:
Well I've uploaded a new verison of my recovery script. There were a few bugs that I've fixed (including a silly error with personal massagers). Those bugs are the sort that will definitely make you want to upgrade if you are actually using my script. Is anyone actually using my script?

There's one new feature: Now it will stubbornly refuse to use healing items that you need to fight your shadow with. It doesn't matter if you put them in your closet or not: those items are completely safe from being used by this script. If you don't have ambidextrous funkslinging then it will assume you need 4 red pixel potions. If you do have funkslinging then it will freely use any rpps for healing and assume that you'll stock up on gauze garters and/or filthy poultices to fight your shadow with. (It saves 5 gauze garters/filthy poutices.)
 
A newly updated version now available in the first post. More little bugfixes and optimizations. It works better and doesn't screw up in weird situations anymore.

New Feature: Now it will also allow you to choose to rest at your campsite even if you don't have a free disco nap. I figure some very low skill characters actually need this option, but obviously most people wouldn't want it. This will only take place if it is marked in your HP/MP Usage preferences in your aventure tab so it won't suddenly happen to you unless you were already allowing mafia to do that.

Next update I'm finally going to fix it to cast tongue multiple times at once instead of this nonsene with 1 cast, 1 cast, 1 cast... I have a character without Cocoon testing this script so I know that it is both time consuming and bloody annoying.

By the way: Is anyone actually using this? I notice that 12 people seem to have downloaded the last version so I hope some are actually using it or at least dissecting it for ideas to make their own recovery scripts. If it helps you to make your own script, then good for you.

By the way, if you don't want to see this cluttering up your script directory you can always put it in your base KoL directory instead and use:
set recoveryScript = ..\\hardcore_recoveryScript

I personally prefer that since I never call it directly as I do other scripts in that directory. Or you could make a directory for automatically called scripts...
set recoveryScript = ..\\autoscripts\\hardcore_recoveryScript
 
Just updated the script again and I'm really pleased with a new feature I added.

Now, it will actually check to see what your maximum HP and MP would be if you were to change into the guard uniform to purchase knob seltzer. If this will lower either maximum below your current HP/MP, then it will find another way to recover mps. After all, there's no darn point in purchasing seltzer if you have to lose mp to do it.

This was really bugging me when I was in my War Hippy gear with a wonderwall shield. Big HP boost goes bye-bye every time I bought some seltzer. Heck, just for this one feature it was worth writing the script.
 
Thanks for this! I've always been mostly lazy when it came to restoring my HP and MP, but thanks to you I can actually be SMART about it...what a concept.

Again, thanks for posting this up!
 
Not to sound pathetic or anything, but quite frankly you made my day by telling me that at least one other person is finding this helpful. :D :D :D

I would have made this anyway, just for my own use, but I'm still happy.
 
Wow. I'd decided to stop posting in response to individual thanks, but that was such an awesome thing to say that I had to post and tell you I'm really glad it's helping you so much.
 
It makes me very happy that it is helping you kain.

Okay, big UPDATE!
This update requires you to also update recoveryScript_map.txt in the /data directory!

Sorry, but it was necessary to change my data file. I added several new features and one of them requires more information about the restoratives than was previously available.

Most significantly the script will now keep a combat usable restorative on hand, just in case you need to get some mp in the middle of a fight. I know that happens to me and I suspect it will happen to others as well.

Also, somewhat less significantly, I added more aftercore support. Now you'll find my script checking to see if you can interact with the kingdom (and the mall). If you can, then it changes its behavior in several ways. In aftercore, if you don't have a tongue skill it will now only use tiny houses to cure "beaten up". That means it is safe to purchase a pile of them and know that they won't be used to restore mp. If you have a tongue skill it will use them as normal. It will also be much more willing to spend mp to cast cannelloni cocoon if you have it. Yay for aftercore!

I spent a good bit of time messing around with low skill multis or farming, then changing anything that annoyed me in those situations. This will make my script MUCH more useful for farmers/normal/casual/after core players. I'm wondering if the "hardcore" in my script's name has become a misnomer now. It's really quite a bit more general purpose.

Please don't forget to update the support file in /data or else it won't work right.
 
I'd like to ask some questions of the people who use this script:

How do you feel about the more aggressive behaviors of this script? There are several things it does without permission or question. For instance it will purchase anti-dotes for you just in case you need them in combat later. And now it will refuse to use one mp healing item or even purchase one from a store, just in case you need it in combat later. It will refuse to use hp healing that it thinks you might need against your shadow.

Should a healing script make decisions like this? Would anyone turn any of this off if they could? I could add a boolean variable for people to set to false if they foresee turning off this behavior. I just want to know how many people would disable it.

Also, how do people feel about the aftercore support I've slowly been adding? In case that word is weird to you, that's how many hardcore players refer to the time we spend after freeing the king. Such support also applies equally to people who have gotten out of ronin. Should I continue adding things like this to broaden the usefulness of the script until it is no longer even remotely hardcore specific? If so, please tell me how you wish it would heal you. Do you purchase all your healing from the mall? What do you purchase? (I did some basic surveys using Zarqon's item pricing script to figure out what I thought was best, but prices bobble around a bit.)
 
Well maybe you can include skills to heal yourself: like Cannelloni Cocoon cocoon or so and then use an item to regenerate the mp you used.
 
[quote author=asturia link=topic=2029.msg10552#msg10552 date=1229715271]
Well maybe you can include skills to heal yourself: like Cannelloni Cocoon cocoon or so and then use an item to regenerate the mp you used.
[/quote]

I'm not sure I understand. In what way should that is that different from what it does now?

Right now it will use Cannelloni Cocoon if appropriate (and in aftercore it finds it is often appropriate), then since automatic adventuring calls it for Mp recovery immediately after HP recovery, it will them use items to recover MP if it is below your preferred levels.

Do you mean that in aftercore if it casts any healing, it should always restore up to the previous level of MP, even if it is still below your chosen MP recovery target?
 
[quote author=pierate link=topic=2029.msg10630#msg10630 date=1229894678]
I ran this, and it bought 1082 MMJs, in batches of 3.
[/quote]

Can you tell me what the situation was? Can you interact with the kingdom? How many MP was it trying to recover, or was it purchasing them to get the MP to cast a healing spell? Did it use all those MMJs or did it just leave them in your inventory? Do you mean it purchased 3 every time it ran? Or did it start purchasing three, and then purchasing another three in an unbroken loop until you stopped it. Did this happen before it started trying to recover? What version of my script was this? I really want to fix it so please tell me more.

The only time I ever had something like that happen to me was when I accidently used the wrong version of recoveryScript_map with my recovery script so anything you can tell me would help.
 
[quote author=Bale link=topic=2029.msg10551#msg10551 date=1229713337]
How do you feel about the more aggressive behaviors of this script? There are several things it does without permission or question. For instance it will purchase anti-dotes for you just in case you need them in combat later. And now it will refuse to use one mp healing item or even purchase one from a store, just in case you need it in combat later. It will refuse to use hp healing that it thinks you might need against your shadow.[/quote]

I like these. I always tried to keep a couple of anti-anti's on hand and a couple of mp heals for mid battle, but it's a hassle to do manually. These features kick arse. Same with the shadow.

[quote author=Bale link=topic=2029.msg10551#msg10551 date=1229713337]Also, how do people feel about the aftercore support I've slowly been adding? In case that word is weird to you, that's how many hardcore players refer to the time we spend after freeing the king. Such support also applies equally to people who have gotten out of ronin. Should I continue adding things like this to broaden the usefulness of the script until it is no longer even remotely hardcore specific? If so, please tell me how you wish it would heal you. Do you purchase all your healing from the mall? What do you purchase? (I did some basic surveys using Zarqon's item pricing script to figure out what I thought was best, but prices bobble around a bit.)
[/quote]
I'll let it run this time in aftercore. I usually just (as a myst class) buy 10K MMJs before I ascend so I'll have them for other after-core classes. I don't think I remembered to do that this last time, though. In aftercore, I'm lazy, so my healing consists of whatever Mafia wants to restore MP with and tongue/cocoon for HP.

I'll let you know what I think of the aftercore support in a couple of days.
 
Well I have never seen it cast canneloni cocoon.
that was why I was asking my question.
Maybe I have to pay more attention the next time.
 
[quote author=asturia link=topic=2029.msg10679#msg10679 date=1230066664]
Well I have never seen it cast canneloni cocoon.
that was why I was asking my question.
Maybe I have to pay more attention the next time.
[/quote]

Ah. The conditions under which it casts Canneloni Cocoon are:
1. If there are insufficient restoratives to heal all your HP. It will check to see if there are enough before using any of them. Then it casts Cocoon instead if they wouldn't heal enough HP. That means it only uses Cocoon when you're out of other healing alternatives.

2. In aftercore, it will cast Cocoon anytime you've lost more HP than can be healed with 2 of your most powerful restoratives on hand. (In other words, if the healing isn't negligible it will use Cocoon.) I put this in because MP restoratives are a lot easier to get in aftercore and there are a LOT more HP to heal.

I've been considering if I should also use Cocoon when HP is very low, so that it would save restoratives. I'm not certain how I want to define that though... Perhaps use Cocoon whenever HP is down to 10% or less?

[quote author=kain link=topic=2029.msg10675#msg10675 date=1230058177]
I'll let you know what I think of the aftercore support in a couple of days.
[/quote]

I would truly appreciate that! Please tell me exactly what you would have liked it to do! I really do want a lot of exacting nit-picky advice on this. The more nit-picky you are, the happier I'll be.

The main reason I haven't included more suggestions into my script is that people haven't been specific enough for me to know how to include their suggestions.
 
Status
Not open for further replies.
Back
Top