Bug - Fixed Custom Combat antidote use causing aborts when antidote unavailable

taltamir

Member
If your custom combat script is set to cure poison via the special commands, then it will automatically try to buy anti-anti-antidote from galaktik and keep some in stock for mid combat use.

If galaktik is unavailable (ex: zombie slayer, nuclear autumn, or kingdom of exploathing paths) it will result in an error when trying to buy which results in aborted automation. As well as aborting something like
"adv * Daily Dungeon"
with the error message:
You need 1 more anti-anti-antidote to continue.
 

taltamir

Member
What do you want to happen instead?
I see two ways to fix it:
1. If CCS fails to buy an antidote from galaktic, just give a warning instead of aborting. This does mean that if you are in a path that allows galaktic but are too poor to buy antidote that it could potentially go into combat without one which mean the attempt to get rid of poison mid combat fails. But that seems like a very rare case, and even if it does happened all that happens is that automation stops in the combat and you have to finish said combat manually. And its not like you could have bought one manually anyways in that scenario.

2. The CCS related function that automatically buys antidote should check path, and if it is in zombie slayer, nuclear autumn, or kingdom of exploathing then it should skip trying to buy antidote. This will need to be updated whenever a new path that doesn't allow galaktic is added
 

lostcalpolydude

Developer
Staff member
3. If you are relying on this setting to avoid getting beaten up, and antidotes are not available, forcing you to deal with it might save a lot more headache than pretending you don't actually care just because they aren't available. Forcing user interaction, likely leading to disabling the setting for that ascension, could be the best option.
 

Veracity

Developer
Staff member
I think I agree with that. If you can't buy antidotes, turn off that option in the Custom Combat window. Problem solved.
 

fronobulax

Developer
Staff member
While I agree that this can be handled by changing settings, I will note that there are a couple places already where the path short circuits any attempt to consider antidotes. GLover is one such path.

That said, if I am correct in my belief that they can drop from a Cubeling in KoE or be pulled in softcore, then IMO mafia should not prevent one from being considered for use, if they are available.
 

taltamir

Member
3. If you are relying on this setting to avoid getting beaten up, and antidotes are not available, forcing you to deal with it might save a lot more headache than pretending you don't actually care just because they aren't available. Forcing user interaction, likely leading to disabling the setting for that ascension, could be the best option.
A. I am not "pretending" that I don't care, I think that antidotes are cheap enough and used rarely enough that it is really not an issue. Additionally as I said, even if it happened it just results in auto combat aborting and you manually finishing the combat.

B. Option 2 is the one that addressed the possibility that it is actually an issue. Which was to only skip buying an antidote only in challange paths where buying antidotes is impossible. While still using them if you have one in inventory.
That said, if I am correct in my belief that they can drop from a Cubeling in KoE or be pulled in softcore, then IMO mafia should not prevent one from being considered for use, if they are available.
Exactly, yes. Even in paths where you can't buy antidotes you can sometimes get one as a drop or as a pull.
Hence my suggestion to just not try to buy them from galaktik in paths where it is impossible, while still allowing their usage if you got one anyways.

To clarify a bit further.
Have a function canGalaktik();
That function determines if your path allows galaktik or not.

Then for the CCS, still have the function where it uses antidote if you are poisoned, but change the function that auto buys antidotes to only attempt buying if canGalaktik() == true
because otherwise it is attempting to buy from a non existent merchant and erroring out, aborting whatever you are doing at the time.

And its not like there is any reason why you would want to try and fail to buy from a shop you know doesn't exist in the path you are in.
At most you would want to include an option that aborts intentionally with a clear error message saying something like "CCS tried to buy an antidote but it cannot be bought in this path, disable CCS antidote use and try again". But even then that is not ideal as fronobulax pointed out as you could get antidote as a drop or a pull. (although I really wouldn't get antidote as a pull)
 
Last edited:

lostcalpolydude

Developer
Staff member
You are ignoring the scenario where a player will get beaten up, repeatedly, if they assume they can remove poison but fail to do so. Making it impossible to actually run turns without addressing the situation saves them from wasting lots of turns, since they can change their CCS, their gear, or something else. That is the type of player I assume the setting is for. Your solution of only skipping the purchase when they can't be bought doesn't prevent them from getting beaten up repeatedly.
 

Malibu Stacey

Active member
You know you can just use moods to do this right? You don't need to rely on CCS. Hell write a .ash which deals with this yourself & set it to your preAdventureScript & you don't even need to use moods. There you go, full control over literally everything.
 

Veracity

Developer
Staff member
Not quite.

Unpoisoning between fights can be handled with moods or scripts, but the CCS special actions - including using antidotes to remove poisoning - are used while you are in combat. The "buying antidotes" thing happens between battles, of course, since you can't just run of to Galaktik in the middle of combat. Stocking up on antidotes between fights will abort automation if you can't get an antidote, which is what the OP was pointing out.

Personally, I've never wanted to use that; if a monster poisons me, I prefer to just kill the poisoner faster and unpoison myself with a mood or something when the combat is done, rather than spending a round using an antidote, only to get immediately poisoned again. Especially since I can unpoison myself with a skill, rather than buying an antidote.

But, KoLmafia tries to cater to many kinds of playstyle - not just mine.
 

taltamir

Member
You are ignoring the scenario where a player will get beaten up, repeatedly, if they assume they can remove poison but fail to do so. Making it impossible to actually run turns without addressing the situation saves them from wasting lots of turns, since they can change their CCS, their gear, or something else. That is the type of player I assume the setting is for. Your solution of only skipping the purchase when they can't be bought doesn't prevent them from getting beaten up repeatedly.
1. I did not ignore that scenario, I addressed it twice already. I said that they will not be beaten up at all, rather what will happen is that CCS will try to use the antidote, find none, and then abort with something similar to "tried to use antidote but none was found" (which is my experience what happens when CCS tries to use an item you do not have enough of in stock, although you can bypass that error by having an if function in CCS to test if you have it in stock first before trying, and I am not sure if CCS does that for antidote, but if it does use such an if function it should be disabled to ensure it actually aborts... ill test it and edit).

Your solution of only skipping the purchase when they can't be bought doesn't prevent them from getting beaten up repeatedly.
2. My suggestion actually avoids beaten up loops better than the current implementation actually. Even if I was wrong about point 1 and it does not abort mid combat with "no antidote found" (and CCS is not fixed so it works that way)

There are two use scenarios, in a path where you can't buy antidote the odds are exactly the same to enter a beaten up loop.
Because aborting automation when unable to buy antidote doesn't prevent such a loop at all, all it does is make it impossible to use a CCS that has "use antidote" enabled. So the user must disable antidote use in their CCS for such a path, at which point they get caught in the loop exactly the same.

Once you leave that path though, you need to remember to reenable antidote use in your "hardcore" script before switching to another path to avoid beaten up loops. So in that scenario my suggestion actually improves avoiding of beaten up loops.

3. Personally I use that setting myself and I find it convenient when playing as a muscle class.

4. I have always said that mafia needs an "abort on beaten up" option that people can toggle. The only way to do it right now is via mood, but that requires adding that right line into every single mood you use.
 
Last edited:

fronobulax

Developer
Staff member
If I have a CCS that says to use an item and there are no such items to use then the CCS aborts. I'm not convinced a special case for antidotes is needed in KoLmafia for KoE and others paths where it can't be retrieved.

If a CCS is implicitly trying to use an antidote - that is not explicitly specified by the user in the CCS - then that is something to be investigated and is probably a mafia problem.

So, I would like to see an example of a CCS that aborts during combat but does not explicitly use an antidote.

This could be a good example of why consult scripts are sometimes preferred.

The autoAntidote preference is not well documented but it could be set so that mafia would never use an antidote. The preference contains an integer. Poison effects have a integer level and if the effect level is greater (or >= ?) that the preference then antidote will be used. So I'm thinking something like 99 is the equivalent of "don't use an antidote".

Note that moods can be extended so if a scripter develops some processes for building moods from little pieces it should be possible to toggle abort on beaten up for every mood by editing one line in one file.
 

lostcalpolydude

Developer
Staff member
1. I did not ignore that scenario, I addressed it twice already. I said that they will not be beaten up at all, rather what will happen is that CCS will try to use the antidote, find none, and then abort with something similar to "tried to use antidote but none was found" (which is my experience what happens when CCS tries to use an item you do not have enough of in stock, although you can bypass that error by having an if function in CCS to test if you have it in stock first before trying, and I am not sure if CCS does that for antidote, but if it does use such an if function it should be disabled to ensure it actually aborts... ill test it and edit).

So... I have never used this feature, and never will. I thought it aborted when trying to buy them outside of combat. Are you describing what you want it changed to?
 

taltamir

Member
I have done some testing and apparently special action is different from item usage, so my statement that it already would have auto aborted in that stage is incorrect. If you put in CCS "item anti-anti-antidote"
and you have none on hand, it will abort saying it cannot find the item.
However, if you specify special action to remove poisoned, and do not have an antidote on hand, it will just ignore it.

If I have a CCS that says to use an item and there are no such items to use then the CCS aborts. I'm not convinced a special case for antidotes is needed in KoLmafia for KoE and others paths where it can't be retrieved.

If a CCS is implicitly trying to use an antidote - that is not explicitly specified by the user in the CCS - then that is something to be investigated and is probably a mafia problem.

So, I would like to see an example of a CCS that aborts during combat but does not explicitly use an antidote.

This could be a good example of why consult scripts are sometimes preferred.

The autoAntidote preference is not well documented but it could be set so that mafia would never use an antidote. The preference contains an integer. Poison effects have a integer level and if the effect level is greater (or >= ?) that the preference then antidote will be used. So I'm thinking something like 99 is the equivalent of "don't use an antidote".

Note that moods can be extended so if a scripter develops some processes for building moods from little pieces it should be possible to toggle abort on beaten up for every mood by editing one line in one file.
Using a consult script in combat would do nothing to solve this issue. This issue does not occur in combat, it occurs outside of combat.

If you enable the special CCS functionality of remove poison (which incidentally is not specific to a script, so you can't have 1 script with it and 1 without, it is a mafia setting not a part of the CCS)

If you have that enabled then mafia will automatically try to buy antidotes between adventures. This will break automation in paths where antidote cannot be bought.

The only way to make use of mafia automation in those paths is to disable the special action of removing poison. The problem with disabling it are:
1. You could actually acquire one (pulls or drops) and now it will not be used.
2. It is a mafia setting not specific to that CCS, so it will remain off until you turn it back on. Even when you are not in that path anymore, switching CCS from "exploathing" to "standard" will not enable that functionality again, you have to manually turn it on specifically.

The concern was that if mafia will not try and fail to buy antidotes in paths where you can't buy them it will allow a user to get stuck in a loop of losing due to poison. But there is equal chance of being stuck in such a loop either way. If anything the current state has a higher chance of getting stuck in such a loop since you need to disable special action usage of antidotes.

Oh and to clarify, I am talking about this
antidote.png
 
Last edited:

zarqon

Well-known member
I ran into this during my KoE runs. Took me ages of poking around in my various scripts (mood, recovery, etc) before I discovered the issue was actually not script-related. I hadn't changed that setting in so many years I'd forgotten it existed. I disabled it and was fine for the rest of my runs, though now I realize I've since forgotten to turn it back on. I agree with taltamir that mafia automatically forgoing the "purchase" step in specific paths would be a nice feature. Since the setting exists for situations where antidotes are accessible, not preventing automation when they are inaccessible would make things less fiddly.
 

fronobulax

Developer
Staff member
Using a consult script in combat would do nothing to solve this issue. This issue does not occur in combat, it occurs outside of combat.

I remain confused. You repeatedly refer to CCS which to me means Custom Combat Script and those are only invoked in combat. What am I wrong about?

I understood the general problem, that mafia will try and acquire antidotes under circumstances when a) the action was not directly triggered by a user and b) mafia should know, because of path, that the antidote is not available from a NPC.

When I last looked at the code this did not seem as straightforward as it does for other paths. In my confusion it looked like the other path exceptions would prevent antidotes from being used and acquired in that path. That is not correct if there are non-NPC ways to acquire an antidote. I suppose I should look at this more carefully or just overcome my aversion to a fix that perpetuates a minor bug.
 

adeyke

Member
I posted an apparently redundant report on this.

To me, this seems pretty clear-cut. There are two uses for the autoAntidote setting. One is for during combat, via Macrofier.java and FightRequest.java. Those tell Mafia to use the anti-anti-antidote in combat if one is available and if the poison level is above the threshold defined by autoAntidote, with exceptions only for being unable to use it due to Birdform or G-Lover path. The other use is for preparing to adventure, via KoLAdventure.java. That tells Mafia to automatically acquire anti-anti-antidote when adventuring in a zone that has poison above the threshold defined by autoAntidote. This is skipped for the path G-Lover (where the anti-anti-antidote couldn't be used) and for those paths where Doc Galaktik's Medicine Show is unavailable and thus the anti-anti-antidotes can't be automatically acquired. Right now, that's Zombie Slayer and Nuclear Autumn, but Kingdom of Exploathing applies just as much and should get the same treatment.

So the fix, to me, is just adding the line "!KoLCharacter.isKingdomOfExploathing() &&" after line 1376 of KoLAdventure.java.
 

taltamir

Member
I remain confused. You repeatedly refer to CCS which to me means Custom Combat Script and those are only invoked in combat. What am I wrong about?
I will try to explain things more clearly, the issue was not in combat or the CCS itself but a companion functionality that is triggered by enabling a subfeature of CCS.

1. Feature: Custom combat script - this is used in combat, no problems here
-2. Sub feature: Special Action - if you include the line "special action" at the start of your CCS (automatically included in a new CCS file), then calling CCS will also apply and integrate various special actions as defined by the special action rules. Special action rules are tracked per account, not per CCS.
--3. Sub-sub feature: One of the (off by default) special action rules, is "minimum poison level for antidote use", setting it to anything other than "no automatic use" will make it so that CCS with special action enabled will automatically use antidotes intelligently in combat which are resolved via CCS
---4. companion functionality: General mafia pre-adventure script will automatically perform the CLI command "acquire anti-anti-antidote" before each adventure if you enabled feature number 3 explained in the line above. Which causes mafia to error out of whatever it was doing.

As such whenever I tried to click "begin" to do multi adventure in a zone in exploathing, or run any script that does not disable CCS, the result was that that mafia immediately errored out and I could not use it.

It took me quite a while to track down the source of the problem to being caused by this companion functionality (number 4) of the sub feature (number 3) of the CCS.

Once I found it I realized that if this feature is enabled, I cannot use core mafia functionality in exploathing.
I have to manually disable that feature at the start of every exploathing run, and manually enable it after breaking prism. Because leaving it enabled just makes mafia error out.

I was suggesting that this companion functionality (4) automatically exclude paths in which it does not work instead of users needing to first track down the cause of mafia not working, and then disable the feature at the begining of the run and enable it after breaking prism.

However I did not realize at the time that mafia already disabled this functionality automatically for paths in which galactic is unavailable (nuclear autumn and zombie slayer), making this an exploathing specific issue.

edit: well, I also at some point suggested completely doing away with number 4 in all paths but that was a bad suggestion. My bad there.
 
Last edited:
Top