Difference between revisions of "Can interact"

From Kolmafia
Jump to navigation Jump to search
imported>Efilnikufecin
imported>Zarqon
m (more links, fixed grammar, logged out info)
Line 1: Line 1:
 
[[boolean]] [[can_interact()]]
 
[[boolean]] [[can_interact()]]
  
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>.
+
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''.
  
An example:
+
This is commonly used to determine whether a player can access the mall:
  
 
<code>
 
<code>
if([[can_interact()]]) {
+
  if ([[can_interact()]]) {
  buy(3,$[[item]][hot hi mein]);
+
    [[buy()|buy]](3,$[[item]][hot hi mein]);
} else {
+
  } else {
  adventure(10,$[[location]][Knob Goblin Kitchens]);
+
    [[adventure()|adventure]](10,$[[location]][Knob Goblin Kitchens]);
}
+
  }
 
</code>
 
</code>
 
[[Category:Your Character | Can interact()]]
 
[[Category:Your Character | Can interact()]]
 
[[Category:Ash Functions |Can interact()]]
 
[[Category:Ash Functions |Can interact()]]
 +
 +
When not logged in, this function returns ''true''.

Revision as of 07:16, 29 January 2009

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.

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]);
 }

When not logged in, this function returns true.