Difference between revisions of "Mall price"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
imported>Metraxis
(Correction to offline return value)
Line 36: Line 36:
 
[[Category:Ash Functions | My meat()]]
 
[[Category:Ash Functions | My meat()]]
  
When not logged in, this function returns 0.
+
When not logged in, this function returns -1.
  
 
<center><table style="width:80%;margin-top:+.7em;background-color:#F4DF3B;border:2px solid #8663A8"><tr>
 
<center><table style="width:80%;margin-top:+.7em;background-color:#F4DF3B;border:2px solid #8663A8"><tr>

Revision as of 15:22, 4 August 2009

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()