Bug - Not A Bug KoL combat macros abort on limited use combat items with no message

AlbinoRhino

Active member
You might suggest a change to BALLS.

"hascombatitem" tells you if you have it available to try, but for limited usage items, that is not enough.
How about a "canusecombatitem" predicate, which tells you that you not only have it, but have not maxed out its daily uses?

This was one of the main reasons I switched to a consult.ash, way back when. BALLS is too limiting.
 

Veracity

Developer
Staff member
I've changed the title of this, now that we have diagnosed the problem, and marked it "not a bug".

KoLmafia correctly macrofies whatever you have in your CCS, whether or not you have a consult script. That is new, which is why you didn't see this issue before. If you have BALLS macro statements in there, KoL will do whatever you tell it to do - and it is your responsibility to make that be what you intend for it to do.

You can have as many consult scripts as you want; if one does a few things and returns with the combat unfinished, the next one will take over. Your putty handler section would be easy enough to consultify.
 

AlbinoRhino

Active member
Just to clarify, whether you write the CCS in mafia CCS commands, or KoL Balls, it all ends up as BALLS ? If you write in BALLS, does it have to be in quotes ?
 

Veracity

Developer
Staff member
Both CCS and BALLS statements end up as BALLS.

If you put quotes around a line, it explicitly tells KoLmafia that it is a BALLS statement. There is a specific group of BALLS statements that we recognize immediately as such. Also, if you have a ";" in your line, that is assumed to be multiple BALLS statements. Here is the method:

Code:
	public static final boolean isMacroAction( String action )
	{
		return
			action.startsWith( "scrollwhendone" ) ||
			action.startsWith( "mark " ) ||
			action.startsWith( "goto " ) ||
			action.startsWith( "if " ) ||
			action.startsWith( "endif" ) ||
			action.startsWith( "while " ) ||
			action.startsWith( "endwhile" ) ||
			action.startsWith( "sub " ) ||
			action.startsWith( "endsub" ) ||
			action.startsWith( "call " ) ||
			action.startsWith( "#" ) ||
			action.startsWith( "\"" );
	}
Now, there are CCS statements that are also BALLS statements - "skill", "use", etc. - which translate directly to BALLS. KoLmafia will do preprocessing on some of them - auto-Funkslinging on "item" (which translates to "use"), for example, as discussed elsewhere, or treating pickpocket as "try to steal an item", which will not attempt it, if it thinks the monster has no items. So, if you want to force the BALLS behavior, you can surround the statement with quote. "pickpocket" will pass that statement verbatim in the generated macro, but pickpocket without the quotes may be completely suppressed, if KoLmafia thinks it is pointless.

Generally, you can omit the quotes.

Until a few days ago, simply having a consult script called in your CCS meant that no CCS -> BALLS processing happened for any of your CCS; you could write BALLS statements before you said "consult" and we'd bail on macrofying it. Instead, we'd execute each line of the CCS and, eventually, get to the "consult" line, and call it. Since we'd ignore the BALLS statements - as listed in that method - we'd only do the lines that looked like CCS lines. In many cases, that was fine: if you wrap a "skill XXXX" line in an "if hasskill" and "endif", we'd try to do the skill - and since KoLmafia already suppressed it if you didn't have the skill, it would work as you expected.

I fixed it, in response to another bug, such that we macrofy all the statements up to the "consult", call the consult script, macrofy all the statements following it up to the next consult, and so on. And now, people who mixed BALLS with consult scripts are actually having their BALLS interpreted by KoL itself, with surprising results, perhaps. As this thread shows. :)
 
Hmm a canusecombatitem routine would be definitely nice, but that's not really why I decided to chip in:

I had a BALLS macro that uses all my free kills under certain conditions (running fishy in the ice hole, fighting sandworms with squint active, that sort of thing). It ended with me funkslinging a replica bat-oomerang and a power pill. This works just fine as far as kol is concerned: the bat-oomerang kills the monster if you have daily uses left, and you get the usual error message if you don't, but then the power pill will do the job. However this does break mafia normal automation, halting after every combat finished in this way, and it took me a while to figure out that's what was causing it, because as mentioned, kolmafia doesn't give a very informative error about the problem, and running the fights manually (just clicking previous adventure over and over) nothing strange comes up. Currently, I split the two so that I can comment out the bat-oomerang and power pills separately as needed, but a change to this would be appreciated.
 

Veracity

Developer
Staff member
So, what is "the problem" that KoLmafia doesn't report? You said that KoL "gives the normal message" for the bat-oomerang and then does the power pill. So, it does not abort the macro? What does KoLmafia say when it "halts" normal automation?

Can I see your macro, please?
 

Veracity

Developer
Staff member
I think I will make it recognize the "(Macro aborted.)" message - which is generated by KoL - and tell you that before the "You're on your own, partner" message.
 

AlbinoRhino

Active member
Thanks Veracity. This explains a lot of things from when I was mixing the two languages. Specifically how the "quoted" material wasn't being passed through as I thought. Now, I just have everything in my consult, but I might have to try this out again !

Not that it matters ... two other limitations that made me quit BALLS was the 37 round limitation and the lack of a "using_familiar" predicate. I was maintaining multiple versions of the same script to be used with different familiars ! Sometimes you could match the text on the page, but other times it required a different script with stasis logic included or something, just to use a different familiar. I'm so glad you made ASH ! :D
 
Code:
if (reasons to use free kills)
  if hasskill 7265
    skill 7265 #Fire the Jokester's Gun
  endif
  if hascombatitem 8829 || hascombatitem 8300 
    use 8829, 8300 #replica bat-oomerang, Power Pill
  endif
  if hasskill 149
    skill 149 #shattering punch
  endif
endif

It's part of a much larger macro, but this is the relevant snippet.
And the problem is that kolmafia stops the automation, presumably because it detects an abort message when the combat is in fact finished 'correctly'. And then it doesn't actually inform you of this, so when running it manually, you can keep clicking adventure again just fine. I'll try to get some actual samples of the text in a bit, I have to work my way through the tower to finish this run first.
 
Last edited:

lostcalpolydude

Developer
Staff member
Code:
if (reasons to use free kills)
  if hasskill 7265
    skill 7265 #Fire the Jokester's Gun
  endif
  if hascombatitem 8829 || hascombatitem 8300 
    use 8829, 8300 #replica bat-oomerang, Power Pill
  endif
  if hasskill 149
    skill 149 #shattering punch
  endif
endif

It's part of a much larger macro, but this is the relevant snippet.
And the problem is that kolmafia stops the automation, presumably because it detects an abort message when the combat is in fact finished 'correctly'. And then it doesn't actually inform you of this, so when running it manually, you can keep clicking adventure again just fine. I'll try to get some actual samples of the text in a bit, I have to work my way through the tower to finish this run first.

Do you have this failure with automated adventuring, but not when adventuring in the relay browser? I wasn't in mafia at all when trying (and failing) to reproduce your kol bug report.
 
Code:
Round 5: the dictator uses the replica bat-oomerang and uses the power pill!
Round 6: the dictator wins the fight!
You acquire an item: sprinkles (92)
After Battle: You pull out your smartphone to see what time it is. It's getting close to noon.
After Battle: Skipper Toblerone rolls around in the snow suit, giving you any extra items that stick to it.
Your familiar gains a pound: Skipper Toblerone, the 8 lb. Chocolate Lab
After Battle: Gabert surveys the scene from your back, and gains 1 Experience.
After Battle: Skipper Toblerone frolics about chaotically, yipping and yapping.
You acquire an item: gingerbread smartphone
You acquire an item: weathered barrel
After Battle: You gain 53 Fortitude
After Battle: You gain 52 Enchantedness
After Battle: You gain 96 Roguishness
You gain a Moxie point!
You're on your own, partner.

This is what it looks like in the relay browser: https://puu.sh/sOmjk/4f7e91a21d.png (next combat, so not the same sprinkle drop value, and the cursive text from the papier-mitre looks curious but is irrelevant.)
The corresponding HTML is huge, so I put it in a pastebin, because it tries to pass the current state of all combat usable items or something, right between the macro aborted and the you win message: http://pastebin.com/aALeWmpw

So I suspect KolMafia already detects the macro aborted message and therefore, hands control to you, while I would much prefer if it detects the 'you win' message as well as the abort message, and just doesn't halt at all. Printing that it detect the macro aborted message and thats why it halted would still have helped me figure out what was wrong, because currently, it's practically indistinguishable from losing access to the zone or something like that. The current functionality is working just as intended, so this is not a bug report, more of a feature request.

@lost, I don't think I've sent a bug report about this, so I dunno what you are asking about. The abort happens either way, it's mafia not continuing after it that I would like to see changed.
 
Last edited:

Veracity

Developer
Staff member
Yeah, if you win the combat, the fact that the macro aborted should not count as a failure.
 

Veracity

Developer
Staff member
Try revision 17526. If the nextAction is "abort" (because a macro failed, for example), if the fight is over, we should not report "You're on your own partner".
 
Top