Can interact: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Efilnikufecin
No edit summary
imported>Bale
mNo edit summary
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[boolean]] [[can_interact()]]
{{
#vardefine:name|can_interact}}{{
#vardefine:return_type|boolean}}{{


This function returns <i>true</i> if the logged-in character is subject to neither the Hardcore or Ronin restrictions on inter-player interactions.  If the character has not spent the requisite turns and/or has not freed the King (for Hardcore characters), the function returns <i>false</i>.
FunctionPage|
name={{#var:name}}|


An example:
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([[can_interact()]]) {
<ul><li> For characters in Normal (aka Softcore), this function returns false during Ronin, and true out of Ronin (which ends automatically when the king is freed).</li>
   buy(3,$[[item]][hot hi mein]);
<li> For Hardcore characters, this function returns true after the king is freed, and false otherwise.</li>
} else {
<li> This function always returns true in Casual.</li></ul>|
   adventure(10,$[[location]][Knob Goblin Kitchens]);
 
}
code1={{CodeSample|
</code>
title=Code Sample|
[[Category:Your Character | Can interact()]]
description=This is commonly used to determine whether a player can access the mall.|
[[Category:Ash Functions |Can interact()]]
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.
}}
 
[[Category:Your Character]]

Latest revision as of 21:38, 21 May 2010

Function Syntax

boolean can_interact()

This function returns true if the logged-in character is subject to neither Hardcore nor Ronin restrictions.

  • For characters in Normal (aka Softcore), this function returns false during Ronin, and true out of Ronin (which ends automatically when the king is freed).
  • For Hardcore characters, this function returns true after the king is freed, and false otherwise.
  • This function always returns true in Casual.

Code Sample

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.