Contents
Support Managers
Aerielle Kiyori
English
| online |
GTASkinCentral
English
| online |
Xartashah
English
| online |
Amyalka
English
| offline |
Glaznah Gassner
English, Russian
| 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 |
SBSL User Variables
Main > Bot Scripting Language > SBSL User Variables
Have a question? Ask at SmartBots DevPortal!
DevPortal is a blog and forum for developers. Ask your questions to get a prompt reply!
SBSL supports two types of variables:
- pre-defined variables: the ones which come automatically with SBSL Events,
- user variables: the ones discussed in this section.
User variables
User variables are script-wide variables which hold their values for unlimited time. Here's the short example of SBSL code:
# Define user variables var $my_counter var $last_contact chat_message { # increase the counter $my_counter++ set $last_contact $speaker_name # report to the owner im Glaznah Gassner Chat messages received so far: $my_counter, last message by $last_contact }
Definition
Each user variable much be defined before usage. The variable is being defined above all events using the var keyword.
var $my_counter
Setting the value
There are two ways to set the variable value:
- increment: ++ operator.
This operation increases the variable by 1. If variable value was not a number, this converts it to number 1. - set to specific value: set keyword.
You can use the pre-defined and user variables to compose the resulting value.
$my_counter++ set $last_contact $speaker_name
Using the variable
The user variable can be used as any other system variable within a command:
im Glaznah Gassner Chat messages received so far: $my_counter, last message by $last_contact
Variable life time
The variable value is being stored forever, despite of bot restarts, expirations or other factors.