
33
9
GP16P Scripting Language Structure
9.1 - Script Structure
The structure of a script file is shown below. Global variable declarations must be done at the
start of the file before any actions are defined. There can be any number of actions defined in the
script file. Comments may appear at any point in the script file.
constant declarations
variable declarations
array declarations
action bodies
subroutine bodies
9.2 - Constant Declarations
A constant declaration begins with the keyword "constant:" followed by the constant name and a
value assignment. The following example shows the structure of constant declarations.
constant: name = number
constant: name = "string"
The following example shows the declaration of two constants. The first global constant "c1" is
initialized with the numeric value of 1000. The second constant "c2" is initialized with the string
"Have a nice day.".
constant: c1 = 1000
constant: c2 = "Have a nice day."
9.3 - Global Variable Declarations
A global variable declaration begins with the keyword "variable:" and the variable name. After
the variable name an optional assignment may be specified. The following example shows the
structure of global variable declarations.
variable: name
variable: name = number
variable: name = "string"
The following example shows the declaration of three global variables. The first global variable
"v1" is not initialized. The virtual machine will initialize this variable to an empty string. The
second global variable "v2" is initialized with the numeric value of 10 . The third global variable
"v3" is initialized with the string "Hello World".
variable: v1
variable: v2 = 10
variable: v3 = "Hello World"