Bug Using a macro with Replace Enemy + Use the Force = Wrong enemy saved in preferences

Irrat

Member
I don't think this is actually fixable to be clear, I'm reporting it so it's known.

I created this PR to track powerful glove as it wasn't obvious to me what was going originally.
But basically, you can see in the snippet in the spoiler that I executed a macro that would cast replace enemy, then use the force.
Later in that choice I asked to see its friends.
This was in Sonofa Beach, using a cursed magnifying glass to attack a Void Spider.
What you don't see because I'm too lazy is that when I adventure in the zone again, I'm fighting lobsterfrogmen.

If I manually check the charge of the Powerful Glove, it will have been used; But again Mafia did not see this.

I don't think there's a real solution to fixing this on mafia's side, other than potentially breaking behavior with macros. So this is up to the user to work around.
This is really just a bug report for awareness.

To rephrase because I'm sometimes bad at explaining.

What I did
Start a fight against Void Spider in the Beach
Execute a Macro that consisted of the command cast Replace Enemy, then Use the Force
I then manually picked the friends option.

What I expected to see.
Powerful glove charge decreased by 10%
Saber monster property saved to lobsterfrogmen

What happened
Powerful glove charge unchanged
Saber monster property saved to void spider



Code:
> js bufferToFile(visitUrl("fight.php?action=macro&macrotext=" + urlEncode("if !monsterid 529;skill 7326;endif;skill Use the Force;"), true, true).toString(), "buffer.txt")

class net.sourceforge.kolmafia.request.GenericRequest
Round 1: Irrat executes a macro!
Connecting to fight.php...

Requesting: https://www.kingdomofloathing.com/fight.php?action=macro&macrotext=if+%21monsterid+529%3Bskill+7326%3Bendif%3Bskill+Use+the+Force%3B
4 request properties
Field: Accept-Encoding = [gzip]
Field: Content-Type = [application/x-www-form-urlencoded]
Field: Cookie =
Field: User-Agent = [KoLmafia r26693-M]

Retrieving server reply...

Retrieved: https://www.kingdomofloathing.com/fight.php?action=macro&macrotext=if+%21monsterid+529%3Bskill+7326%3Bendif%3Bskill+Use+the+Force%3B
10 header fields
Field: :status = [302]
Field: cache-control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: content-type = [text/html]
Field: date = [Wed, 24 Aug 2022 17:27:42 GMT]
Field: expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: location = [choice.php?forceoption=0]
Field: pragma = [no-cache]
Field: server = [nginx/1.8.1]
Field: set-cookie =
Field: x-powered-by = [PHP/5.3.29]

Connecting to choice.php...

Requesting: https://www.kingdomofloathing.com/choice.php?forceoption=0
3 request properties
Field: Accept-Encoding = [gzip]
Field: Cookie =
Field: User-Agent = [KoLmafia r26693-M]

Retrieving server reply...

Retrieved: https://www.kingdomofloathing.com/choice.php?forceoption=0
11 header fields
Field: :status = [200]
Field: cache-control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: content-encoding = [gzip]
Field: content-type = [text/html; charset=UTF-8]
Field: date = [Wed, 24 Aug 2022 17:27:43 GMT]
Field: expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: pragma = [no-cache]
Field: server = [nginx/1.8.1]
Field: set-cookie =
Field: vary = [Accept-Encoding]
Field: x-powered-by = [PHP/5.3.29]

Retrieving server reply
ResponseText has 4694 characters.
<html><head><script language=Javascript><!--if (parent.frames.length == 0) location.href="game.php";top.charpane.location.href="charpane.php";//--></script><script language=Javascript src="https://d2uyhvukfffg5a.cloudfront.net/scripts/jquery-1.5.1.js"></script><script language=Javascript src="https://d2uyhvukfffg5a.cloudfront.net/scripts/keybinds.min.2.js"></script><script language=Javascript src="https://d2uyhvukfffg5a.cloudfront.net/scripts/window.20111231.js"></script><script language="javascript">function chatFocus(){if(top.chatpane.document.chatform.graf) top.chatpane.document.chatform.graf.focus();}if (typeof defaultBind != 'undefined') { defaultBind(47, 2, chatFocus); defaultBind(190, 2, chatFocus);defaultBind(191, 2, chatFocus); defaultBind(47, 8, chatFocus);defaultBind(190, 8, chatFocus); defaultBind(191, 8, chatFocus); }</script><script>function switchFocus(){if (top.chatpane.document.chatform.graf.focus)top.chatpane.document.chatform.graf.focus();return false;}function repeat(){var linx = document.getElementsByTagName("A");for (var i = 0; i < linx.length; i++){if (typeof timersfunc != 'undefined') {if (!timersfunc()) {return;}timersfunc = null;}var link = linx[i];if (link.innerHTML.match(/Adventure Again/) || link.innerHTML.match(/Do it again/))location.href = link.href;}}defaultBind(47, CTRL, switchFocus);defaultBind(191, CTRL, switchFocus);defaultBind(47, META, switchFocus);defaultBind(191, META, switchFocus);defaultBind(192, NONE, repeat);defaultBind(220, NONE, repeat);</script><script language="javascript">function updateParseItem(iid, field, info) {var tbl = $('#ic'+iid);var data = parseItem(tbl);if (!data) return;data[field] = info;var out = [];for (i in data) {if (!data.hasOwnProperty(i)) continue;out.push(i+'='+data[i]);}tbl.attr('rel', out.join('&'));}function parseItem(tbl) {tbl = $(tbl);var rel = tbl.attr('rel');var data = {};if (!rel) return data;var parts = rel.split('&');for (i in parts) {if (!parts.hasOwnProperty(i)) continue;var kv = parts[i].split('=');tbl.data(kv[0], kv[1]);data[kv[0]] = kv[1];}return data;}</script><script type="text/javascript" src="https://d2uyhvukfffg5a.cloudfront.net/scripts/pop_query.20130705.js"></script><script type="text/javascript"> function pop_ircm(clicked) { return false; } </script><script>var currentkey = 49;$(document).ready(function () {$('form').each(function () {var form = this;defaultBind(currentkey++, NONE, function () { form.submit(); });return currentkey < 58;});});</script>    <link rel="stylesheet" type="text/css" href="https://d2uyhvukfffg5a.cloudfront.net/styles.20151006.css"><style type='text/css'>.faded {zoom: 1;filter: alpha(opacity=35);opacity: 0.35;-khtml-opacity: 0.35;-moz-opacity: 0.35;}</style></head><body><Center><centeR><!--faaaaaaart--><table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Using the Force</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td><center><img src="https://d2uyhvukfffg5a.cloudfront.net/adventureimages/may4swordbig.gif" width=100 height=100></center><p>You let the force flow through you and into the mind of you opponent before telling them....<center><form style='margin: 0px 0px 0px 0px;' name=choiceform1 action=choice.php method=post><input type=hidden name=pwd value='PWDPWDPWDPWDPWDPWD'><input type=hidden name=whichchoice value=1387><input type=hidden name=option value=1><input  class=button type=submit value="&quot;I am not the adventurer you are looking for.&quot;"></form><p><form style='margin: 0px 0px 0px 0px;' name=choiceform2 action=choice.php method=post><input type=hidden name=pwd value='PWDPWDPWDPWDPWDPWD'><input type=hidden name=whichchoice value=1387><input type=hidden name=option value=2><input  class=button type=submit value="&quot;You will go find two friends and meet me here.&quot;"></form><p><form style='margin: 0px 0px 0px 0px;' name=choiceform3 action=choice.php method=post><input type=hidden name=pwd value='PWDPWDPWDPWDPWDPWD'><input type=hidden name=whichchoice value=1387><input type=hidden name=option value=3><input disabled disable style='color: #cccccc; border: 2px solid #cccccc;' class=button type=submit value="&quot;You will drop your things and walk away.&quot;"></form><p></center></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center><!--faaaaaaart--><script>top.charpane.location.href="charpane.php";</script></body></html>
Preference lastEncounter changed from void spider to Using the Force
Encounter: Using the Force
Processing results...
 
Last edited:
Top