EQWatcher Evolution > Scripting > Variables

Variables can have a global scope (public), scope of a script, or local to a function.  Only script variables can be made public, since function variables exist only when that function is called, and for the duration of that function.  For more information on functions see the functions section.  Script variable definitions must be made outside of any function, and function variable definitions must be made, as you might expect, inside that function.

The syntax for creating a variable is as follows:

[public] [Variable Type] [Name];

public: The public option makes script-scope variables global, available for use in triggers an aliases (and their Action Data), and may be accessed by other scripts either through any trigger, alias, or Action Data text, or by declaring the same public variable.  Local variables (function scope) cannot be made public.

Variable Type: The variable type can be one of the following:

  • boolean: Possible values are "true" (not zero) and "false" (zero)
  • string: Variable data contains text
  • signed long: Possible values are -2,147,483,646 to 2,147,483,647
  • unsigned long: Possible values are 0 to 4,294,967,295
  • char: Possible values are 0 to 255 (though char normally represents an ASCII Character, such as a letter or number like 'a' or '9').
  • byte: Possible values are 0 to 255

Name: The variable name must start with a letter, and contain only letters and numbers.  It can be up to 254 characters in length without cause any problems.  Variable names ARE case sensitive!


public signed long Damage;  creates a public (global) variable of type signed long, named Damage.

signed long NonPublicDamage;  would create a non-public variable of type signed long, named NonPublicDamage.

As of version 1.25, variable declarations can now also perform initialization, such as

public signed long Damage=12;  creates a public (global) variable of type signed long, named Damage, initializing it to a value of 12.

Public Variables Explanation

As of version 1.50, public variables work slightly different than they used to.  Previously, a single script "owned" a public variable, and only that script could actually access the variable directly.  Now, any script that declares a public variable with the same name will be accessing the same exact variable, and can do so directly -- including modification.  Public variables stay in existence for the life of the interpreter, from the moment they are first created by a script.  There are no restrictions on the data type of the variable -- if it is first declared as a string, it will be known as a string to the interpreter but possibly used as an integer in another script.