General EQWatcher Concepts > Venturing into the Unknown > Variables
An EQWatcher variable is used to temporarily store information. Variables have a name, such as "MobName" and their data, such as "orc pawn". Each variable contains a specific type of data as well. The basic types are called: byte, char, signed long, unsigned long, boolean, and string. Variables can also be made "public", which allows the use of that variable in any trigger or alias text (though only the current script will be able to access the variable directly). All variables in EQWatcher Advanced must be pre-defined.
The first four basic types are all considered an integer (whole number) value. Possible values for byte and char are 0-255. Values for signed long are -2,147,483,646 to 2,147,483,647, and unsigned long goes from 0 to 4,294,967,295. The difference between signed and unsigned is that unsigned is always considered positive, and signed can be positive or negative, hence being called "signed".
The boolean variable type is defined as "true" (not zero) or "false" (zero).
The string type stores a sequence of characters, also known as text. There is no limit to the size of any string, but I would not advise going beyond 2,000 or so in the same string.
When using variables in trigger or alias definitions, control characters are used to tell EQWatcher whether you are retrieving information from the text and placing it in the variable, or retrieving information from the variable and placing it in the text. The @ character is placed around a variable name to put information into the variable, and the % character is placed around a variable name to retrieve the variable data. "@MobName@ hits YOU for @trash@" would set MobName equal to whatever is before " hits YOU for ", which would be the name of a mob like "orc pawn", and throws out the rest since no variable named "trash" is defined. Any name could be used, and the data would be thrown out if the variable does not exist. "%MobName% hits YOU for @trash@" would make the trigger ONLY hit for the current value of the MobName variable. If MobName was set to "orc pawn" and an orc shaman started attacking, it would hit only for the orc pawn and not for the orc shaman.
EQWatcher Advanced automatically converts between variable types in most cases. In old EQWatcher, you needed to use a "!" to tell it to convert the variable data to integer. Since all variables in EQWatcher Advanced are pre-defined, this is not necessary and the conversion will be done automatically.
Variables can have the 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] [type] [name];
For example:
public signed long Damage; creates a public variable of type signed long, named Damage.
signed long NonPublicDamage; would create a non-public variable of type signed long, named NonPublicDamage.