Put shop: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m Created page with '{{#vardefine:name|put_shop}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name}}|…'
 
Fix incorrect usage of Template:Type
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{#vardefine:name|put_shop}}
{{
{{#vardefine:return_type|boolean}}
#vardefine:name|put_shop}}{{
#vardefine:return_type|boolean}}{{


{{FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Item Management|


function1={{Function|
function1={{Function|
Line 25: Line 25:
parameter3={{Param|int|qty}}|
parameter3={{Param|int|qty}}|
parameter4={{Param|item|it}}|
parameter4={{Param|item|it}}|
parameter5={{Param|DATATYPE|SHORT_DESC}}|
p1desc={{pspan|price}} is the price to set; using 0 will result in the max-price of 999,999,999 if item is not currently in your store|
p1desc=LONG_{{pspan|price}} is the price to set; using 0 will result in the max-price of 999,999,999 if item is not currently in your store|
p2desc={{pspan|limit}} is the limit per player per day, or no limit if set to 0|
p2desc=LONG_{{pspan|limit}} is the limit per player per day, or no limit if set to 0|
p3desc={{pspan|qty}} an optional parameter for the quantity of items to put in your shop (defaults to all if not provided)|
p3desc=LONG_{{pspan|qty}} an optional parameter for the quantity of items to put in your shop (defaults to all if not provided)|
p4desc={{pspan|it}} is the item to put in your mall store.|
p4desc=LONG_{{pspan|it}} is the item to put in your mall store.|
}}|
}}|


function_description=Places items in your mall store with settings as described above. Returns true if placement is successful and false if placement fails.</p>
function_description=Places items in your mall store with settings as described above. Returns true if placement is successful and false if placement fails.</p>
<p>Note that this function will fail and return false if you try to put items in your store below minimum mall value.|
<p>Note that attempting to put an item in your store at less than minimum mall price will automatically reset the price to mall minimum.</p>
<p>Note that attempting to put a negative amount of an item in your store will not do anything, but will still return true.</p>
<p>Note that you cannot specify a quantity of 0 to change prices, but the function will still return true.
 
<p>Note: Previous versions had a [https://kolmafia.us/threads/put_shop-coerces-item-quantity-from-float-to-int-incorrectly.25865/ bug] where passing a {{type|float}} value as the item quantity would cause it to be interpreted as the integer 0, or (less frequently) the result of interpreting the binary representation of said floating-point number as a 64-bit integer. This issue was exacerbated in JavaScript, because all JavaScript numbers are floating-point numbers. This bug was fixed in [https://kolmafia.us/threads/20632-ash-put_shop-enhancement-to-allow-the-quantity-param-to-take-a-float-and-convert-it-to-an.25869/ r20632].</p>
|


code1={{CodeSample|
code1={{CodeSample|
title=Code Sample|
title=Code Sample|
description=The following example will put all of your broken skulls in your mall store for 500 meat.|
description=The following example will put all of your broken skulls in your mall store for 500 meat at a limit of 5.|
code=
code=
<syntaxhighlight>
<syntaxhighlight>
CODE GOES HERE
put_shop(500 , 5 , $item[broken skull]);
</syntaxhighlight>}}|
</syntaxhighlight>}}|


see_also={{SeeAlso|FIRST|SECOND|ETC}}|
see_also={{SeeAlso|have_shop|shop_amount|shop_limit|take_shop}}|
cli_equiv=The CLI command "mallsell" works similarly.|
cli_equiv=The CLI command "mallsell" works similarly.|
}}
}}
[[Category:Item Management]]

Latest revision as of 05:34, 16 February 2021

Function Syntax

boolean put_shop(int price ,int limit ,item it )

boolean put_shop(int price ,int limit ,int qty ,item it )

  • price is the price to set; using 0 will result in the max-price of 999,999,999 if item is not currently in your store
  • limit is the limit per player per day, or no limit if set to 0
  • qty an optional parameter for the quantity of items to put in your shop (defaults to all if not provided)
  • it is the item to put in your mall store.

Places items in your mall store with settings as described above. Returns true if placement is successful and false if placement fails.

Note that attempting to put an item in your store at less than minimum mall price will automatically reset the price to mall minimum.

Note that attempting to put a negative amount of an item in your store will not do anything, but will still return true.

Note that you cannot specify a quantity of 0 to change prices, but the function will still return true.

Note: Previous versions had a bug where passing a float value as the item quantity would cause it to be interpreted as the integer 0, or (less frequently) the result of interpreting the binary representation of said floating-point number as a 64-bit integer. This issue was exacerbated in JavaScript, because all JavaScript numbers are floating-point numbers. This bug was fixed in r20632.

Code Sample

The following example will put all of your broken skulls in your mall store for 500 meat at a limit of 5.

put_shop(500 , 5 , $item[broken skull]);

CLI Equivalent

The CLI command "mallsell" works similarly.

See Also

have_shop() | shop_amount() | shop_limit() | take_shop()