Variables

BRAIN allows you to use and create variables within your scripts to maintain state and store responses from users, web sites, etc. In addition to user-created variables, BRAIN also maintains a number of its own system variables that you can also use in your scripts. Unlike user-created variables, system variables are read-only.

To see the variables that are available within BRAIN, as well as their current values, simply click on the Show Variables button while in the script editor. Optionally, you can “dump” (display) all of the existing variables to the Robot console (available under the Robot Status tab) for easy cutting and pasting.

Variable Buttons

To view all the variables, click on the Show Variables button while in the script editor:

page13_1

All of BRAINS’ variables, and their values will be displayed. There are three columns displayed:

Name: This is the name of the variable. Note that the variables are case-senstive.
Value: This is the current value of that variable.
Read Only: This indicates whether or not a variables is a system variable (a variable BRAIN manages) or a user variable (a variable created by one of your scripts). If the variable is read only (value set to True) then it is a system variable, and while you can use it in your scripts, you cannot modify its value.



lightbulb Note: In BRAIN, variables are NOT case-sensitive. The variable $Time is the same as the variable $TIME to BRAIN.




Variable assignment.
Assigning a value to a variable (which also creates the variable if necessary) is simple:

Syntax:
$variable=value

Examples:
$MyName=Samantha
$Fortune=Today is your lucky day
$count=10
$count=$count+1

You can assign a value to variable by prompting the user with the following syntax:
$YourName=ASK What is your name?
SAY Nice to meet you $YourName


You can assign a value to variable via a web page extract with the following syntax:
$temp=EXTRACT http://www.website.com,stringOnLeftSide,StringOnRightSide
SAY It is $temp degrees.

lightbulb See the Keywords section for more details on these commands.




System variables.

As mentioned above, BRAIN has a number of built-in variables that you can also use in your scripts. These are known as system variables to BRAIN.

System variables are read-only. You cannot modify the value of a System variable.



lightbulb Click this link to see a complete list of BRAINS’ system variables.