Equipped amount: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
Created page with '{{#vardefine:name|equipped_amount}} {{#vardefine:return_type|int}} {{FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name…'
 
add boolean
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:name|equipped_amount}}
{{
{{#vardefine:return_type|int}}
#vardefine:name|equipped_amount}}{{
#vardefine:return_type|int}}{{


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


function1={{Function|
function1={{Function|
Line 12: Line 12:
return_also={{#var:return_also}}|
return_also={{#var:return_also}}|
parameter1={{Param|item|it}}|
parameter1={{Param|item|it}}|
}}|
function2={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|item|it}}|
parameter2={{Param|boolean|includeAllFamiliars}}|
p1desc={{Pspan|it}} is the item that will be checked for among your worn gear.|
p1desc={{Pspan|it}} is the item that will be checked for among your worn gear.|
p2desc={{Pspan|includeAllFamiliars}} is whether you want to check the familiars in your terrarium in addition to your current familiar.|
}}|
}}|


Line 18: Line 28:


code1={{CodeSample|
code1={{CodeSample|
title=Sample Code|
title=Code Sample|
description=Checks if you're safe to chat.|
description=Checks if you're safe to chat.|
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if (equipped_amount($item[sword behind inappropriate prepositions]) == 1)
if (equipped_amount($item[sword behind inappropriate prepositions]) == 1 && have_effect($effect[Wanged]) == 0)
// Sword doesn't fire if you have this particular effect.
   abort("You aren't safe to chat!");
   abort("You aren't safe to chat!");
</syntaxhighlight>
</syntaxhighlight>
}}|
}}|


see_also={{SeeAlso|abort}}|
see_also={{SeeAlso|closet_amount|display_amount|item_amount|shop_amount|stash_amount|storage_amount}}|
}}
}}
[[Category:Item Management]][[Category:Equipment]]

Latest revision as of 08:56, 24 March 2023

Function Syntax

int equipped_amount(item it )

int equipped_amount(item it ,boolean includeAllFamiliars )

  • it is the item that will be checked for among your worn gear.
  • includeAllFamiliars is whether you want to check the familiars in your terrarium in addition to your current familiar.

Returns the amount of a given item currently equipped on your character.

Code Sample

Checks if you're safe to chat.

if (equipped_amount($item[sword behind inappropriate prepositions]) == 1 && have_effect($effect[Wanged]) == 0)
// Sword doesn't fire if you have this particular effect.
   abort("You aren't safe to chat!");

See Also

closet_amount() | display_amount() | item_amount() | shop_amount() | stash_amount() | storage_amount()