Variables
A variable is a name that holds a value. Its first character says what kind it is:
| Kind | Example | Belongs to | Kept until |
|---|---|---|---|
| Standard | %count |
The script, and scripts it starts with call. |
The script starts again. |
| Namespace | !count |
The current namespace: this script only, or shared with other scripts. | The script starts again (local) or EasyUO Reforged closes (global). |
| Persistent | *count |
Every script, in this and the original EasyUO. | You change or delete it: it is saved in the registry. |
| System | #CharName |
EasyUO and the client. | Built in; see the variable reference. |
- A name is made of letters, digits and
_:%loot_bag,%x2. Nothing else, not even a-. - Case does not matter:
%Countand%COUNTare the same variable. %0,%1,%2, … hold the parameters of the lastgosuborcall, so avoid names made of digits only.
set %var Bobset %Var Joedisplay ok %var ; Joe: %var and %Var are the same variablehaltValues
Section titled “Values”- A value is one word.
set %a hello worldstores onlyhello. To store several words, write_between them, or glue them with commas and#SPC:set %a hello , #spc , world. - Numbers and text are both just values. A value that looks like a whole number (
42,-7,$1A) can be used in calculations; anything else counts as0there. See Expressions. - A variable that was never set reads
N/A. - Use a variable anywhere in a line and its value is put in its place before the command runs. The one
exception is the variable
setandforassign to.
Standard variables: %
Section titled “Standard variables: %”Standard variables are the everyday kind. They belong to the running script and are shared with scripts it
starts with call. They are all cleared when the script starts again.
Namespace variables: !
Section titled “Namespace variables: !”!x is the variable x of the current namespace. A script starts in the local
namespace std, so until you switch, ! variables behave like % variables. Switch namespaces to give a sub
its own variables (namespace local) or to share variables with other scripts
running in EasyUO Reforged (namespace global).
Persistent variables: *
Section titled “Persistent variables: *”Persistent variables survive restarts: they are saved in the Windows registry, under
HKEY_CURRENT_USER\Software\EasyUO, and every script on the computer can read them. EasyUO Reforged uses the
same place as the original EasyUO, so the two share them.
if *runs = N/A set *runs 0set *runs *runs + 1display ok This script has run *runs times.haltFor more data, or data you want to keep in a file of your own, there is also SQL.
SQL or * variables? compares the two.
System variables: #
Section titled “System variables: #”System variables are built in. Most describe the client and your character (#CharPosX, #Hits,
#FindID); a few describe EasyUO itself (#Time, #LPC). Most are read-only; the writable ones are marked
Read / write. They are listed in the variable reference.
Based on the EasyUO wiki, edited for EasyUO Reforged. This text is available under the GNU Free Documentation License 1.2.