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

fxer

Member
I seem to be getting aborts on every combat that funkslings now, such as "item 4d camera, miniborg strangler"
 

Veracity

Developer
Staff member
I seem to be getting aborts on every combat that funkslings now, such as "item 4d camera, miniborg strangler"
What do you mean by "getting aborts"? KoLmafia is turning the GUI red and displaying an abort message? What is the message?

To be clear: when you say "every combat that funkslings" such as "item 4d camera, miniborg strangler", you mean:

1) You have a combat filter
2) it returns "item 4d camera, miniborg strangler"
3) The combat "aborts", somehow

Right? If not, then what?
 

heeheehee

Developer
Staff member
If KoL is aborting the macro in fight.php, what's the error message? That should help determine what we're submitting to the browser. Alternately, if you could provide a debug log, that'd help, too.

(CLI: debug on; <do stuff that triggers the abort>; debug off)
 

fxer

Member
After starting battle with a spooky putty monster:

Code:
[645579] Spooky Putty Monster
Encounter: Knob Goblin Embezzler
Strategy: D:\Dropbox\mafia-fxer\ccs\farmit_faxputty.ccs [default]
Round 0: fxer wins initiative!
Round 1: fxer executes a macro!
Round 1: fxer tries to steal an item!
You acquire an item: meat stack
You gain 12 Meat.
Round 2: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 9 Meat.
Round 2: fxer executes a macro!
Round 2: fxer uses the Spooky Putty sheet and uses the Miniborg strangler!
You acquire an item: Spooky Putty monster
Round 3: Knob Goblin Embezzler drops 4 attack power.
Round 3: Knob Goblin Embezzler drops 4 defense.
Round 3: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 10 Meat.
Round 3: You lose 1 hit point
Round 3: fxer uses the 4-d camera and uses the Miniborg strangler!
Round 4: Knob Goblin Embezzler drops 3 attack power.
Round 4: Knob Goblin Embezzler drops 4 defense.
Round 4: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 6 Meat.
You're on your own, partner.
Click here to continue in the relay browser.

the ccs

Code:
[ default ]
try to steal an item
special action
if hasskill fire a badly romantic arrow
    skill fire a badly romantic arrow
endif
consult consult_digitize.ash
if hascombatitem Spooky Putty sheet
    item Spooky Putty sheet, Miniborg strangler
endif
if hascombatitem Rain-Doh black box
    item Rain-Doh black box, Miniborg strangler
endif
if hascombatitem 4-d camera
    item 4-d camera, Miniborg strangler
endif
if hasskill extract
    skill extract
endif
if hascombatitem porquoise-handled sixgun
    item porquoise-handled sixgun, Miniborg strangler
endif
consult wham.ash

Clicking into the relay browser and pressing the "Script" button completes the battle as normal with that CCS, so not sure why mafia is aborting in the middle of it suddenly since I can't get it to fail any other way.

I can try rolling back a few builds of mafia and see if the problem goes away?
 

Veracity

Developer
Staff member
So, wait - you are simply automating a turn via the GUI using your CCS?

OK. I entered your CCS into a "knob goblin embezzler" section of my CCS.

Code:
[color=green]> macrotest knob goblin embezzler[/color]

stopping macrofication due to action: consult consult_digitize.ash
Generated macro:
sub mafiaround
endsub#mafiaround
sub mafiamp
****if hascombatitem 357
********call mafiaround; use 357
********goto mafiampexit
****endif
****call mafiaround; use 518
****mark mafiampexit
endsub#mafiamp
#mafiaheader
pickpocket
if hasskill fire a badly romantic arrow
****if hasskill 7108
********call mafiaround; skill 7108
****endif
endif

stopping macrofication due to action: consult consult_digitize.ash
****action***

stopping macrofication due to action: consult wham.ash
Generated macro:
sub mafiaround
endsub#mafiaround
sub mafiamp
****if hascombatitem 357
********call mafiaround; use 357
********goto mafiampexit
****endif
****call mafiaround; use 518
****mark mafiampexit
endsub#mafiamp
#mafiaheader
if hascombatitem Spooky Putty sheet
****call mafiaround; use 3665,3110
endif
if hascombatitem Rain-Doh black box
****call mafiaround; use 5563,3110
endif
if hascombatitem 4-d camera
****call mafiaround; use 4169,3110
endif
if hasskill extract
****if hasskill 7273
********call mafiaround; skill 7273
****endif
endif
if hascombatitem porquoise-handled sixgun
****call mafiaround; use 8935,3110
endif

stopping macrofication due to action: consult wham.ash
****action***

stopping macrofication due to action: consult wham.ash
1) It submits a macro with everything before "consult consult_digitize.ash"
--> It tries to steal an item
2) It calls consult_digitize.ash
3) It submits a macro with everything after consult_digitize.ash and consult wham.ash
--> It uses the Spooky putty sheet and the 4-d camera
4) It calls consult_wham.ash

At least, that is how it is supposed to act. Your log:

1) It submits a macro and tries to steal an item
2) (Presumably it submitted consult_digitize.ash, which decided to do nothing)
3) It submits a macro and uses the Spooky Putty sheet and the 4-d camera
4) Instead of calling wham.ash, it says "You're on your own, partner."

Huh. I wonder if this is because your first consult script did nothing and you then submitted another consult script? It thought it would be pointless to re-submit it (as it thought), even though it was a different consult script?

I'll look more closely at that code.
 

fxer

Member
Before you actually click the Script button, what's the abort message in the relay browser?

Code:
He actuarializes you in the bung. Argh!
	You lose 1 hit point.

(Macro aborted.)

Veracity: for me it aborts before using extract, then hitting the Script button picks up at 'consult wham.ash' since extract and the porquoise pistol aren't executed directly from my CCS it looks like:

Code:
[645582] Rain-Doh box full of monster
Encounter: Knob Goblin Embezzler
Strategy: D:\Dropbox\mafia-fxer\ccs\farmit_faxputty.ccs [default]
Round 0: fxer wins initiative!
Round 1: fxer executes a macro!
Round 1: fxer tries to steal an item!
You acquire an item: meat stack
You gain 12 Meat.
Round 2: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 6 Meat.
Round 2: fxer executes a macro!
Round 2: fxer uses the Spooky Putty sheet and uses the Miniborg strangler!
Round 3: Knob Goblin Embezzler drops 5 attack power.
Round 3: Knob Goblin Embezzler drops 5 defense.
Round 3: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 6 Meat.
Round 3: Organ Bump N' Grinder climbs up and sits on your shoulder, and hands you some Meat. Huh, where did he find that?
You gain 74 Meat.
You're on your own, partner.
Click here to continue in the relay browser.

Base round: 0 damage, 0 player damage, 75 meat
WHAM: Monster HP is 55.0.
WHAM: Running SmartStasis
Round 3: fxer executes a macro!
Round 3: fxer uses the Rain-Doh blue balls!
Round 4: Knob Goblin Embezzler takes 14 damage.
Round 4: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 5 Meat.
Round 4: fxer casts EXTRACT!
You acquire an item: Source essence
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 1-shot with attack with your weapon.
Round 5: fxer executes a macro!
Round 5: fxer attacks!
Round 6: Knob Goblin Embezzler takes 43645 damage.
Round 6: fxer wins the fight!
After Battle: Organ Bump N' Grinder rolls around in the snow suit, giving you any extra items that stick to it.
After Battle: Sarah, Plain and Medium surveys the scene from your back and sighs.
After Battle: Organ Bump N' Grinder sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 14666 Meat
You acquire an item: meat stack
You acquire an item: meat stack
You acquire an item: meat stack
You acquire an item: Knob Goblin visor
You acquire an item: embezzler's oil
After Battle: You gain 13 Muscleboundness
After Battle: You gain 10 Magicalness
After Battle: You gain 30 Sarcasm
 

Veracity

Developer
Staff member
It picked up at "consult wham.ash" since everything prior to that was macrofied and submitted to KoL, so we assumed it was all executed.

(Macro aborted.) is generated by KoL itself; that string does not appear anywhere in KoLmafia.

I see that we macrofy "extract" like this:

Code:
if hasskill extract
    if hasskill 7273
        call mafiaround; skill 7273
    endif
endif
And apparently KoL looks at that and decides to abort. Seems like we could/should be more concise and not generate the nested ifs, but I am surprised that KoL couldn't handle it.
 

Veracity

Developer
Staff member
Something to try:

Just say

skill extract

Rather than wrapping it in "if hasskill ... endif", since KoLmafia will wrap it itself.
 

Veracity

Developer
Staff member
By the way - this has nothing to do with the Funkslinging. This has to do with how KoLmafia now macrofies your CCS up to your consult script, which is similarly new. Try this:

set MacroDebug=true

and let's see exactly what the macro was that KoL decided to abort on. It should be the same one I generated using the macrotest command, but let's check that.
 

fxer

Member
Code:
Using 1 shaking 4-d camera...

[646043] shaking 4-D camera
Encounter: Knob Goblin Embezzler
Strategy: D:\Dropbox\mafia-fxer\ccs\farmit_faxputty.ccs [default]
Round 0: fxer wins initiative!
stopping macrofication due to action: consult consult_digitize.ash
Generated macro:
abort hppercentbelow 15
sub mafiaround
endsub#mafiaround
sub mafiamp
****if hascombatitem 1965
********call mafiaround; use 1965
********goto mafiampexit
****endif
****if hascombatitem 1788
********call mafiaround; use 1788
********goto mafiampexit
****endif
****if hascombatitem 345
********call mafiaround; use 345
********goto mafiampexit
****endif
****call mafiaround; use 347
****mark mafiampexit
endsub#mafiamp
#mafiaheader
pickpocket
if hasskill fire a badly romantic arrow
****if hasskill 7108
********call mafiaround; skill 7108
****endif
endif

Round 1: fxer executes a macro!
Round 1: fxer tries to steal an item!
You acquire an item: meat stack
You gain 12 Meat.
Round 2: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 11 Meat.
Round 2: Organ Bump N' Grinder climbs up and sits on your shoulder, and hands you some Meat. Huh, where did he find that?
You gain 65 Meat.
stopping macrofication due to action: consult consult_digitize.ash
stopping macrofication due to action: consult wham.ash
Generated macro:
abort hppercentbelow 15
sub mafiaround
endsub#mafiaround
sub mafiamp
****if hascombatitem 1965
********call mafiaround; use 1965
********goto mafiampexit
****endif
****if hascombatitem 1788
********call mafiaround; use 1788
********goto mafiampexit
****endif
****if hascombatitem 345
********call mafiaround; use 345
********goto mafiampexit
****endif
****call mafiaround; use 347
****mark mafiampexit
endsub#mafiamp
#mafiaheader
if hascombatitem Spooky Putty sheet
****call mafiaround; use 3665,3110
endif
if hascombatitem Rain-Doh black box
****call mafiaround; use 5563,3110
endif
if hascombatitem 4-d camera
****call mafiaround; use 4169,3110
endif
if hasskill extract
****while mpbelow 5
********call mafiamp
****endwhile
****if hasskill 7273
********call mafiaround; skill 7273
****endif
endif
if hascombatitem porquoise-handled sixgun
****call mafiaround; use 8935,3110
endif

Round 2: fxer executes a macro!
Round 2: fxer uses the Spooky Putty sheet and uses the Miniborg strangler!
Round 3: Knob Goblin Embezzler drops 3 attack power.
Round 3: Knob Goblin Embezzler drops 3 defense.
Round 3: "Ah yes!" Sarah, Plain and Medium says, "This meat was right where I predicted it would be!" She then hands you some meat.
You gain 7 Meat.
You're on your own, partner.
Click here to continue in the relay browser.

I realized too late that this ccs still had a 'if hasskill extract' in it instead of just 'skill extract' like you mentioned trying and I don't have more putties etc to test with today
 
Last edited:

Veracity

Developer
Staff member
Interesting.

Code:
if hasskill extract
    while mpbelow 5
        call mafiamp
    endwhile
    if hasskill 7273
        call mafiaround; skill 7273
    endif
endif
That is trying to restore your mp, it looks like. While your mp is below 5, it will call mafiamp. mafiamp attempts to use various items to do that. So, what if you don't have those items? It never gives up.

I expect that KoL will, by and by, abort.

The items it is looking for:

1965 - bottle of Monsieur Bubble
1788 - unrefined Mountain Stream syrup
345 - Knob Goblin superseltzer
347 - Dyspepsi-Cola

It checks if you have the first three before using them. It does not check for the last one.

The Wiki says "If you don't have any of the items you're trying to use – or if you try to funksling the same item twice, but only have one of them – the macro will abort."

I would guess that you have none of the combat items and it aborted trying to use a Dyspepsi Cola.

1) KoLmafia's "restore MP during combat" generates the "mafiamp" subroutine based on which combat-usable items you have in your MP restoration.
2) Apparently, it does not verify that you have any of them.
3) It will loop repeatedly until it restores enough. Forever, potentially.
4) KoL will abort if it can't find the last item. Perhaps instead KoLmafia should abort and say "I couldn't restore enough MP to cast a skill in battle.

I'm going to have to think about this - and, in fact, I will split this off into a new Bug Report - but I think your solution is to auto recover MP between battles. Use the HP/MP Usage panel.
 
Last edited:

Veracity

Developer
Staff member
Looking more closely at how we generate that macro:

1) We list MP restoration items in the order they appear in the list of all such items - not just the ones you can configured to use. That order is from "restores most MP to restores least MP".
2) We only include them if you have some in inventory.
3) If you have less than 30 of a particular item, we wrap it in "if hascombatitem". Otherwise, if you have 30 or more, we don't, since "that should be sufficient for all requests". Actually, it should be sufficient you run you out of rounds. :)
4) If we don't find such an item, we will end the subroutine with an abort.

So, I am puzzled why KoL decided to abort the macro before tried to use even one of your MP restoration items - espcially since, had it tried, they would have succeeded.
 

Theraze

Active member
Regarding 3, there are the odd few bosses whose rounds go to 50. But if you're just restoring MP every round, you're probably not winning that fight anyways even if you do throw 30 restoratives.
 

Veracity

Developer
Staff member
Well, I am still wondering what could have made KoL abort your macro.

I made a simplified version of yours:

Code:
abort hppercentbelow 15
sub mafiaround
endsub#mafiaround
sub mafiamp
    call mafiaround; use 518
endsub#mafiamp
#mafiaheader
if hasskill Chronic Indigestion
    while mpbelow 5
        call mafiamp
    endwhile
    if hasskill 2
        call mafiaround; skill 2
    endif
endif
The only MP restorative I listed was MMJ, and the only combat skill I used was Chronic Indigestion; this was for use by an unascended Accordion Thief. Other than that, it's essentially like the one KoLmafia generated for you.

I entered it directly into KoL and submitted it via "use macro" on the fight page. No problem.
Looking at the DEBUG log, I saw that KoL submitted it like this:

fight.php?action=macro&macrotext=&whichmacro=153345

OK. So, in order to submit it as actual text (as KoLmafia does), I made a program to let a Combat Filter submit it.

Code:
string macro = "abort hppercentbelow 15\
sub mafiaround\
endsub#mafiaround\
sub mafiamp\
    call mafiaround; use 518\
endsub#mafiamp\
#mafiaheader\
if hasskill Chronic Indigestion\
    while mpbelow 5\
        call mafiamp\
    endwhile\
    if hasskill 2\
        call mafiaround; skill 2\
    endif\
endif";

string combat_filter( int round, monster mon, string page )
{
    print( "round = " + round + " monster = " + mon );
    if ( round == 0 ) {
	return macro;
    }
    return "attack";
}

void do_adventure( int turns, location loc )
{
    while ( turns-- > 0 ) {
	adv1( loc, 1, "combat_filter" );
    }
}

set_auto_attack( "none" );
do_adventure( 1, $location[ The Hidden Office Building ] );

We submitted this request:

fight.php?action=macro&macrotext=abort+hppercentbelow+15%0Asub+mafiaround%0Aendsub%0Asub+mafiamp%0Acall+mafiaround%3Buse+518%0Aendsub%0A%0Aif+hasskill+Chronic+Indigestion%0Awhile+mpbelow+5%0Acall+mafiamp%0Aendwhile%0Aif+hasskill+2%0Acall+mafiaround%3Bskill+2%0Aendif%0Aendif%0A

And here is how it went:

Code:
[686414] The Hidden Office Building
Encounter: pygmy headhunter
Round 0: Brianna wins initiative!
Round 1: Gronald takes a pull on the hookah, and immediately goes into a coughing fit, blowing a cloud of smoke in your face. Since this is magic smoke, instead of giving you cancer (or, perhaps in addition to giving you cancer), it gives you an effect:
You acquire an effect: Heart of Green (1)
> round = 0 monster = pygmy headhunter
Round 1: Brianna executes a macro!
Round 1: Brianna casts CHRONIC INDIGESTION!
Round 2: pygmy headhunter takes 6 damage.
Round 2: Gronald climbs up and sits on your shoulder, and hands you some Meat. Huh, where did he find that?
You gain 99 Meat.
> round = 1 monster = pygmy headhunter
Round 2: Brianna attacks!
Round 3: pygmy headhunter takes 3275 damage.
Round 3: Brianna wins the fight!
After Battle: Gronald sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 733 Meat
You acquire an item: briefcase
You acquire an item: Frogade
After Battle: You gain 13 Muscleboundness
After Battle: You gain 9 Enchantedness
After Battle: You gain 29 Cheek
Which is to say, it worked fine.

I continue to be clueless why your macro aborted.
 
Last edited:

fxer

Member
Don't know if it's related, but the macro abort only appears to happen at the beginning of my day after I've thrown the putty 5x, and rain doh box 1x. This is handled by the mafia "one-time automatic putty" option and the 'special action' line in the ccs:

Code:
You're too scared to copy any more monsters today. Maybe you'll feel braver tomorrow.

After throwing the putty items six times and fighting six monsters (7 if you found the photocopied one I started with), I have 3 more puttys to fight and it aborts on all 3: 1x spooky putty monster, 1x rain-doh monster in a box, 1x shaking 4d camera
 

Veracity

Developer
Staff member
his is handled by the mafia "one-time automatic putty" option and the 'special action' line in the ccs
What do you mean "this is handled by the special action line? You said that your CCS has this:

Code:
[ default ]
try to steal an item
special action
if hasskill fire a badly romantic arrow
    skill fire a badly romantic arrow
endif
consult consult_digitize.ash
if hascombatitem Spooky Putty sheet
    item Spooky Putty sheet, Miniborg strangler
endif
if hascombatitem Rain-Doh black box
    item Rain-Doh black box, Miniborg strangler
endif
if hascombatitem 4-d camera
    item 4-d camera, Miniborg strangler
endif
if hasskill extract
    skill extract
endif
if hascombatitem porquoise-handled sixgun
    item porquoise-handled sixgun, Miniborg strangler
endif
consult wham.ash
I see your "special action" line but I also see code that YOU put in there:

Code:
if hascombatitem Spooky Putty sheet
    item Spooky Putty sheet, Miniborg strangler
endif
Looks to me like you are telling KoL that if you have a Spooky Putty sheet, use it.
Apparently, after you've used it the maximum number times per day, KoL will abort your macro when you do that.
 

fxer

Member
yep you're right I use auto-olfact not auto-putty, that one I handle myself. So since that ccs hasn't changed in months and the abort just started happening in the last several days, would it be a backend change in kol itself? or perhaps mafia didn't use to macroify the use spooky putty sheet line if you'd already maxed out your uses?
 

Veracity

Developer
Staff member
KoLmafia didn't used to macrofy your CCS at all if you have a consult script. Now it macrofies all the parts of your CCS before, between, and after consult scripts.
 

Veracity

Developer
Staff 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?
 
Top