Bug - Won't Fix tracking with Use the Force

ckb

Minion
Staff member
Occasionally, I have noticed some of my tracking properties have gotten out of sync. I believe this happens when a tracked skill is used, then combat ends by later using "Use the Force"

Example: I execute an attack macro
"abort hppercentbelow 20; abort pastround 25; skill Offer Latte to Opponent; skill Use the Force; "

Combat ends after I use "skill Offer Latte to Opponent" but "_latteCopyUsed" is not set t true


Note this does not happen often to me, so it is hard to track down, but I believe this is what is happening where the skills used before Use the Force are not tracked.
 

ckb

Minion
Staff member
Here is the session log fight. My combat consult script spits out the macro it uses for debugging such things. The log does not include anything from the fight before 'Encounter: Using the Force', but I would expect the 'skill Offer Latte to Opponent' to have happened based on the macro submitted.

The '> After-Force choice: Using the Force' line is from my after-adventure script using 'run_choice(-1);'

Code:
[66] The Penultimate Fantasy Airship
Encounter: Quiet Healer
Round 0: ckb1 wins initiative!
Round 1: ck-Bile is looking a little thin.
> ckb-consult: Round 1: Fighting a Quiet Healer at The Penultimate Fantasy Airship with 0 ML
> Monster: Atk=96, Def=85, HP=89, Dmg=21, Hit=false, PR=0
> Plumber: Atk=547 Moxie, Mox=547, HP=254, Hit=true
> Offer Latte to Opponent this Quiet Healer
> YR this Quiet Healer
> Use the Force Drop this Quiet Healer
> ckb-consult outmac = abort hppercentbelow 20; abort pastround 25; skill Offer Latte to Opponent; skill Use the Force; skill Multi-Bounce; skill Jump Attack; repeat; attack; repeat !pastround 22; mark eof; 
Round 1: ckb1 executes a macro!
Encounter: Using the Force
> After-Force choice: Using the Force
Took choice 1387/3: "You will drop your things and walk away."
choice.php?whichchoice=1387&option=3&pwd
You acquire an item: amulet of extreme plot significance
You acquire an item: scroll of drastic healing
You acquire an item: soft green echo eyedrop antidote
 

Ryo_Sangnoir

Developer
Staff member
If you set "Use the Force" as auto-attack and banish the resulting monster, KoLMafia will incorrectly report the previously-fought monster as banished (I have a bounty auto-attack that banishes non-bounty monsters).

I don't think it can "do the right thing" easily, though: there's no indication on the choice adventure as to which monster you were fighting (or, in your case, what you were doing).
 

Veracity

Developer
Staff member
I would expect the 'skill Offer Latte to Opponent' to have happened based on the macro submitted.
I agree that would have expected that. However:

Code:
[66] The Penultimate Fantasy Airship
Encounter: Quiet Healer
Round 0: ckb1 wins initiative!
Round 1: ck-Bile is looking a little thin.
> ckb-consult outmac = abort hppercentbelow 20; abort pastround 25; skill Offer Latte to Opponent; skill Use the Force; skill Multi-Bounce; skill Jump Attack; repeat; attack; repeat !pastround 22; mark eof; 
Round 1: ckb1 executes a macro!
Encounter: Using the Force
We parse the fight response and log what we get round by round.
We compose CCS scripts into macros and submit them. I'll do a little test:

Code:
[ default ]
"pickpocket"
skill Offer Latte to Opponent
skill Use the Force
attack with weapon
Code:
[color=green]> set choiceAdventure1387=3[/color]

choiceAdventure1387 => 3
I set that CCS and said to adventure once in the Penultimate Fantasy Airship.

Code:
[756] The Penultimate Fantasy Airship
Encounter: GT1
Round 0: GT1 says: "stay safe"
Round 0: Veracity wins initiative!
Round 1: Veracity executes a macro!
Round 1: Veracity tries to steal an item!
You acquire an item: time residue
You gain 4 Meat.
Round 2: Psychic Grrl says, I sense an unexpected windfall in your near future! and hands you some meat.
You gain 8 Meat.
Round 2: Veracity casts OFFER LATTE TO OPPONENT!
Round 3: Psychic Grrl says, I sense an unexpected windfall in your near future! and hands you some meat.
You gain 10 Meat.
Round 3: Veracity casts USE THE FORCE!
Round 4: Psychic Grrl says, I sense an unexpected windfall in your near future! and hands you some meat.
You gain 5 Meat.
Round 4: Veracity attacks!
Round 5: Veracity wins the fight!
After Battle: You relax for a moment and watch meteors streak across the cosmos, and consider what it all means.
After Battle: You gain 4 Wizardliness
After Battle: Psychic Grrl surveys the scene from atop the throne, and gains 1 Experience.
After Battle: Secret Echo stealths up to you, crawling on her elbows. She gives you some meat that she found down there.
You gain 14 Meat.
After Battle: You notice some extra Meat hidden in the battery compartment of a robot supersoldier.
You gain 59 Meat.
After Battle: You gain 2 Fortitude
After Battle: You gain 4 Chutzpah
This combat did not cost a turn
Well, darn it, I got a time spinner prank. I would be surprised if that was copyable. And obviously the force saber didn't work on it.

So, what did the DEBUG log say?

Code:
<!-- macroaction: steal -->
You deftly slip your fingers into your opponent's pocket and grab something.
<!-- macroaction: skill 7302 -->
You offer your opponent a sip of your delicious latte. All of his friends start following you around for a taste.
<!-- macroaction: skill 7311 -->
This creature appears to be immune to your mind tricks, like Toydarians!
<!-- macroaction: attack -->
You elegantly engrave your initials on him, followed by the number 188
You win the fight!
As you can see, we parse macro results, round by round.
If we did not parse "Offer Latte to Opponent", that means that KoL did not use that skill.
That's a once a day skill you have available while wielding your latte-lover's member mug.
Perhaps you didn't have the mug equipped?
Perhaps you already used the skill?
 

ckb

Minion
Staff member
My consult script create a macro string, then submits it with:
Code:
visit_url( "fight.php?action=macro&macrotext=" + url_encode(macro), true, true );

Maybe this makes Mafia handle it differently?
Offer Latte to Opponent is available once per refill (not once per day). The Mug was equipped and the skill was available - or the macro would have failed/aborted when it tried to "offer latte". This happens a few turns later when I encountered another Quiet Healer and it tried to use "Offer Latte to Opponent" and my script aborts.

I can try another investigation into this tomorrow as my charges are all used up for today.
 

ckb

Minion
Staff member
Debug log attached. Issue is easily repeatable.

Code:
[465] The Haunted Library
Encounter: bookbat
Round 0: ckb1 wins initiative!
> ckb-consult: Round 1: Fighting a bookbat at The Haunted Library with 58 ML
> Monster: Atk=83, Def=83, HP=83, Dmg=3, Hit=false, PR=23
> Accordion Thief: Atk=407 Moxie, Mox=407, HP=435, Hit=true
> Use the Force Drop this bookbat
> Sniff this bookbat
> Gallapagosian this bookbat
> Offer Latte to Opponent this bookbat
> ckb-consult outmac = abort hppercentbelow 20; abort pastround 25; pickpocket; skill Transcendent Olfaction; skill Gallapagosian Mating Call; skill Offer Latte to Opponent; skill Use the Force; skill Summon Love Mosquito; skill Summon Love Gnats; skill Sing Along; use Rain-Doh blue balls, Rain-Doh indigo cup; use porquoise-handled sixgun; use Time-Spinner; skill pocket crumbs; while !pastround 22; attack; endwhile; skill Saucestorm; repeat; mark eof; 
Round 1: ckb1 executes a macro!
Encounter: Using the Force
> After-Force choice: Using the Force
Took choice 1387/3: "You will drop your things and walk away."
choice.php?whichchoice=1387&option=3&pwd
You acquire an item: tattered scrap of paper
> using: 1 Gathered Meat-Clip

use 1 Gathered Meat-Clip
You gain 536 Meat

[465] The Haunted Library
Encounter: bookbat
Round 0: ckb1 wins initiative!
> ckb-consult: Round 1: Fighting a bookbat at The Haunted Library with 58 ML
> Monster: Atk=84, Def=83, HP=84, Dmg=3, Hit=false, PR=23
> Accordion Thief: Atk=407 Moxie, Mox=407, HP=435, Hit=true
> Use the Force Drop this bookbat
> Gallapagosian this bookbat
> Offer Latte to Opponent this bookbat
> ckb-consult outmac = abort hppercentbelow 20; abort pastround 25; pickpocket; skill Gallapagosian Mating Call; skill Offer Latte to Opponent; skill Use the Force; skill Summon Love Mosquito; skill Summon Love Gnats; skill Sing Along; use Rain-Doh blue balls, Rain-Doh indigo cup; use porquoise-handled sixgun; use Time-Spinner; skill pocket crumbs; while !pastround 22; attack; endwhile; skill Saucestorm; repeat; mark eof; 
Round 1: ckb1 executes a macro!
Round 1: ckb1 tries to steal an item!
Round 2: ckb1 casts GALLAPAGOSIAN MATING CALL!

Combat macro aborts after this (cannot cast skill Offer Latte to Opponent)
 

Attachments

  • DEBUG_20200329.txt
    902.9 KB · Views: 6

Veracity

Developer
Staff member
Wow.

Code:
Requesting: https://www.kingdomofloathing.com/fight.php?action=macro&macrotext=abort+hppercentbelow+20%3B+abort+pastround+25%3B+pickpocket%3B+skill+Gallapagosian+Mating+Call%3B+skill+Offer+Latte+to+Opponent%3B+skill+Use+the+Force%3B+skill+Summon+Love+Mosquito%3B+skill+Summon+Love+Gnats%3B+skill+Sing+Along%3B+use+Rain-Doh+blue+balls%2C+Rain-Doh+indigo+cup%3B+use+porquoise-handled+sixgun%3B+use+Time-Spinner%3B+skill+pocket+crumbs%3B+while+%21pastround+22%3B+attack%3B+endwhile%3B+skill+Saucestorm%3B+repeat%3B+mark+eof%3B+

Retrieved: https://www.kingdomofloathing.com/fight.php?action=macro&macrotext=abort+hppercentbelow+20%3B+abort+pastround+25%3B+pickpocket%3B+skill+Transcendent+Olfaction%3B+skill+Gallapagosian+Mating+Call%3B+skill+Offer+Latte+to+Opponent%3B+skill+Use+the+Force%3B+skill+Summon+Love+Mosquito%3B+skill+Summon+Love+Gnats%3B+skill+Sing+Along%3B+use+Rain-Doh+blue+balls%2C+Rain-Doh+indigo+cup%3B+use+porquoise-handled+sixgun%3B+use+Time-Spinner%3B+skill+pocket+crumbs%3B+while+%21pastround+22%3B+attack%3B+endwhile%3B+skill+Saucestorm%3B+repeat%3B+mark+eof%3B+
Field: Location = [choice.php?forceoption=0]

Requesting: https://www.kingdomofloathing.com/choice.php?forceoption=0

Looks like your macro did:

pickpocket
Trancendant Olfaction
Gallapagosian Mating Call
Offer Latter to Opponent
Use the Force

KoL did not respond with a response showing ANY of that. Instead, it immediately redirected to choice.php.

We have no way of knowing what, if anything, you pickpocketed. (so inventory could be out of sync)
We don't know your new Olfacted monster. (although api.php will tell us you are On the Trail)
We don't know if Offer Latte succeeded. (so setting is not updated.)

Sorry. The only way I can see to deal with that would be to save the macro text and inthe choice adventure for Use the Force, parse it, extract all the actions which preceded Use the Force, assume they all succeeded, and, somehow, pass them back to FightRequest to process.

I think this is a Won't Fix.

I suggest that you submit two rounds of macro: everything before Use the Force and then Use the Force by itself.
 

ckb

Minion
Staff member
Wow.

I think this is a Won't Fix.
I suggest that you submit two rounds of macro: everything before Use the Force and then Use the Force by itself.

Thanks for looking into this. I will have to reconsider how I plan and submit my combat macros to make this work.
 

Veracity

Developer
Staff member
I might make a parser which takes a macrotext and splits it into an array of attempted combat actions.
The choice handler for Use the Force could pass that back to FightRequest.
The problem there is that all the code which processes actions looks at the response text to decide what happened.
For example, Offer Latte to Opponent. What happens if you do that to a monster which can't be copied? Does it abort the macro? Or give a failure message?
Spooky Putty sheet says "This monster is a little too scary for you to make a copy of it."

It'd be a pretty big project to add something to FIghtRequest to iterate over all the actions and decide what the side effects of each item used, skill cast, etc. was.
They are not all successes; what if you used a tattered scrap of paper and then cast Use the Force? If we get the latter's choice adventure, we know the former failed.

Seems like an awful lot of work for something which would only be partially reliable.
 
Top