Historical price: Difference between revisions
Jump to navigation
Jump to search
imported>Bale mNo edit summary |
imported>Eliteofdelete No edit summary |
||
Line 17: | Line 17: | ||
function_description=Returns the most recently seen mall price of the given item, following the same restrictions as [[mall_price|mall_price()]]. Unlike [[mall_price|mall_price()]] this function will never hit the server. To update to a more recent price you can use [[mall_price|mall_price()]] (if you haven't called it for that item yet this session) or purchase some of {{pspan|shop_for}} in the mall.| | function_description=Returns the most recently seen mall price of the given item, following the same restrictions as [[mall_price|mall_price()]]. Unlike [[mall_price|mall_price()]] this function will never hit the server. To update to a more recent price you can use [[mall_price|mall_price()]] (if you haven't called it for that item yet this session) or purchase some of {{pspan|shop_for}} in the mall.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=Gives you an estimate of your total mall-worth.| | |||
code= | |||
<syntaxhighlight> | |||
cli_execute("outfit save Backup"); | |||
cli_execute("outfit birthday suit"); | |||
int[item] inventory = get_inventory(); | |||
cli_execute("outfit Backup"); | |||
int total; | |||
foreach it in inventory | |||
total += historical_price(it) * inventory[it]; | |||
string amount = to_string(total, "%,d"); | |||
print("The estimated total mall-worth of your inventory is "+amount+" meat.", "blue"); | |||
</syntaxhighlight>| | |||
moreinfo= | |||
Historical price is best used for estimates and planning. When purchasing items or putting them into your store, it is better to use mall_price. | |||
</pre> | |||
}}| | |||
see_also={{SeeAlso|historical_age|mall_price}}| | see_also={{SeeAlso|historical_age|mall_price}}| |
Revision as of 03:39, 14 January 2015
Function Syntax
int historical_price(item shop_for )
- shop_for is the item to inquire on the mall price of
Returns the most recently seen mall price of the given item, following the same restrictions as mall_price(). Unlike mall_price() this function will never hit the server. To update to a more recent price you can use mall_price() (if you haven't called it for that item yet this session) or purchase some of shop_for in the mall.
Code Samples
Gives you an estimate of your total mall-worth.
cli_execute("outfit save Backup");
cli_execute("outfit birthday suit");
int[item] inventory = get_inventory();
cli_execute("outfit Backup");
int total;
foreach it in inventory
total += historical_price(it) * inventory[it];
string amount = to_string(total, "%,d");
print("The estimated total mall-worth of your inventory is "+amount+" meat.", "blue");
Historical price is best used for estimates and planning. When purchasing items or putting them into your store, it is better to use mall_price.
CLI Equivalent
The CLI command "searchmall" also returns current mall prices.