Difference between revisions of "Have skill"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{#vardefine:name|have_skill}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Skills and Effects| function1={{Function| name={{#var:na…')
 
imported>Heeheehee
m (Missing parenthesis; filled in.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#vardefine:name|have_skill}}
+
{{
{{#vardefine:return_type|boolean}}
+
#vardefine:name|have_skill}}{{
 +
#vardefine:return_type|boolean}}{{
 +
 
 +
FunctionPage|
  
{{FunctionPage|
 
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Skills and Effects|
 
  
 
function1={{Function|
 
function1={{Function|
Line 22: Line 23:
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
if (! have_skill($skill[Transcendent Olfaction])
+
if (! have_skill($skill[Transcendent Olfaction]) )
 
   print("Don't forget to grab a lucre today; you want that sniffytome!" , "red");
 
   print("Don't forget to grab a lucre today; you want that sniffytome!" , "red");
</syntaxhighlight>}}|
+
</syntaxhighlight>
 +
}}|
  
 
cli_equiv=The CLI command "skills" is similar.|
 
cli_equiv=The CLI command "skills" is similar.|
 
special=Always returns false when no character is logged in.
 
special=Always returns false when no character is logged in.
 
}}
 
}}
 +
 +
[[Category:Skills and Effects]]

Latest revision as of 03:37, 7 July 2010

Function Syntax

boolean have_skill(skill check )

  • check is the skill to check for

Returns true if your character currently has the skill (permanent as applicable or bought in-run) or false otherwise.

Code Sample

The following prints a friendly reminder to grab some lucre if you don't have Olfaction.

if (! have_skill($skill[Transcendent Olfaction]) )
   print("Don't forget to grab a lucre today; you want that sniffytome!" , "red");

CLI Equivalent

The CLI command "skills" is similar.

Special

Always returns false when no character is logged in.