Can interact: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
imported>Grotfang
No edit summary
Line 1: Line 1:
[[boolean]] [[can_interact()]]
{{#vardefine:name|can_interact}}
{{#vardefine:return_type|boolean}}


This function returns ''true'' if the logged-in character is subject to neither Hardcore nor Ronin restrictions.  If the character has not spent the requisite turns and/or has not freed the King (for Hardcore characters), the function returns ''false''.
{{FunctionPage|
name={{#var:name}}|
function_category=Your Character|


This is commonly used to determine whether a player can access the mall:
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}
}}|


<code>
function_description=This function returns true if the logged-in character is subject to neither Hardcore nor Ronin restrictions.  If the character has not spent the requisite turns and/or has not freed the King (for Hardcore characters), the function returns false.|
  if ([[can_interact()]]) {
    [[buy()|buy]](3,$[[item]][hot hi mein]);
  } else {
    [[adventure()|adventure]](10,$[[location]][Knob Goblin Kitchens]);
  }
</code>
[[Category:Your Character | Can interact()]]
[[Category:Ash Functions |Can interact()]]


When not logged in, this function returns ''false''.
code1={{CodeSample|
title=Code Samples|
description=This is commonly used to determine whether a player can access the mall.|
code=
<syntaxhighlight>
if(can_interact()) {
  buy(3 , $item[hot hi mein]);
}
else {
  adventure(10 , $location[Knob Goblin Kitchens]);
}
</syntaxhighlight>
}}|
 
see_also={{SeeAlso|in_hardcore|adventure|buy}}|
special=When not logged in, this function returns false.
}}

Revision as of 14:18, 1 March 2010



Function Syntax

boolean can_interact()

This function returns true if the logged-in character is subject to neither Hardcore nor Ronin restrictions. If the character has not spent the requisite turns and/or has not freed the King (for Hardcore characters), the function returns false.

Code Samples

This is commonly used to determine whether a player can access the mall.

if(can_interact()) {
   buy(3 , $item[hot hi mein]);
}
else {
   adventure(10 , $location[Knob Goblin Kitchens]);
}

See Also

in_hardcore() | adventure() | buy()

Special

When not logged in, this function returns false.