Can interact: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Bale
mNo edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Your Character|


function1={{Function|
function1={{Function|
Line 15: Line 14:


function_description=This function returns true if the logged-in character is subject to neither Hardcore nor Ronin restrictions.
function_description=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).
<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>
* For Hardcore characters, this function returns true after the king is freed, and false otherwise.
<li> For Hardcore characters, this function returns true after the king is freed, and false otherwise.</li>
* This function always returns true in Casual.|
<li> This function always returns true in Casual.</li></ul>|


code1={{CodeSample|
code1={{CodeSample|
Line 24: Line 23:
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if(can_interact()) { buy(3 , $item[hot hi mein]); } else { adventure(10 , $location[Knob Goblin Kitchens]); }
if ( can_interact() )
</syntaxhighlight>
{
}}|
  buy( 3 , $item[ hot hi mein ];
} else
{
  adventure( 10 , $location[ Knob Goblin Kitchens ] );
}
</syntaxhighlight>}}|


see_also={{SeeAlso|in_hardcore|adventure|buy}}|
see_also={{SeeAlso|in_hardcore|adventure|buy}}|
special=When not logged in, this function returns false.
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.