Autosell price: Difference between revisions
Jump to navigation
Jump to search
imported>Jasonharper m Explanation of negative values |
imported>Bale mNo edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{#vardefine:name|autosell_price}} | {{ | ||
{{#vardefine:return_type|int}} | #vardefine:name|autosell_price}}{{ | ||
#vardefine:return_type|int}}{{ | |||
FunctionPage| | |||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 15: | Line 15: | ||
}}| | }}| | ||
function_description=Returns the autosell price of item {{pspan|it}}, or a value <= 0 if the item cannot be autosold. | 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.| | ||
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}}| | |||
}} | }} | ||
[[Category:Item Management]] |
Latest revision as of 21:50, 21 May 2010
Function Syntax
- 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);