Submitting a form in a relay override submits it twice

lostcalpolydude

Developer
Staff member
I wanted to copy the omnipresent quick skills box that Mr. Script uses. Digging in that script, I saw that it loads skills.php?tiny=1. First I tried throwing in
Code:
writeln("<iframe src=skills.php?tiny=1>");

However, casting a skill from there leads to it being cast twice, even when it's the only line in topmenu.ash. This reminds me of my first attempt at shore.ash.

I tried working around it with
Code:
writeln(visit_url("skills.php?tiny=1"));
That works when it's the only thing on the page (only casting once), but it sits on top of anything else on the page and makes other links unclickable.

Is this a problem with relay overrides, or do I just not get how to use them properly?
 

lostcalpolydude

Developer
Staff member
It looks like the potentially relevant thing for this case is if(form_field("squelch") == 1) exit; but casting a skill from there doesn't reload topmenu.php, so preventing the relay override from running doesn't accomplish anything. The debug log for double casting starts with

Code:
class net.sourceforge.kolmafia.request.RelayRequest
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to skills.php...
Connecting to skills.php...

Requesting: [PLAIN]http://www3.kingdomofloathing.com/skills.php?ultrasquelch=1&squelch=1&pwd=removed&action=Skillz&targetplayer=1052080&whichskill=1000&quantity=1[/PLAIN]

Requesting: [PLAIN]http://www3.kingdomofloathing.com/skills.php?squelch=1&pwd&action=Skillz&targetplayer=1052080&whichskill=1000&quantity=1[/PLAIN]
2 request properties

Field: Cookie = [PHPSESSID=removed]
Field: User-Agent = [KoLmafia v14.7]

Retrieving server reply...
3 request properties

Field: Cookie = [PHPSESSID=removed]
Field: User-Agent = [KoLmafia v14.7]
Field: Content-Type = [application/x-www-form-urlencoded]

Retrieving server reply...

That's generated with a relay override commented down to
PHP:
	void override()
{
	writeln("<iframe src=skills.php?tiny=1 width=300 height=50>");
}

void main() {
	if ( form_field("squelch") != 1 )
	{	
		override();
	}
}

While proper casting (no relay override or greasemonkey) looks like
Code:
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to skills.php...

Requesting: [PLAIN]http://www3.kingdomofloathing.com/skills.php?ultrasquelch=1&squelch=1&pwd=removed&action=Skillz&targetplayer=1052080&whichskill=1000&quantity=1[/PLAIN]
2 request properties

Field: Cookie = [PHPSESSID=removed]
Field: User-Agent = [KoLmafia v14.7]

Retrieving server reply...

I don't think there's any redirect involved here, so it looks like something different.
 

Theraze

Active member
Any chance this is a POST/GET issue? Guessing whatever causes this is also why the get_skill script (or any such visit_url skill purchase) double-decrements your meat... well, until you refresh or run your next adventure.
 
Top