Universal Recovery Script

mredge73

Member
You guys continue to remind me how much I don't know...
Thanks for that, I often wonder what info you guys are holding to yourself.

Any chance that cookie.ash could get updated to auto adventure there when the counter expires instead of aborting?
 

Bale

Minion
Well, since you're asking... here's my personal counter script. It does that and.. well.. everything else also.

Code:
// CounterKeeper v1.0
// Thanks to those whose work has been absorbed to make this: 
//    jasonharper, StormCrow42, Alhifar, Ankorite, antimarty and Miser.
// Revisioned and reconstructed by Bale.

// To use:
// set counterScript = CounterKeeper.ash
// set wormwoodGoal = objective
//     objective can be any wormwood prize or stat. (eg. moxie51 or cancan skirt) 
//     You can add 51 or 1 to a stat to limit the turns you get your stat adventures.
//     This script is very good at figuring out what you mean, so you can just type "cancan" or "skirt".

// Supported Counters:
//  - Fortune Cookie: If you're not in hardcore it will get the available semi-rare with highest mall price.
//  - Wormwood: Will automatically get the wormwood goal of your choice. You can set the goal in CLI with:
//         set wormwoodGoal = xxx
//         where xxx is a stat or item. (Optionally add 951, 51 or 1 to limit the turns spent on stats.)
//  - Dance Card: Will adventure in Ballroom, if you're not already there and use another dance card.
//  - Get Steel Organ: Will adventure in the Friar's Gate and then try to use the organ, if possible.
//  - Dude Ranch Vacation, Tropical Island Vacation, Ski Resort Vacation:
//         Will abort automatic adventuring and alert you that the vacation is ready to produce a tower item,
//         but it will not adventure there automatically so you can purposefully schedule those 3 turns.
 

Attachments

  • CounterKeeper.ash
    15.4 KB · Views: 40
Last edited:

Spiny

Member
Something unexpected occurred, but in a way, I'm happy about it...

My HC account is in day 3 of her BM run and I fired off the script today...

Code:
> restore hp

_BalesUniversalRecovery => 3.333
228 prices updated from http://zachbardon.com/mafiatools/updateprices.php?action=getmap
0 prices updated from http://nixietube.info/mallprices.txt
Pricelist updated.
Restoring HP! Currently at 23 of 77 HP, 13 of 29 MP... Target HP = 77, current meat: 1019.
Restoring MP! Currently at 23 of 77 HP, 13 of 29 MP... Target MP = 14, current meat: 1019.
Try to heal MP from inventory.
Last attempt to purchase MP with meat.
Visiting Doc Galaktik...

Restore 59 MP at Doc Galaktik's [B][color=red]Why so much?[/color][/B]
Cure purchased. [B][color=blue]Not really, thank goodness[/color][/B]
Cannot spend meat to fully restore MP! Please check preferences for allowable MP restoratives.

My MP trigger is 50% of MP. 50% of 29=14.5, so I understand why it fired off during this restore HP and why the reported Target MP = 14. Still wish it would say the word "Trigger" rather than "Target", but at least I understand it now.

What I didn't understand is the restore 59 MP. I can't restore more than my max MP, especially since I have nothing to spend that sort of restored mana on. BM, so no healing skills as a TT.

I suspect this 59 MP is deduced to max MP I can afford to purchase. I have not completed Doc Galaktik's quest so restoration is 17meat/1MP. 17*59=1003. My MP restoratives are correctly set, everything is pretty much selected except for spleen usage items and Marquis de Poivre soda. I didn't change anything so I know I should be able to buy from NPC or mall using your script.

I changed to super-verbose mode and put all but 100 meat in closet and fired it off again:

Code:
> restore hp

Restoring HP! Currently at 23 of 77 HP, 13 of 29 MP... Target HP = 77, current meat: 100.
Will need MP, so restoring it now to improve efficiency.
Restoring MP! Currently at 23 of 77 HP, 13 of 29 MP... Target MP = 14, current meat: 100.
Try to heal MP from inventory.
Last attempt to purchase MP with meat.
Visiting Doc Galaktik...

Restore 5 MP at Doc Galaktik's
You gain 5 Muscularity Points
Cure purchased.
Insufficient meat to fully restore MP without wasting restoratives!

This worked as I figured it might, it restored 5 MP because I was below my Trigger MP and I could only afford 5 MP. This brought me over the Trigger MP, so my next restore hp attempt after taking another 100 meat from closet bought the medicinal herb I expected and wanted.

Script needs a tweak for hardcore mode or do I need to do something different that I didn't think of?

Thanks in advance for help :)

-Spiny
 

Bale

Minion
Code:
> restore hp

Restoring HP! Currently at 23 of 77 HP, 13 of 29 MP... Target HP = 77, current meat: 1019.
Restoring MP! Currently at 23 of 77 HP, 13 of 29 MP... Target MP = 14, current meat: 1019.

My MP trigger is 50% of MP. 50% of 29=14.5, so I understand why it fired off during this restore HP and why the reported Target MP = 14. Still wish it would say the word "Trigger" rather than "Target", but at least I understand it now.
Because it means target, not trigger. I've got an idea what is causing odd results for you... I'll look into it, but it is a complicated interaction. Incidentally, If I'm correct, it won't over-restore MP like that during normal adventuring, only if you explicitly call it with a CLI command. If you restored mana with ash restore_hp(0) or allowed it to trigger itself, then it would work perfectly. I've got an alias that does that, so it has taken me a long time to figure out this problem.

I'm going to have to unravel it. This is not a single line rewrite. It involves something that is entangled in many functions.
 
Last edited:

Spiny

Member
I was doing a bunch of experimental testing with Spiny last night and earlier today. One thing I'm curious about...

What are the ramifications of changing this:

In boolean hp_heal(int target), in the section about if my_mp()<min_mp...

On line 1414, rather than mp_heal(min_mp), instead do mp_heal(mp_autotarget)?

Doing this seems to "fix" the nagging incorrectly reported MP restoration Target when restore hp or restore both is executed in the command line and the mp heal portion fires off.

-Spiny
 
Last edited:

Bale

Minion
Spiny, I think I've tracked down all the parts of that bug. Please try out this new version of universal_recovery. If it survives your testing, then I'll make it an official release.

Note: I did nothing to make this especially Spiny friendly. Make your usual changes. That also means it's also good for anyone else that wants to download it and try it out.
 
Last edited:

Spiny

Member
Ok, this version seems ok.

Looking at the diff file between this version (as is) and the prior version (as is), one of the things you changed was:

Code:
if( (Objective != 0 && my_mp() <= amount) || (objective == 0 && my_mp()<= mp_autoheal))
to
Code:
if( (objective != 0 && my_mp() <= amount) || (objective == 0 && my_mp()<= mp_autoheal))

Should the case change in Objective to objective also be done for the corresponding hp_autoheal line in the else clause? I'm not sure how much case sensitivity matters in ASH.

I tried a bunch of crazy things while testing the script. I went so far as to try to restore 3HP (81/84HP) with no restoratives on-hand and this served as a lesson about the "futile" code and when "fullheal" is called. I know better now then to try that lol.

I've also got a diff file to keep track of coloration I added to the various verbose lines and a bunch of overlooked typos in the comments. I can attach it if you want to bother including them, but I figure it's not really worth your energy.

-Spiny
 

Bale

Minion
I've got typos in my comments!?! Oooo NOES!!!!

ash isn't case sensitive. That change was purely cosmetic. I'm somewhat interested in the coloration you added to the verbose lines. Since that change was largely for you, I wouldn't mind including it. How should I go about reading a diff file?

What about the 3HP restore. Do you think the script acted irrationally, or was it just trying hard to fulfill a ridiculous request? How did you go about instructing it to restore those 3 HP.
 

Spiny

Member
To be honest, I'm not sure how to easily apply changes from a diff file, though I'm sure it could be done somehow :confused:. Pretty sure on Linux it has something to do with the patch command, on windows... I'm not sure, but there's gotta be something.

As for for manually changing, this file doesn't have an overbearing amount of tweaks for a one-time patch or I wouldn't even have suggested it. Some of the changes noted in the diff you actually should NOT include because they simply reflect my options in the script and shouldn't be the global default. Anyhow... I'm attaching it and you can check it out. You can pick other colors if you prefer... I just wanted coloration to be able to see what's going on easier in super_verbose.

The 3 HP thing was just reacting to a ridiculous request, the script is fine, I think :) I was just testing extreme situations. To heal 3HP, with no restoratives on hand, and an explicit request to restore hp in the CLI triggered the futile code and it started looking for a fullheal. With less than 100 meat it bought an ailment ointment and with 100+ meat it bought medicinal herbs, because I have them enabled. This is BM btw. This is not a commonly occurring situation, so I think it's ok.

-Spiny
 

Attachments

  • Universal_Recovery_diff.txt
    5.8 KB · Views: 46

Bale

Minion
Ailment ointment is definitely the correct response in that situation, regardless of the meat on hand. I'll definitely have to look into it, but it is a very low priority.

I'm going with the colors you chose for verbose output, with only a few exceptions. It should look nicer for you now.
 

Bale

Minion
Universal recovery v 3.334 released!


Changelog:
version 3.334 August 26, 2009
  • Improved verbose mode again.
    Probably only one person in the universe cares, but she's verbose about it.
  • Fixed a single bug.


Because there is so little added into this update, the user will not be interrupted in his adventuring and asked to confirm (yes/no) before continuing.
 
Last edited:

evilspoons

Member
Heh. I noticed frequent, strange mall searches with your script, but before complaining I figured I'd check for a new version. Apparently I hadn't updated since v 3.01 - whoops! Glad to see auto-update now :D
 

Bale

Minion
It's changed a bit since 3.01. I was rather surprised to realize it wasn't good enough yet. Glad you updated.

What sort of frequent, strange mall searches?
 

Bale

Minion
Hearing that from another scripter whose work I admire really means something. I'm very happy.
 

Bale

Minion
Oh! Thank you! It'll be a while 'till I'm out of hardcore, but I can't wait to find out what you put in that plain brown wrapper!
 
Top