Autosell price: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
No edit summary
imported>Heeheehee
No edit summary
Line 16: Line 16:


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=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=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|

Revision as of 19:25, 6 March 2010



Function Syntax

int autosell_price(item it )

  • it is the item to check the price of

Returns the autosell price of item 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.

Simple Example

Returns the autosell value if the mall price is at the minimum, else returns the mall price.

float v;
item i = $item[white chocolate chip brownies];
float minPrice = max(100, autosell_price(i) * 2);
if (!use_autosell && !is_tradeable(i)) return 0;
if (historical_age(i) > 3) v = mall_price(i);
else v = historical_price(i);
if (use_autosell && (v == minPrice)) v = autosell_price(i);
print("Value of " + i + ": " + v);


See Also

autosell()