<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kolmafia.us/index.php?action=history&amp;feed=atom&amp;title=Buy_using_storage</id>
	<title>Buy using storage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kolmafia.us/index.php?action=history&amp;feed=atom&amp;title=Buy_using_storage"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Buy_using_storage&amp;action=history"/>
	<updated>2026-04-30T18:16:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Buy_using_storage&amp;diff=8374&amp;oldid=prev</id>
		<title>Bale: r14389</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Buy_using_storage&amp;diff=8374&amp;oldid=prev"/>
		<updated>2014-11-06T08:47:19Z</updated>

		<summary type="html">&lt;p&gt;r14389&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|buy_using_storage}}{{&lt;br /&gt;
#vardefine:return_type|boolean}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|int|qty}}|&lt;br /&gt;
parameter2={{Param|item|it}}|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function2={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type=int|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|int|qty}}|&lt;br /&gt;
parameter2={{Param|item|it}}|&lt;br /&gt;
parameter3={{Param|int|price}}|&lt;br /&gt;
p1desc={{pspan|qty}} is the number to purchase|&lt;br /&gt;
p2desc={{pspan|it}} is the item to purchase|&lt;br /&gt;
p3desc={{pspan|price}} is the (optional) maximum price to spend per item|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Using meat in Hangk&amp;#039;s Storage the function attempts to mall purchase {{pspan|qty}} amount of item {{pspan|it}}. If {{pspan|qty}} is less than 1, the function will not purchase anything.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;If the optional maximum {{pspan|price}} is specified, it returns the integer amount of items purchased; otherwise it returns true if the purchase succeeded and false if it did not. If a {{pspan|price}} less than 1 is passed, the function will always buy {{pspan|qty}}, regardless of price.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The version that returns a boolean value determine success depending on whether your inventory of the desired item went up by the amount you tried to buy.  If {{pspan|qty}} is less than 1, the function will always return true.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=Pull a quantity of a given item from storage, even if you are in ronin and don&amp;#039;t have it in storage.|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
boolean buy_pull(int quantity, item topull) {&lt;br /&gt;
   if( in_hardcore() )&lt;br /&gt;
      print( &amp;quot;You cannot pull items in hardcore.&amp;quot;, &amp;quot;red&amp;quot; );&lt;br /&gt;
   else if(topull == $item[none])&lt;br /&gt;
      print( &amp;quot;You need to choose a real item to pull.&amp;quot;, &amp;quot;red&amp;quot; );&lt;br /&gt;
   else if(can_interact())&lt;br /&gt;
      return retrieve_item( quantity, topull );&lt;br /&gt;
   else if( pulls_remaining() &amp;gt;= quantity ) {&lt;br /&gt;
      if( storage_amount(topull) &amp;lt; quantity )&lt;br /&gt;
         buy_using_storage( quantity - storage_amount(topull), topull, get_property(&amp;quot;autoBuyPriceLimit&amp;quot;).to_int() );&lt;br /&gt;
      return take_storage(q, topull);&lt;br /&gt;
   } else&lt;br /&gt;
      print( ( pulls_remaining() == 0? &amp;quot;No&amp;quot;: &amp;quot;Only &amp;quot; + pulls_remaining() ) + &amp;quot; pulls remaining for today.&amp;quot;, &amp;quot;red&amp;quot; );&lt;br /&gt;
   return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|mall_price|buy}}|&lt;br /&gt;
cli_equiv=The CLI commands &amp;quot;buy&amp;quot; and &amp;quot;acquire&amp;quot; will purchase items if you are not in ronin or hardcore.|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Item Management]]&lt;/div&gt;</summary>
		<author><name>Bale</name></author>
	</entry>
</feed>