Difference between revisions of "Is online"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
imported>StDoodle
m
Line 16: Line 16:
 
}}|
 
}}|
  
function_description=Checks to see if a given player is currently online, returning true if they are, false otherwise. Works on any player, not just those on your friends list and in your clan.|
+
function_description=Checks to see if a given {{pspan|player}} is currently online, returning true if they are, false otherwise. Works on any player, not just those on your friends list and in your clan.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|

Revision as of 18:26, 5 May 2010

Function Syntax

boolean is_online(string player )

  • player is the name of a player

Checks to see if a given player is currently online, returning true if they are, false otherwise. Works on any player, not just those on your friends list and in your clan.

Code Sample

Try to get Sonata of Sneakiness from an online buffbots, skipping those that are not online.

int bots_tried;
if(is_online("IocaineBot")) {
   cli_execute("csend 18 meat to IocaineBot");
   bots_tried = bots_tried + 1;
}
if(is_online("KolaBuff")) {
   cli_execute("csend 23 meat to KolaBuff");
   bots_tried = bots_tried + 1;
}
if(is_online("zonkttc")) {
   cli_execute("csend 17 meat to zonkttc");
   bots_tried = bots_tried + 1;
}
print("Asked "+ bots_tried +" buffbots for Sonata of Sneakiness.");