make_url()

From KoLMafia
Jump to: navigation, search

Function Syntax

buffer make_url(string page ,boolean use_POST ,boolean encoded )

  • page is the page to visit
  • use_POST is true for a POST request and false for a GET request
  • encoded If set to true, then the url is assumed to be pre-encoded by the user.

Returns the url that would be visited if this was a visit_url(). This function was intended for troubleshooting crafted urls and has no use outside of debugging purposes.

Code Samples

Compares the URL you expect to visit with the URL that you are actually visiting. This was once useful.

buffer mbuf;
mbuf.append( "pickpocket\n" );
mbuf.append( "attack\n" );
mbuf.append( "repeat" );

string macro = mbuf.to_string();

buffer new_url;
new_url.append( "fight.php" );
new_url.append( "?" );
new_url.append( "action=macro" );
new_url.append( "&" );
new_url.append( "macrotext=" );
new_url.append( macro );

print( "crafted unencoded url = \"" + new_url + "\"");
print( "submitted url = \"" + make_url( new_url, true, false ) + "\"" );

See Also