Mall price: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Idran
m Updating return data based on recent results
imported>Eliteofdelete
No edit summary
Line 17: Line 17:
function_description=Returns the current mall price of the given item, ignoring the first five items listed to compensate for stores with limits and min-priced sales. To prevent abuse, this will only perform an actual Mall search once per item per session; subsequent calls for the same item will return a cached value. The cache will be updated after attempts to purchase the item using the CLI or ASH {{f|buy}} command (even unsuccessful ones), but not in ''any'' other conditions, including purchasing with the purchase tab.|
function_description=Returns the current mall price of the given item, ignoring the first five items listed to compensate for stores with limits and min-priced sales. To prevent abuse, this will only perform an actual Mall search once per item per session; subsequent calls for the same item will return a cached value. The cache will be updated after attempts to purchase the item using the CLI or ASH {{f|buy}} command (even unsuccessful ones), but not in ''any'' other conditions, including purchasing with the purchase tab.|


needscode=yes|
code1={{CodeSample|
title=Code Samples|
description=Creates Mae Wests based on your stills remaining. Puts the created items into your shop, pricing them using the mall_price() command.|
code=
<syntaxhighlight>
if (stills_available() > 1) {
  set_property("promptAboutCrafting", 0);
  int stillsleft;
  stillsleft = floor((stills_available()/2));
  create(stillsleft, $item[Mae West]);
  print("Created " + stillsleft + " Mae West.", "blue");
  set_property("promptAboutCrafting", 1);
  put_shop(mall_price($item[Mae West]), 0, item_amount($item[Mae West]), $item[Mae West]);
}
</syntaxhighlight>|
moreinfo=
Mall_price() is best used when the exact price of the item is needed. See historical_price() for theorizing.
}}|


see_also={{SeeAlso|historical_price|buy|retrieve_item}}|
see_also={{SeeAlso|historical_price|buy|retrieve_item}}|

Revision as of 14:21, 17 January 2015

Function Syntax

int mall_price(item shop_for )

  • shop_for is the item to inquire on the mall price of

Returns the current mall price of the given item, ignoring the first five items listed to compensate for stores with limits and min-priced sales. To prevent abuse, this will only perform an actual Mall search once per item per session; subsequent calls for the same item will return a cached value. The cache will be updated after attempts to purchase the item using the CLI or ASH buy() command (even unsuccessful ones), but not in any other conditions, including purchasing with the purchase tab.

Code Samples

Creates Mae Wests based on your stills remaining. Puts the created items into your shop, pricing them using the mall_price() command.

if (stills_available() > 1) {
   set_property("promptAboutCrafting", 0);
   int stillsleft;
   stillsleft = floor((stills_available()/2));
   create(stillsleft, $item[Mae West]);
   print("Created " + stillsleft + " Mae West.", "blue");
   set_property("promptAboutCrafting", 1);
   put_shop(mall_price($item[Mae West]), 0, item_amount($item[Mae West]), $item[Mae West]);
}

Mall_price() is best used when the exact price of the item is needed. See historical_price() for theorizing.

CLI Equivalent

The CLI command "searchmall" also returns current mall prices.

See Also

historical_price() | buy() | retrieve_item()

Special

Untradeable items will return 0 without any server requests. Items not listed in the mall will return -1. When not logged in, this function returns -1 for all items.