Difference between revisions of "Autosell price"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>Heeheehee
Line 17: Line 17:
 
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.|
  
needscode=yes|
+
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.|
  
see_also={{SeeAlso|autosell}}|
+
code1={{CodeSample|
 +
title=Simple Example|
 +
description=Returns the autosell value if the mall price is at the minimum, else returns the mall price.|
 +
code=
 +
<syntaxhighlight>
 +
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);
 +
</syntaxhighlight>}}
 +
 
 +
{{SeeAlso|autosell}}|
 
}}
 
}}

Revision as of 19:24, 6 March 2010



Function Syntax

int autosell_price(item it )

  • it is the item to check the price of

Returns the type of equipment that check_me is categorized as. Possible values are hat, (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.

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()