Difference between pages "Autosell price" and "Get path variables"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Heeheehee
 
imported>Bale
(r8628)
 
Line 1: Line 1:
{{#vardefine:name|autosell_price}}
+
{{
{{#vardefine:return_type|int}}
+
#vardefine:name|get_path_variables}}{{
 +
#vardefine:return_type|string}}{{
  
{{FunctionPage|
+
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Item Management|
 
  
 
function1={{Function|
 
function1={{Function|
 
name={{#var:name}}|
 
name={{#var:name}}|
 
aggregate={{#var:aggregate}}|
 
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
+
return_type=string|
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
parameter1={{Param|item|it}}|
 
p1desc={{pspan|it}} is the item to check the price of|
 
 
}}|
 
}}|
  
function_description=Returns the autosell price of item {{pspan|it}}, or a value <= 0 if the item cannot be autosold. For most items that cannot be autosold, such as common Quest Items, this value will be 0. The value will be presented as a negative number in a few unusual cases where an item can't be autosold, but does have a defined value detectable by other means: a Mall minimum price other than 100, or a price in one of the sign restaurants.  The laser-broiled pear is an example of a non-autosellable item with a value detectable both ways.|
+
function_description=When called by a [[Relay Override Scripting|relay override script]], this returns the variables (if there are any after a "?") of the URL that was submitted in the relay browser. This return value does not include the name of the page.|
 
 
function_description=Returns the type of equipment that {{pspan|check_me}} is categorized as. Possible values are hat, [http://kol.coldfront.net/thekolwiki/index.php/Category:Weapons (various weapon types)], shield, offhand, pants, accessory, familiar equipment, shirt, container, hp restore, mp restore, hp+mp restore, food, booze, drink helper, food helper, and familiar larva.|
 
 
 
 
code1={{CodeSample|
 
code1={{CodeSample|
title=Simple Example|
+
title=Code Sample|
description=Returns the autosell value if the mall price is at the minimum, else returns the mall price.|
+
description=Print path information about how the current override was called.|
code=
+
code=<syntaxhighlight>
<syntaxhighlight>
+
print( "This script was called by the URL: " + get_path_full() );
float v;
+
if( get_path_variables() != "" ) {
item i = $item[white chocolate chip brownies];
+
  print( "Which is composed of the page name: " + get_path() );
float minPrice = max(100, autosell_price(i) * 2);
+
  print( "followed by a question mark and the variables: "+ get_path_variables() );
if (!use_autosell && !is_tradeable(i)) return 0;
+
}
if (historical_age(i) > 3) v = mall_price(i);
+
</syntaxhighlight>}}|
else v = historical_price(i);
 
if (use_autosell && (v == minPrice)) v = autosell_price(i);
 
print("Value of " + i + ": " + v);
 
</syntaxhighlight>}}
 
  
{{SeeAlso|autosell}}|
+
see_also={{SeeAlso|form_fields|get_path_full|get_path}}|
 +
special=When this function is called by any script that is not a relay override, it returns an empty string|
 
}}
 
}}
 +
 +
[[Category:Relay Browser Functions]]

Revision as of 06:27, 26 November 2014

Function Syntax

string get_path_variables()

When called by a relay override script, this returns the variables (if there are any after a "?") of the URL that was submitted in the relay browser. This return value does not include the name of the page.

Code Sample

Print path information about how the current override was called.

print( "This script was called by the URL: " + get_path_full() );
if( get_path_variables() != "" ) {
   print( "Which is composed of the page name: " + get_path() );
   print( "followed by a question mark and the variables: "+ get_path_variables() );
}

See Also

form_fields() | get_path_full() | get_path()

Special

When this function is called by any script that is not a relay override, it returns an empty string