Shop price: Difference between revisions
Jump to navigation
Jump to search
imported>Gnocchi masala Revision 12906 add shop_price() function. |
imported>Eliteofdelete No edit summary |
||
Line 16: | Line 16: | ||
function_description=Returns the price of a given item that are currently for sale in your mall store. If the item is not currently for sale then 999999999 is returned.| | function_description=Returns the price of a given item that are currently for sale in your mall store. If the item is not currently for sale then 999999999 is returned.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=Following example creates a function that notifies you if items in your shop are above a given percent. The current example is set to 10%. | | |||
code= | |||
<syntaxhighlight> | |||
void pricecheck_shop (float cutoff) { | |||
int[item] shop = get_shop(); | |||
foreach it in shop { | |||
float over = historical_price(it)*cutoff; | |||
if (shop_price(it)> over) { | |||
float percent = shop_price(it)*1.0/historical_price(it); | |||
percent = percent*100; | |||
print(""+it+" is overpriced by "+to_int(percent)+"%.", "blue"); | |||
} | |||
} | |||
} | |||
pricecheck_shop (1.1); | |||
</syntaxhighlight>| | |||
moreinfo=Changing historical_price to mall_price would give more accurate results but take longer. Also note, KoLMafia uses the 5th price. | |||
}}| | |||
see_also={{SeeAlso|mall_price|historical_price|autosell_price|npc_price}}| | see_also={{SeeAlso|mall_price|historical_price|autosell_price|npc_price}}| | ||
}} | }} | ||
[[Category:Item Management]] | [[Category:Item Management]] |
Latest revision as of 22:26, 21 January 2015
Function Syntax
- it is the item to check
Returns the price of a given item that are currently for sale in your mall store. If the item is not currently for sale then 999999999 is returned.
Code Samples
Following example creates a function that notifies you if items in your shop are above a given percent. The current example is set to 10%.
void pricecheck_shop (float cutoff) {
int[item] shop = get_shop();
foreach it in shop {
float over = historical_price(it)*cutoff;
if (shop_price(it)> over) {
float percent = shop_price(it)*1.0/historical_price(it);
percent = percent*100;
print(""+it+" is overpriced by "+to_int(percent)+"%.", "blue");
}
}
}
pricecheck_shop (1.1);
Changing historical_price to mall_price would give more accurate results but take longer. Also note, KoLMafia uses the 5th price.