|show offline managers|
|English, Japanese, Russian|
Have a question? Ask at SmartBots DevPortal!
DevPortal is a blog and forum for developers. Ask your questions to get a prompt reply!
Provides the conditional execution of the commands.
if $VARIABLE_NAME compare TEXT_OR_VARIABLE ...COMMANDS 1... elsif $VARIABLE_NAME compare TEXT_OR_VARIABLE_2 ...COMMANDS 2... else ...COMMANDS 3... endif
The following table explain the entries of the command:
|$VARIABLE_NAME||is one of the event's predefined variables|
|compare||is a comparison operator (see below)|
|TEXT_OR_VARIABLE|| is either predefined variable or string
compare is a comparison operator:
|=~||$VARIABLE_NAME contains the TEXT (case sensitive!)|
|!~||$VARIABLE_NAME does not contain the TEXT (case sensitive!)|
|=~*||$VARIABLE_NAME contains the TEXT (case insensitive)|
|!~*||$VARIABLE_NAME does not contain the TEXT (case insensitive)|
Substring comparison matches with any substring by default:
# this will work for the following messages: # "ok", "okay", "ok, fine!", "spoke", "it is ok" if $message =~* ok ... endif
You can force the complete word match by placing your string to double quotes:
# this will work only with: # "ok", "ok, fine!", "it is ok" # these strings DO NOT match anymore: # "okay", "spoke" if $message =~* "ok" ... endif
Each if may contain one or more elsif lines to check subsequent conditions. Also, else keyword may contain additional commands which does not fit any comparison.
See one of SBSL examples for demonstration.
To compare variable against empty string, use NULL:
if $message != NULL ...COMMANDS... endif