Macro steps: variables, conditions and loops
Store values, branch with If and Switch, loop, run macros inside macros, and drive your other accounts.
Variables
Each run has its own variables. They keep their values across the loops of that run and start empty when you run it again. Use one anywhere a step takes text: %var:NAME%, or a field of it with %var:NAME.field%.
| Step | What it stores |
|---|---|
| Set Variable | A value you type, as text, a number or true/false. Tokens are filled in. |
| Counter / Increment | Adds a number to a variable each time it runs. A negative number counts down. |
| Persist Variable | Saves a variable for that account, or loads it back. Load at the start and save at the end to keep a counter across runs. |
| Read Slot | What a slot holds: empty, name, displayName, count, customName, lore, loreText. |
| Find Slot | slot (-1 when missing), found, name, count. |
| Save Position | The account’s x, y, z. |
If / Branch
If / Branch tests one thing. The steps inside it run only when the test is true. Drag a step in under the If and a little to the right to put it inside, and back to the left to take it out. Dragging the If moves its steps with it.
| It can test | Compared with |
|---|---|
| Variable | A variable or a field of it. |
| Item field in a slot | The name, count, custom name or lore of a slot. |
| Account health, Account food | A number from 0 to 20. |
| Total inventory count of an item | How many of an item the account carries. *sign counts every sign. |
| Free inventory slots | 0 to 36. 0 means the inventory is full. |
| A container/GUI is open, a server dialog is open | true or false. A dialog’s title and text can be tested too. |
| World day/night, World time tick | day or night, or a tick from 0 to 23999. |
| Players | How many players are nearby, whether one player is nearby or online. |
| Held item, position | The item in hand, or the account’s X, Y or Z. |
You compare with equals, not equals, less than, greater than, contains, starts with or a regular expression. The older If Health step still works.
Wait Until Condition and Switch
| Step | What it does |
|---|---|
| Wait Until Condition | Checks the same kind of test again and again until it is true, or the timeout passes (up to one hour). |
| Switch / Match Cases | Compares one value with up to six cases. The first match decides: continue, skip steps or stop the run. |
Loops and error handling
| Step | What it does |
|---|---|
| Repeat Steps | Runs a range of steps again, 1 to 500 times. |
| While | Repeats the steps inside it while a condition holds, with a limit on the passes (100 by default). |
| For Each Item | Runs a range once for every matching inventory slot, with the current item in a variable. |
| Jump to Step | Continues at another step of the list. Jump back to build a loop. A jump limit keeps it from running forever. |
| Try / Catch | Runs a range and, if a step in it fails, runs a recovery range instead of failing the macro. |
Ranges are step numbers, counted from 1 as shown on the cards. Moving steps updates them for you.
Stop, nest and errors
| Step or setting | What it does |
|---|---|
| Abort Run | Ends this run cleanly. With loops on, the next loop starts after the wait between loops. |
| Run Macro | Runs another saved macro at this point, 1 to 100 times, sharing the variables. Only its steps run, not its trigger or loop settings. |
| Stop on Error | On by default: a failing step ends the run. Off: the failure is logged and the next step runs. |
Drive your other accounts
One macro can start and steer macros on your other accounts, on any Node.
| Step | What it does |
|---|---|
| Run on Accounts | Starts a saved macro on other accounts: the ones you pick, all others, or all connected ones. It can pass variables along and wait until they finish. |
| Stop on Accounts | Stops one macro, or every macro, on other accounts. |
| Send Signal | Sends a named signal with a value to other accounts. |
| Wait for Signal | Waits until another account sends that signal. The value and the sender land in a variable. |
An event macro can start on a signal too, see On Signal.
Example: count runs across restarts
Load the counter
Persist Variable, action Load, variable
runs, default 0.Do the work
The steps you want counted.
Count and save
Counter / Increment on
runs, then Persist Variable with action Save.Show it
Log Message with
Run %var:runs% done.
Check the troubleshooting guide or return to all guides.