Have servant: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Relyk
Created page with "{{ #vardefine:name|have_servant}}{{ #vardefine:return_type|boolean}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:name}}| aggregate={{#var:aggregate..."
 
imported>Relyk
No edit summary
 
Line 19: Line 19:
code1={{CodeSample|
code1={{CodeSample|
title=Code Samples|
title=Code Samples|
description=Lists out all the familiars you currently have and the total number you have over the total available.|
description=Lists out all the servants you currently have.|
code=
code=
<syntaxhighlight>
<syntaxhighlight>
int total, have;
foreach it in $servants[] {
foreach it in $familiars[] {
   if (have_servant(it)) {
  total += 1;
       print("You have the servant "+it+"!", "blue");
   if (have_familiar(it)) {
       print("You have the familiar "+it+"!", "blue");
      have +=1;
   }
   }
}
}
print("");
print("You have "+have+"/"+total+" available familiars.", "green");
</syntaxhighlight>|
</syntaxhighlight>|


}}|
}}|


see_also={{SeeAlso|use_familiar}}|
see_also={{SeeAlso|use_servant}}|
cli_equiv=The CLI command "familiar" with the parameter "list" functions similarly.|
cli_equiv=The CLI command "servant"||
special= Note that in Bad Moon it only checks the familiars you have acquired in the current run.|
}}
}}


[[Category:Equipment]]
[[Category:Equipment]]

Latest revision as of 07:00, 19 October 2015

Function Syntax

boolean have_servant(servant check_me )

  • check_me is the servant to check for

Returns true if you have the specified servant check_me, and false otherwise. Returns false if you are not Ed the Undying.

Code Samples

Lists out all the servants you currently have.

foreach it in $servants[] {
   if (have_servant(it)) {
      print("You have the servant "+it+"!", "blue");
   }
}

CLI Equivalent

The CLI command "servant"

See Also

use_servant()