Variables and Arrays
What is the variable
Variable is a name (symbol) used in macro to stand for a value. For example, in the expression
mousecur_x + 10
Variables play an important role in Macro Expert because they enable you to create flexible macros. Rather than entering data directly into a script, you can use variables to represent the data. Then, when the macro is played, the variables are replaced with real data. This makes it possible for the same macro to process different sets of data. For example, you might want to use the action "Mouse Move" for placing the mouse pointer at a position, and the position should be determined when the macro is played. You can use a variable to instead of the coordinates value of the position. The mouse pointer will be placed at the position according to the real data in the variable while the action is executing.
Using variable in an action
The most actions support using an expression as the parameter value. You just place the variable name enclosed by the percent signs in the parameter fields. For example, %mousecur_x% tells Macro Player uses the value in the variable mousecur_x while the action executing. For more information, please refer to Expressions.
Global Variables and User Variables
In Macro Expert, there are two type variables, the Global Variables and User Variables. The global variables are built-in variables can be referenced by any macro. The values of these variables are manipulated by Macro Player, and a macro cannot alter them directly. The user variables are restricted to a single macro and its sub-macros. For more information about working with the user variables, please click here.
Naming a variable
An array is a collection that holds a fixed number of variables. These variables have the same name. Each variable in an array is called an element, and each element is accessed by its numerical index (numbering begins with 0). The numerical index is also called subscript. The following is the rules and conventions for the array:
Every variable can be converted to an array by the action Redefine Variable, and some actions can perform the conversion automatically.