Tracking undeaths

I'm working on automating some more of my Ed fights, and the problem I'm running into is that in at least two situations - flyering and insults - it is optimal to die a couple times before finishing the fight. The problem I'm having is that I do not know how to keep track of whether, and how many times, I have died in a fight. I'm envisioning having a property that increments for each undeath, and it would be straightforward to revert that counter to 1 in a beforeBattleScript. But I can't think of a way to actually increment the counter when I die. Does anyone have a suggestion? Or a better way to accomplish the same goal?
 
My first thought would be a Post-Adventure script that calls run_combat() to get the html of the fight page, increments the counter if it sees you lost the fight, and resets it if you won.
Something like
Code:
if (run_combat().contains_text("Enter the Underworld")) <increment your counter> else <reset your counter>
 
Last edited:
My first thought would be a Post-Adventure script that calls run_combat() to get the html of the fight page, increments the counter if it sees you lost the fight, and resets it if you won.

My after-adventure script doesn't seem to be triggering until I actually exit the fight (after all my undeaths). Should it be?


I can give you an idea of how I'm doing that right now by giving you a stripped out copy of my existing code. Note that unless you do a custom build of mafia to not auto-abort on HP == 0, you will have to UNDYING due to 30+ rounds.

Hm, I'm not sure if I understand how to use your code, as it appears to execute one adventure at a time with adv1. Right now I use the "adventure" ash command to do all of my adventuring. Could I use the approach of your code and still use mafia's goal-oriented adventuring? Or would I have to handle all the logic of my own adventuring (with while loops and such)? Sorry if that's a dumb question!
 
So, adventure continues until all the specified number of adventures are used (0-cost adventures don't stop adventure), we can't use that here because dying doesn't cause you to lose an adventure, I suspect it'll just abort. I haven't used adventure in a long time because of that, adv1 (when used with 1 adventure) will do the adventure and that's it, no checking of adventures used. So, the first adv1 goes to the location and invokes the default ccs (or consult script if you add it as a parameter). Then we die, the end of the adventure would trigger any postadventure script, hence the "disableAdventureHandling" (which must be added to your postadventure script if you are using one). Then we visit main.php to check if we are in the UNDYING choice adventure. If we are not, we killed the monster. If we are, it repeats the process up to two more times.

As for mafia's goal-oriented adventuring, I assume it would work with it but I've never used it and don't even know how it works.

Seems like the cool kids are all using adv1(). Thanks for the explanation!

I don't think the goal-oriented adventuring would work with this approach, since as far as I know it relies on adventure(), which, based on these conversations, doesn't seem capable for detecting an Ed death.
 

Theraze

Active member
You could use adv1 with goals, but it would always return that the boolean response from adv1() would always return false unless it happened to be the adventure that managed to accomplish your goal. That means you'd need to evaluate whether you were actually beaten up or just failed to get your goal, on every adventure.

But it can be done. Just expect a spammy gCLI window.
 
Top