Difference between revisions of "Relay Browser Functions"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
m
imported>Bale
(get_path and friends)
 
Line 6: Line 6:
 
{{flink|string|entity_encode|string|desc=Used for converting text that might contain special characters such as ampersands and angle brackets so that it can safely be displayed in HTML.}}
 
{{flink|string|entity_encode|string|desc=Used for converting text that might contain special characters such as ampersands and angle brackets so that it can safely be displayed in HTML.}}
 
{{flink|string|entity_decode|string|desc=Used for retrieving text from form fields that contains special characters such as ampersands and angle brackets.}}
 
{{flink|string|entity_decode|string|desc=Used for retrieving text from form fields that contains special characters such as ampersands and angle brackets.}}
 +
{{flink|string|url_encode|string|desc=Returns the encoded version of the source string with all non-alphanumeric characters replaced with the standard URI-encoded escape sequences.}}
 +
{{flink|string|url_decode|string|desc=Returns the "normal" version of the source string with all URI-encoded escape sequences replaced with non-alphanumeric characters.}}
  
 
{{flink|string|form_field|string|desc=Returns the "value" attribute of a previously-submitted input tag.}}
 
{{flink|string|form_field|string|desc=Returns the "value" attribute of a previously-submitted input tag.}}
 
{{flink|string [string]|form_fields|desc=As above, but returned as a map of all values keyed by input names.}}
 
{{flink|string [string]|form_fields|desc=As above, but returned as a map of all values keyed by input names.}}
 +
 +
{{flink|string|get_path_full|desc=Returns the full URL that was submitted.}}
 +
{{flink|string|get_path|desc=Returns just the page name of the URL that was submitted.}}
 +
{{flink|string|get_path_variables|desc=Returns just the variables after the "?" in the URL that was submitted.}}
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]

Latest revision as of 08:30, 20 November 2014

For general information on how to use these functions, please see Relay Override Scripting.

void write( string )

Writes text to the relay browser.

void writeln( string )

Same as above, ending with a line break (in the page source).


string entity_encode( string )

Used for converting text that might contain special characters such as ampersands and angle brackets so that it can safely be displayed in HTML.

string entity_decode( string )

Used for retrieving text from form fields that contains special characters such as ampersands and angle brackets.

string url_encode( string )

Returns the encoded version of the source string with all non-alphanumeric characters replaced with the standard URI-encoded escape sequences.

string url_decode( string )

Returns the "normal" version of the source string with all URI-encoded escape sequences replaced with non-alphanumeric characters.


string form_field( string )

Returns the "value" attribute of a previously-submitted input tag.

string [string] form_fields()

As above, but returned as a map of all values keyed by input names.


string get_path_full()

Returns the full URL that was submitted.

string get_path()

Returns just the page name of the URL that was submitted.

string get_path_variables()

Returns just the variables after the "?" in the URL that was submitted.