20% offevery plan

Black Friday Sale. New purchases, extensions and upgrades all qualify.

Ends in
00days
00hrs
00min
00sec
See plans
Everyday Tools

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%.

StepWhat it stores
Set VariableA value you type, as text, a number or true/false. Tokens are filled in.
Counter / IncrementAdds a number to a variable each time it runs. A negative number counts down.
Persist VariableSaves 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 SlotWhat a slot holds: empty, name, displayName, count, customName, lore, loreText.
Find Slotslot (-1 when missing), found, name, count.
Save PositionThe 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 testCompared with
VariableA variable or a field of it.
Item field in a slotThe name, count, custom name or lore of a slot.
Account health, Account foodA number from 0 to 20.
Total inventory count of an itemHow many of an item the account carries. *sign counts every sign.
Free inventory slots0 to 36. 0 means the inventory is full.
A container/GUI is open, a server dialog is opentrue or false. A dialog’s title and text can be tested too.
World day/night, World time tickday or night, or a tick from 0 to 23999.
PlayersHow many players are nearby, whether one player is nearby or online.
Held item, positionThe 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

StepWhat it does
Wait Until ConditionChecks the same kind of test again and again until it is true, or the timeout passes (up to one hour).
Switch / Match CasesCompares one value with up to six cases. The first match decides: continue, skip steps or stop the run.

Loops and error handling

StepWhat it does
Repeat StepsRuns a range of steps again, 1 to 500 times.
WhileRepeats the steps inside it while a condition holds, with a limit on the passes (100 by default).
For Each ItemRuns a range once for every matching inventory slot, with the current item in a variable.
Jump to StepContinues at another step of the list. Jump back to build a loop. A jump limit keeps it from running forever.
Try / CatchRuns 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 settingWhat it does
Abort RunEnds this run cleanly. With loops on, the next loop starts after the wait between loops.
Run MacroRuns 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 ErrorOn 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.

StepWhat it does
Run on AccountsStarts 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 AccountsStops one macro, or every macro, on other accounts.
Send SignalSends a named signal with a value to other accounts.
Wait for SignalWaits 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

  1. Load the counter

    Persist Variable, action Load, variable runs, default 0.

  2. Do the work

    The steps you want counted.

  3. Count and save

    Counter / Increment on runs, then Persist Variable with action Save.

  4. Show it

    Log Message with Run %var:runs% done.

Need a hand?

Check the troubleshooting guide or return to all guides.