Is online: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
new page
 
imported>StDoodle
mNo edit summary
Line 13: Line 13:
return_also={{#var:return_also}}|
return_also={{#var:return_also}}|
parameter1={{Param|string|buffbot}}|
parameter1={{Param|string|buffbot}}|
p1desc={{Pspan|command}} is the name of a buffbot|
p1desc={{Pspan|buffbot}} is the name of a buffbot|
}}|
}}|



Revision as of 18:19, 5 May 2010

Function Syntax

boolean is_online(string buffbot )

  • buffbot is the name of a buffbot

Checks to see if a given buffbot is currently online. This only works with registered buffbots, not just any other player.

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.");