loathers / garbage-collector

Script for farming meat (and garbage) in 2003 web RPG Kingdom of Loathing
24 stars 59 forks source link

[BUG] Combat macro abort during wandering embezzler fight in barf turns #1814

Closed ziz closed 6 months ago

ziz commented 6 months ago

Before Reporting Ensure that KoLMafia and garbo are both up to date before reporting a bug. If you have installed mafia in a weird or non-standard way, let us know any details about that here. But also, if you've installed mafia in a weird or non-standard way, I'm telling you right now that that's your bug. Also, check existing github issues to see if this has already been reported. If it has, consider leaving a comment with any additional information you can give on that issue, instead of making a new one.

Also, read this.

Describe the bug Getting the jump on a wandering embezzler during barf mountain turns causes the combat macro to abort.

Using Mafia r27840, and up-to-date garbo:

> Local Version: 5b22bd47ce4bd4b6cadfe2e62df9c116d63ffdae (built from main@2985cb09430e1f779d2cf262f112edcd94e62df4)

To Reproduce Steps to reproduce the behavior:

Seems like: have equipment such that you fight a wandering knob goblin embezzler - in my case, a romantic copy - during barf turns, with enough initiative to get the jump on it.

I don't know what causes this setup particularly to occur; if I had to guess, I'd think it's because my number of copies exceeded free fights available; this is possibly because I ran my NEP and Shadow Rift freebies manually before starting garbo.

Expected behavior The combat proceeds normally rather than aborting.

Session Log Attach a full KoLMafia session log from the day you encountered the bug. Include details about when in the log the bug occurred to help developers rapidly find the error. Copy and paste any associated red text printed to the gCLI during this error.

Additional context

I picked up a couple of new toys since my last run of Garbo - a songboom boom box and a packaged backup camera.

Full session log: sepos_20240301_garbobug.txt

The abort seems to be coming from this combat macro setup: https://github.com/loathers/garbage-collector/blob/2985cb09430e1f779d2cf262f112edcd94e62df4/packages/garbo/src/tasks/barfTurn.ts#L663-L669

which looks like it was added by e51bae9fa1fa538fe7865059f81c0a640ffb7780.

I'm not sure what debug log at line 4329 of the session was about. I restarted garbo and it was fine afterwards.

There was an abort at line 10812 which I ran a combat macro against as basic troubleshooting without issue, then restarted garbo.

The abort in question was at line 13066.

gCLI output for the abort under fold

Visit to Dinseylandfill: Barf Mountain in progress...
(Romantic Monster window end counter expired)

[1955] Barf Mountain
Preference lastEncounter changed from garbage tourist to Knob Goblin Embezzler
Encounter: Knob Goblin Embezzler
Preference _romanticFightsLeft changed from 2 to 1
Preference relayCounters changed from 1954:Romantic Monster window end loc=* type=wander:rparen.gif to
Preference relayCounters changed from to 1969:Romantic Monster window begin loc=*:lparen.gif
Preference relayCounters changed from 1969:Romantic Monster window begin loc=*:lparen.gif to 1969:Romantic Monster window begin loc=*:lparen.gif:1979:Romantic Monster window end loc=* type=wander:rparen.gif
Round 0: sepos wins initiative!
Round 1: Your toy train moves ahead to the Viewing Platform. As your train passes the viewing platform, the crowd shouts and cheers inspiring you!
Preference trainsetPosition changed from 2059 to 2060
Round 1: You gain 195 Strengthliness
Round 1: You gain 232 Magicalness
Round 1: You gain 225 Roguishness
Round 1: sepos executes a macro!
KoLmafia thinks it is round 2 but KoL thinks it is round 1
You're on your own, partner. (Macro Aborted ("abort"))
[Click here to continue in the relay browser.](https://github.com/loathers/garbage-collector/issues/main.php)

Preference _concoctionDatabaseRefreshes changed from 617 to 618
logPreferenceChangeFilter => _beachCombing,_beachLayout,_beachMinutes,combo_lastTileCombed,garboEmbezzlerCount,garboEmbezzlerDate,garboEmbezzlerSources,libram_savedMacro,maximizerMRUList,spadingData,testudinalTeachings
Preference logPreferenceChangeFilter changed from _beachCombing,_beachLayout,_beachMinutes,_lastCombatStarted,combo_lastTileCombed,libram_savedMacro,maximizerMRUList,spadingData,testudinalTeachings to _beachCombing,_beachLayout,_beachMinutes,combo_lastTileCombed,garboEmbezzlerCount,garboEmbezzlerDate,garboEmbezzlerSources,libram_savedMacro,maximizerMRUList,spadingData,testudinalTeachings
hpAutoRecoveryTarget => 0
Preference hpAutoRecoveryTarget changed from 0.0 to 0
mpAutoRecoveryTarget => 0
Preference mpAutoRecoveryTarget changed from 0.0 to 0
allowNonMoodBurning => true
Preference allowNonMoodBurning changed from false to true
Preference customCombatScript changed from grimoire_macro to garbo
CCS set to garbo
Autoattack is disabled.
Autoattack is disabled.
logPreferenceChange => false
Preference logPreferenceChange changed from true to false
logPreferenceChangeFilter => spadingData,combo_lastTileCombed,_beachLayout,_beachMinutes,_beachCombing
CCS set to aftercore
autoSatisfyWithCoinmasters => false
dontStopForCounters => false
maximizerFoldables => false
hpAutoRecovery => 0.7
hpAutoRecoveryTarget => 1
mpAutoRecovery => 0.6
mpAutoRecoveryTarget => 0.65
betweenBattleScript => BestBetweenBattle.ash
counterScript => CounterChecker.ash
currentMood => aftercore
libramSkillsSoftcore => Summon Taffy
valueOfInventory => 1.8
choiceAdventure1106 => 0
choiceAdventure1107 => 0
choiceAdventure1340 => 0
choiceAdventure1341 => 0
choiceAdventure1468 => 1
choiceAdventure1470 => 3
choiceAdventure1474 => 1
choiceAdventure1475 => 3
shadowLabyrinthGoal => browser
choiceAdventure1324 => 0
Encounter: Knob Goblin Embezzler
You fought 8 Knob Goblin Embezzler at the beginning of the day, and an additional 0 digitized Knob Goblin Embezzler throughout the day. Good work, probably!
Including this, you have fought 43 across all ascensions today
Extreme Items:
4 Game Grid token worth 21204 total
2 FunFunds™ worth 19388 total
4 groose grease worth 14396 total
1 Cold Hots candy worth 0 total
1 White Chocolate Golem Seeds worth 5 total
1 pulled red taffy worth 5 total
This run of garbo, across 24 turns you generated 198,450 meat, with 96,063 raw meat and 102,387 from items
So far today, across 61 turns you generated 795,595 meat, with 441,471 raw meat and 354,124 from items
JavaScript exception: KoLmafia error: You're on your own, partner. (Macro Aborted ("abort"))
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:29138 (_do)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:28939 (execute)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:47623 (execute)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:28859 (run)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:47680 (runGarboTasks)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:47686 (runGarboQuests)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:48149
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:39922 (withClan)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:39916 (withVIPClan)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:48120
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:39901 (withStash)
at file:/Users/sepos/Library/Application%20Support/KoLmafia/scripts/garbage-collector/garbo.js:48119 (main)

modtrace init output

type | source | Initiative | Initiative Penalty -- | -- | -- | -- Effect | Bastille Braggadocio | +25.00 | = +25.00 |   |   Effect | Springy Fusilli | +40.00 | = +65.00 |   |   Effect | Shadow Waters | +100.00 | = +165.00 |   |  

generated ccs macro ``` if (monsterid 530) && !gotjump && !(pastround 2);if hasskill Sing Along;skill Sing Along;endif;if hasskill Bowl Straight Up;skill Bowl Straight Up;endif;if monstername angry tourist || monstername garbage tourist || monstername horrible tourist family || monstername Knob Goblin Embezzler || monstername sausage goblin;while !hppercentbelow 25 && monsterhpabove 5 && !pastround 20;use facsimile dictionary;endwhile;endif;if hasskill Summer Siesta;skill Summer Siesta;endif;while !pastround 24 && !hppercentbelow 25 && !missed 1 && !snarfblat 567;attack;endwhile;while hasskill Saucegeyser;skill Saucegeyser;endwhile;while hasskill Weapon of the Pastalord;skill Weapon of the Pastalord;endwhile;while hasskill Cannelloni Cannon;skill Cannelloni Cannon;endwhile;while hasskill Wave of Sauce;skill Wave of Sauce;endwhile;while hasskill Saucestorm;skill Saucestorm;endwhile;while hasskill Northern Explosion && snarfblat 567;skill Northern Explosion;endwhile;while hasskill Lunging Thrust-Smack && !snarfblat 567;skill 1005;endwhile;attack;repeat;endif;abort; ```
horrible-little-slime commented 6 months ago

First of all: great bug report!! This is stellar stuff.

Second of all: the actual issue here is a little weirder. That first macro is meant to fire on autoattack; that second macro is a fallthrough case designed for a few extremely specific weird scenarios that happen due to quirks with kolmafia's autoattack. The real issue here is that you got the jump and your autoattack didn't trigger, which means you didn't have the autoattack special monsters flag set to true.

But garbo's supposed to do it for you. It uses libram's setCombatFlags API as of somewhat recently, which appears to be missing a few URL params. Whoops!

I'm cutting a new libram now that includes the necessary &ajax=1&am=1, and will merge it to garbo shortly.