Need help with a Hardcore recoveryScript

Re: Hardcore recoveryScript

OH! That explains everything! THANKS!

I was under the misconception that mafia only calls the recovery script when Hp/Mp are under the predefined limits. Well, it looks like a teeny-tiny bit of additional logic is necessary.

It seems that this is even more powerful than I had previously understood. So, I could use it to adjust healing levels on the fly in based on how much damage a monster can do in the zone I last adventured in. I don't think I'll get quite that adventurous though.

Back to development/bugtesting.
 
Re: Hardcore recoveryScript

Suggestion here... It seems to me that recovery would be more useful if it was done before adventuring, rather than afterwards. This is particularly highlighted by this:

[quote author=jasonharper link=topic=1994.msg9811#msg9811 date=1227087521]
It's not required to implement the same threshold/target levels as the built-in recovery mechanism, it could choose to vary those levels based on your stats, the area you're adventuring in, etc.
[/quote]

As it is, targets would be changed based on the LAST zone you adventured in. It would be a lot more useful if they could be based on the zone you are attempting to adventure in NOW. That would be useful since you could set higher thresholds based on how much damage is expected in a given zone. What do you think? Is that too difficult a change to implement? I'm not attempting this right now, but I think someone else will want to eventually.
 
Re: Hardcore recoveryScript

As far as I can tell, the recoveryScript is being called both before and between adventures, and my_location() has already been set to the new location before the first call - I think that's exactly what you want.

Note that mafia uses different recovery rules when adventuring in a 100% noncombat area - MP isn't restored at all, and HP is only restored if zero. I'm not sure if the recoveryScript would get called for every adventure in that situation.
 
Re: Hardcore recoveryScript

Actually that is only true if not using the relay browser. I've got the debug output from my recovery script to prove it. ;) When adventuring in the relay browser, it only attempts to recover hp/mp after a battle. That would seriously hamper potential usefulness of future recovery scripts in the relay browser.

(And I like to use the relay browser a lot so that I feel like I'm actually playing the game.)

In other news: I really wanna play KoL, but debugging this script makes playing a nightmare... My worst moment was discovering that it wasn't checking disco rests properly when it decided to spend an adventure taking a nap instead of gathering a !pipe. After that I realized I'd just have to accept a few extra days this ascension.
 
Re: Hardcore recoveryScript

The first few days of this ascension/bugtest were a brawl where I felt I was struggling against mafia's newfound desire to mess up my run instead of healing sanely, but now I find it feels more like a smoothly choreographed dance where mafia easily follows my lead, always sensing how I'd want it to heal me without needing to actually command it.

I can't begin to say how happy I am to have gotten over the hump. Not perfect yet, but getting there. Auto-adventuring using a combo of both this and fight_optimizer is kinda amusing in a way that makes me feel a little unnecessary. I wonder if that's how bashy used to play.

Incidently, what is the best way to figure out my best gear for -mp cost? There doesn't seem to be a numeric_modifier() for that. Do I need to make a list of all gear that decreases mp cost and then check my inventory for it?
 
Re: Hardcore recoveryScript

The modifiers you're looking for are "Mana Cost" (for things limited to a total of -3) and "Stackable Mana Cost" (not sure that there's anything hardcore-relevant in that category). But you are aware that there's a preference to have mafia automatically equip such items when casting buffs, right?
 
Re: Hardcore recoveryScript

[quote author=jasonharper link=topic=1994.msg9879#msg9879 date=1227432136]
The modifiers you're looking for are "Mana Cost" (for things limited to a total of -3) and "Stackable Mana Cost" (not sure that there's anything hardcore-relevant in that category). But you are aware that there's a preference to have mafia automatically equip such items when casting buffs, right?
[/quote]

Ah. I can use numeric_modifier() then! What exactly is the difference between "mana cost" and "stackable mana cost"? Does Arcane in the Brain (HC relevant!) have -3 stackable, but not regular mana cost difference?

Hardcore relevant does reduce the number of relevant items, but there are still quite a few common ones like: stainless steel solitaire, plexiglass pocketwatch, baconstone bracelet, Dreams and Lights, woven baling wire bracelets and a few effects like Radiating Black Body and the Festival of Jarlsberg... Actually there are few enough that I can probably account for them all fairly easily.

I know that mafia can automatically equip such items, but it won't do that until I'm actually casting the relevant spell. I need to know about it beforehand so that I can figure it into my calculations of Tongue of the Walrus vs Canelloni Cocoon and the like. Right now I'm probably doing a sufficient approximation, but I am considering improving that for a future version. Also if I equip the items myself I can ensure that they aren't used instead of an item that effects maximum hp or mp unless current hp and mp are currently below the threshold.
 
Re: Hardcore recoveryScript

The only things with Stackable Mana Cost currently are Arcane in the Brain, and the Vile Vagrant Vestments. Holidays aren't processed via the modifiers mechanism, so the only way in which the Festival of Jarlsberg's effect is visible is via mana_cost_modifier(), and the reduced value of mp_cost() for all skills.

The items that are currently considered for automatic use when buffing are: PLEXI_WATCH, BRIM_BRACELET, SOLITAIRE, WIRE_BRACELET, BACON_BRACELET, BACON_EARRING, SOLID_EARRING, PLEXI_PENDANT. (The Pendant doesn't actually reduce MP costs, it's in the list to make sure it doesn't get removed to make room for another item, possibly losing a song.)

The remaining items with a negative Mana Cost are: the JEW hat, Emblem & Idol of Ak'gyxoth, and navel ring. Also, Dreams and Lights, but since that and Arcane in the Brain can only be acquired by spending adventures, I don't see how they're relevant for your script - if the player happens to have them, the reduction will already be reflected in mp_cost().
 
Since this section of the forum is intended for discussion of scripting, rather than posting scripts, I have changed the title slightly to reflect that and posted my largely finished script in the repository here:

http://kolmafia.us/index.php/topic,2029.0.html

I suppose that is where discussion of the finished script and its future development belongs. My thanks for all the help I received in this thread without which I never would have been able to get this far.
 
Bale, this looks like a fantastic script concept. Here's my suggestion for improvement: create a priority list of the restorers (resting, inventory items, purchased items, mp), and allow the user to edit the list.

For example, a user who was really trying hard to save meat for some big ticket item might want something like
Code:
[MP, REST, INV, PURCHASE]

... while someone who values MP over meat would adventure with
Code:
[INV, PURCHASE, MP, REST]

Clearly not necessary, as the script is already ideal for several users. Just a feature suggestion for the future. :-)
 
[quote author=Sandiman link=topic=1994.msg9963#msg9963 date=1227640627]
Bale, this looks like a fantastic script concept. Here's my suggestion for improvement: create a priority list of the restorers (resting, inventory items, purchased items, mp), and allow the user to edit the list.

For example, a user who was really trying hard to save meat for some big ticket item might want something like
Code:
[MP, REST, INV, PURCHASE]

... while someone who values MP over meat would adventure with
Code:
[INV, PURCHASE, MP, REST]

Clearly not necessary, as the script is already ideal for several users. Just a feature suggestion for the future. :-)
[/quote]

I see your point, but this script is actually a little bit more complicated than that. For instance, it checks to see if you have sufficient restorers in inventory to heal up to your target HP, and if you don't, then it will use canneloni cocoon instead of partially restoring you from inventory.

Still... that is a worthwhile point. Perhaps I could add boolean for Save_mode or perhaps just better support for characters outside of hardcore/ronin. Unfortunately it requires more than a different order of healing.

Could you explain how you like to heal? Do you prefer to rest rather than spend meat? Is there a limit to how much meat you will spend? I can imagine that someone who tries to save his meat will be willing to use some restorers like scrolls of drastic healing and carbonated water lilys, but refuse to use more expensive restorers like New Cloaca-Cola. Such a person might be willing to purchase mmj, but would rather rest in the campground rather than use Doc Galaktik to restore his mp: a tactic I find horrifying.

If you could exactly explain your preferred heuristic for healing, then I might tailor it to something like that.

Right now I'm more concerned with checking to ensure that it won't use your last 4 red pixel potions if you don't have funkslinging, or your last 5 gauze garters/filthy bandages if you do have funkslinging. At the moment I can work around that by simply putting them safely into my closet, but that isn't wonderfully perfect because I could forget to do some promptly. I'd rather it was as elegant as my treatment of anti-anti-antidotes where it always ensures that I keep a couple on hand just in case I need to use one during combat.
 
I wouldn't tailor anything to how I play. ;-) I'm going to horrify a lot of people by saying this, but I alternate adventuring with an NPZR and a sombrero when I'm in HC, so MP is rarely an issue; I heal with skills.

As for keeping pixel potions, etc. on hand, maybe the user could specify that in a global variable. Something like
Code:
int[item] keep_around;
keep_around[$item["red pixel potion"]] = 4;
keep_around[$item["gauze garter"]] = 5;

Easy to modify if you don't like how the script's behaving, easy to access throughout the script. It's not perfect, because it won't take things like funkslinging into account, but you could probably seed keep_around with a function. This is pseudocode, as I don't really know how this would look, but I'm thinking something like:
Code:
void build_keep_around()
{
  if player_has_skill("funkslinging")
  {
   keep_around[$item["red pixel potion"]] = max( keep_around[$item["red pixel potion"]], 4 );
  }
}

The above code would keep at least 4 potions in the player's inventory if they had the funkslinging skill. If the user wanted to keep more than that, it would.

Again, just thoughts. :-)
 
I don't mean to sound dismissive, yet thanks for the offer of help, but that's definitely not how I'm going to do it. That's the obvious part of the job.

Of course it needs to check to see if I have the skill so that it is universal and works with Bad Moon. And I need to check both inventory and closet for the relevant number of items and ensuring a relevant combination of rpp and other. Then I have to decide if it will simply closet the items for me or avoid using them regardless of closeted status. And I need to figure out the best place to institute this check. Obviously it would be easiest to closet the items, but if I did that I would need to worry about confusing people who don't know why it vanished from inventory, so I'm concerned for parts of the script that need to avoid using those items. It's trickier than you think.

It's not something I need help programming. I just need to figure out how I want it done.

This and checks for -mp gear are both on my to-do list.
 
Is there some way to check if the guild store has been opened? This is an issue I've had with accordion thieves and mysticality classes. When I have forgotten to be prompt about opening my guild store I have run into some inappropriate behavior from my script.

I figure mafia must have such a thing since the regular automated recovery has to be able to know this... right?
 
There is no current tracking of whether the guild store is open - if automated recovery tries to buy some MMJ (for example) and you've forgotten to open the store, the attempt fails and it just moves on to the next-best recovery item.
 
I see. Do you have any advice for detecting this? Should I use contains_text(visit_url("guild.php"), "store") ? Can you think of a better way?

Maybe it would be better just to use the mmj and then note failure if the character's meat does not decrease.
 
Back
Top