Difference between pages "Modifier eval" and "Is online"
(Difference between pages)
Jump to navigation
Jump to search
imported>Slyz (add all the modifier variables) |
imported>StDoodle m |
||
Line 1: | Line 1: | ||
{{ | {{ | ||
− | #vardefine:name| | + | #vardefine:name|is_online}}{{ |
− | #vardefine:return_type| | + | #vardefine:return_type|boolean}}{{ |
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
+ | function_category=Miscellaneous| | ||
function1={{Function| | function1={{Function| | ||
Line 11: | Line 12: | ||
return_type={{#var:return_type}}| | return_type={{#var:return_type}}| | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
− | parameter1={{Param|string| | + | parameter1={{Param|string|player}}| |
− | p1desc={{ | + | p1desc={{Pspan|player}} is the name of a player| |
}}| | }}| | ||
− | function_description= | + | 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| | ||
title=Code Sample| | title=Code Sample| | ||
− | description= | + | description=Try to get Sonata of Sneakiness from an online buffbots, skipping those that are not online.| |
code= | code= | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | + | 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."); | ||
+ | </syntaxhighlight>}}| | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}} | }} | ||
− | |||
− |
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.");