A variable is a "named box" used to store data at runtime (such as the result coordinates of an image search, OCR-recognized text, a counter, and so on).
How to use one:
count) into the "Variable Name" field of a Set Variable node and you get a local variable — no prior definition neededCtrl+3), then click the ◎ button next to the variable name field of the "Set Variable" node to pick it — that gives you a global variableLocal vs global variables:
There is no "scope: local/global" switch — the scope is decided by whether you pick a Variables-tab entry with ◎. Any name that isn't picked and doesn't match a Variables-tab entry is treated as a local variable, which keeps older projects behaving exactly as before.
Typical usage:
result), including coordinates and confidenceNote: variables are not persisted — every run starts again from the default values set in the Variables tab. So you cannot use variables for run-spanning counters like "times collected today"; use a Custom Code node to read/write a file if you need that.
Conditions let your script "take different paths depending on the situation". Every node can have an execution condition set (at the bottom of the node configuration):
count >= 5 (only run after more than 5 loop iterations)How are "success/failure" defined?
false = failure; returns true/another value, or returns nothing (no failure inside) = successThe Loop node is a container — drag other nodes into it and they'll be executed repeatedly. Three modes:
How to use:
Tip: in an infinite loop, we recommend adding a short "Wait" node (e.g. 100ms) to avoid excessive CPU usage.
A function "packages" a group of nodes into a reusable module. Define it once, then call it multiple times from the main flow.
When to use one?
How to use:
Ctrl+5) and edit its internal nodescall_result that captures the return value — rename it in the node config, or clear it to ignore the return valueFunctions can call each other. Inside a function you can read and write this run's local variables directly (visible across functions within the same run); use global variables only when data must be shared across actions.
return false mean?AllWhen a function needs to hand a result back to its caller, add a Return node (Flow Control group) inside the function and put a variable name, an expression, or a literal in its "Return Value" field. Leave it empty to return nil.
Return value convention:
return false — business failure: the script raised no error, but the goal wasn't met (the target never appeared, the reward wasn't claimed). The task is treated as failed, the run is not counted, and it is retried using the task's retry settings.return true or any other value — successThis convention only applies to the entry function — the one a task invokes directly. Its purpose is to report "technically fine, business failed" back to the task system.
Two things to watch out for:
An expression is a snippet of Lua code that produces a value when run. It lets you perform calculations, concatenation, comparisons, and other flexible operations.
Places where you can use expressions:
count >= 10 and hp < 30count + 1, name .. "_done""Loop #" .. countwait(math.random(500, 1500))Note: the Wait node takes a fixed number of milliseconds and does not support expressions.
Common syntax:
a + b, a * 2, a % 3"hello" .. namex > 100, name == "test"a and b, a or b, not aWhen "Expression" is not checked, the input field's content is treated as plain text/a number.