Difference between revisions of "Can interact"

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
imported>StDoodle
m
Line 13: Line 13:
 
}}|
 
}}|
  
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.|
+
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).
 +
*For Hardcore characters, this function returns true after the king is freed, and false otherwise.
 +
*This function always returns true in Casual.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|

Revision as of 15:58, 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.

  • 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 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.