-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't send empty macros to KoL #410
Conversation
2be12fb
to
26c4757
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be wise to log a message here saying that we're choosing not to submit a blank macro? When does this tend to happen.
Yes, probably not a bad idea, will add a log message. Like I explained in the forum thread, at least for me this seems to happen when I have a custom combat script consisting of a single conditional action (like olfaction or the generic "special action") plus a consult script. When the conditional action doesn't take place (e.g. in the case of olfaction because I've already olfacted something, so Kolmafia seems to directly skip generating an olfaction action in the macro, or in the case of the "special action" because there's no special action scheduled in that round) Kolmafia seems to generate this sort of #mafiaround de facto (but not technically) empty macro, which the |
Sometimes Kolmafia might generate a combat macro which, after optimisation, constists solely of the placeholders #mafiaround #mafiamp #mafiaheader handleMacroAction() then further optimises that kind of macro down into a bunch of newlines, which then cause an "Invalid macro" error when sent to KoL. With this change, we also check that the macro isn't empty *after* the pro- cessing done by handleMacroAction(), and only send it on to KoL if it's truly non-empty.
26c4757
to
68059c7
Compare
Right I see, so it sends that macro then calls your consult script? I wonder if a message will be annoying then. We shall see, and can always remove it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the debug log is smart, thanks.
Would like a test for this if there's an obvious way to do so. It looks like the closest public caller of this method is |
Makes sense, though I might need a little bit to figure out your testing framework and how a test could look like. |
Sometimes Kolmafia might generate a combat macro which, after optimisation,
constists solely of the placeholders
#mafiaround
#mafiamp
#mafiaheader
handleMacroAction() then further optimises that kind of macro down into a bunch
of newlines, which then cause an "Invalid macro" error when sent to KoL.
With this change, we also check that the macro isn't empty after the pro-
cessing done by handleMacroAction(), and only send it on to KoL if it's truly
non-empty.
See also https://kolmafia.us/threads/consult-script-ccs-that-gets-optimised-out-to-nothing-leads-to-invalid-macro-abort.26620/