Goto http://www.stucuk.netGoto http://www.atlanticaonlinewiki.comGoto


From Original War Support Wiki

Jump to: navigation, search

Tutorials -> Variables



Info and defining

Variables are used for containing some data. They have to be defined before they can be used. There are two ways to define them:
First one allows use of them in all SAIL modules (tabs with code):

export MyGlobalVar1, MyGlobalVar2;

Second one makes them available only for the current module (tab):

var MyLocalVar1, MyLocalVar2;

It is said that var creates local variables and export creates global. Local aren't seen by other modules and therefore each module can have its own variable of the same name and it will be a different variable!

That's a simple situation where they were defined outside any other block but you can also define variable available only for a specific part of code, for example function or starting block:

function MyFunction();
var MyVar1;
// the rest of function's block

Then only MyFunction would be able to use MyVar1.
The line with function's definition is followed by line with the var command to create function's local variables.
That way you can have unlimited functions with variable of the same name but it would be a different variable.


Type of variable in SAIL isn't predefined so any variable can contain any data.


MyVar:= true;
MyVar:= false;

Integer and number with floating point:

MyVar:= 112;
MyVar:= 1.45;

Array of any type:

MyVar:= [2, 4];

See arrays.


MyVar:= 'I am Radzio! Listen to me!';

Some notes

1) Boolean values can be replaced by numbers (false -> 0, true -> 1).
2) Variables' names cannot start with a number; these won't be accepted: 9Something, 11Wo;
3) Variables' names cannot have white-space characters (spaces, tabs) and any special characters except: _
4) Variables' names aren't case sensitive so code won't allow you to have: john, John, JOHN; as different variables.
5) Unit's identifier is a variable. You cannot have variable named as unit's identifier.
6) You cannot have variable named as function and vice versa.

Personal tools
This is a cached copy of the requested page, and may not be up to date.

Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.

(Cannot contact the database server: MySQL functions missing, have you compiled PHP with the --with-mysql option? )

You can try searching via Google in the meantime.
Note that their indexes of our content may be out of date.