Contents
Support Managers
Aerielle Kiyori
English
| online |
Xartashah
English
| online |
Amyalka
English
| offline |
Glaznah Gassner
English, Russian
| offline |
GTASkinCentral
English
| offline |
Justina Mcminnar
English
| offline |
Makaylah Wurgle
English
| offline |
Rehnaeaislinn
English
| offline |
Sammyredfire
English
| offline |
shorty McKeenan
English
| offline |
Twixi Dust
English
| offline |
show offline managers | |
English, Russian |
if (SBSL Command)
Main > Bot Scripting Language > If (SBSL Command)
SBSL Commands |
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.
Syntax
if $VARIABLE_NAME compare TEXT_OR_VARIABLE ...COMMANDS 1... elsif $VARIABLE_NAME compare TEXT_OR_VARIABLE_2 ...COMMANDS 2... else ...COMMANDS 3... endif
Command parameters
The following table explain the entries of the command:
Entry | Description |
---|---|
$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
|
Comparison operators
compare is a comparison operator:
== | exact match |
!= | no match |
=~ | $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) |
Whole word match only
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
Comments
Subsequent comparisons
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.
Comparing empty strings
To compare variable against empty string, use NULL:
if $message != NULL ...COMMANDS... endif