Mall price: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Metraxis
Correction to offline return value
imported>StDoodle
(No difference)

Revision as of 22:25, 2 March 2010

int mall_price( item it )

Returns the current mall price of the given item. Specifically it returns the price of the 5th item that would be purchased. Hopefully this will skip over some limited items and give you useful data. If items are purchased mall_price is automatically increased to the price of the new 5th item.

For example, if there are 7 Stench Wads priced at 385 meat and 700 priced at 390, the following code:

 print("stench wad price: "+ mall_price($item[stench wad]));
 buy(5, $item[stench wad]);
 print("stench wad price: "+ mall_price($item[stench wad]));
 buy(5, $item[stench wad]);
 print("stench wad price: "+ mall_price($item[stench wad]));

Will yield this output:

 Searching for "stench wad"...
 stench wad price: 385
 Searching for "stench wad"...
 Purchasing stench wad (5 @ 385)...
 You acquire stench wad (5)
 Purchases complete.
 stench wad price: 390
 Using cached search results for stench wad...
 Purchasing stench wad (2 @ 385)...
 You acquire stench wad (2)
 Purchasing stench wad (3 @ 390)...
 You acquire stench wad (3)
 Purchases complete.
 stench wad price: 390

Notice how mall_price went to 390 before any stench wads were purchased at that price. Magic!

When not logged in, this function returns -1.

See Also:
my_closetmeat() || item_amount()