Skip to main content

If

Makes a decision and sends the flow down a different path.

If offers five ways to write the same kind of condition, so almost any "if this, do that" branch is one node. They all resolve through one shared expression engine, so the no-code and advanced modes can never disagree.

Purpose

Branch the flow on a condition — a value comparison, a raw expression, a multi-way switch, an OCR text match, or an upstream node's real outcome.

When to use it

  • Deciding between two paths based on a variable.
  • Dispatching to one of several routines (switch/case).
  • Reacting to what an OCR read said.
  • Reacting to whether an earlier detection found something.

When not to use it

  • To branch immediately on a detection you are about to run. Find Image already has Success and Failure ports — an If after it is redundant.
  • To pick a path at random — use Branch.
  • To repeat something — use Loop.

The five condition modes

ModeYou writePorts
Compare ValuesA no-code builder: value, operator, valueTrue / False
ExpressionA raw {{}} formulaTrue / False
Multiple BranchesOne expression per branch (switch/case)case1caseN, Default
Match Text (OCR)A list of candidate strings and a match modeMatch / No match
Node outcomeAn upstream node and a plain-language outcomeTrue / False

Compare Values

Each row is Value A, an operator, Value B. Each side is a variable or a fixed value, and may apply one arithmetic step before comparing — so CASTLE_X > CURRENT_X - 5 is expressible without writing a formula.

Operators: =, !=, >, >=, <, <=, Contains, Not Contains, Starts With, Ends With, Is Empty, Is Not Empty.

Rows combine with a single AND (all must pass) or OR (any passes).

Expression

A raw expression that must evaluate to a boolean:

{{gem_farmed_trip}} >= {{max_gem_per_trip}}
{{slot_1_current}} == {{slot_1_max}} || {{slot_2_current}} == {{slot_2_max}}
An expression must be a boolean

{{gold}} is a number, not a condition. {{gold}} > 100 is a condition. A non-boolean expression routes Fatal.

Multiple Branches (switch/case)

An ordered list of up to 20 branches, each one expression plus an optional label. The first branch whose expression is true takes its Case port; if none match, Default is taken.

Because branches are tried top-to-bottom, put the most specific condition first.

Match Text (OCR)

Reads text from an upstream Read Text node (or an expression) and tests it against a list of up to 500 candidate values under one match mode: Contains, Exact, Starts With, Ends With, Regex, or Fuzzy. Any value matching routes Match.

The 500-value ceiling means one node can screen a large set of known messages at once.

Node outcome

Checks an upstream node's real execution result through a plain-language outcome, instead of a raw expression over internal field names.

Source node typeOutcomes
Find ImageFound / Not found
Check RegionPassed / Not passed
Read TextHas text / No text
IfCondition true / false
CaptchaCaptcha solved / unsolved
Everything elseSucceeded / Failed

This is how you branch on a detection that happened several steps back, without keeping a variable in sync.

Settings

SettingTypeRangeNotes
Condition typechoicethe five modes aboveDrives which other fields appear
Conditionslist1–50 rowsCompare Values mode
Logicchoiceand / orHow rows combine
Expressionstring≤ 1000 charsExpression mode
Brancheslist1–20Multiple Branches mode
Text sourcenode ref or expressionMatch Text mode
Match modechoicecontains, exact, startsWith, endsWith, regex, fuzzyMatch Text mode
Valueslist1–500Match Text candidates
Case sensitivebooleanMatch Text mode
Fuzzy thresholdnumber0–1Fuzzy match strictness
Source node + Outcomenode ref + choiceNode outcome mode

Ports

Ports depend on the mode:

PortModeRequired
True / FalseCompare Values, Expression, Node outcomeBoth required
Match / No matchMatch TextOptional — an unwired path ends gracefully
case1…caseN / DefaultMultiple BranchesOptional
FatalAllNever followed
Why some modes require both ports and others don't

Compare/Expression/Node-outcome are true binary decisions — leaving one side unwired is almost always a mistake, so validation requires both.

A switch case or a text-match branch is different: wiring only the cases you care about is a legitimate authoring choice, so unwired ones simply end that path.

Basic example

Stop once a target count is reached:

  • Condition type: Expression
  • Expression: {{items_done}} >= {{max_per_trip}}
  • TrueStop: success
  • False → carry on

Realistic example — dispatch with a switch

A variable holds a direction chosen earlier; one node routes to four different movements:

Always give a switch a Default. It is the branch that catches the case you did not think of.

Advanced example — branch on an earlier detection

Ten nodes ago a Find Image checked whether a popup was present. You need that answer now:

  • Condition type: Node outcome
  • Source node: the Find Image
  • Outcome: Not found
  • True → skip the dismissal routine
  • False → dismiss the popup

No variable to maintain, no risk of it drifting out of sync with the real result.

Best practices

  • Use Compare Values unless you need a formula. It needs no syntax and shows variable types in the picker.
  • Pick variables from the dropdown rather than typing names — it shows the type, which prevents the "comparing text to a number" bug.
  • Always add a Default to a switch.
  • Order switch branches most-specific first.
  • Prefer Node outcome over mirroring results into variables.
  • Wire both True and False. They are required for a reason.

Performance notes

  • If is a pure computation — no frame capture, no input. It is effectively free.
  • Never restructure a graph to "reduce Ifs"; readability is worth far more than the nanoseconds involved.
  • A Match Text node screening 500 candidates is still cheap compared to a single OCR read, so batching candidates into one node is the right call.
  • Node outcome reads an already-recorded result; it does not re-run the source node.

Memory notes

  • Evaluation allocates nothing meaningful.
  • Node-outcome mode reads from the run's nodeResults, which already holds every executed node's result — so it adds no storage of its own.

Common mistakes

MistakeWhat happensFix
Leaving False unwiredValidation error (Compare/Expression/Outcome)Wire both
A non-boolean expressionFatalCompare it: {{gold}} > 100
Node outcome before the source ranFatalOrder them correctly on the same path
Comparing OCR text as a numberComparison silently failsUse the Number type in Read Text, or convert with Variable
Switch with no DefaultUnmatched input ends the pathAdd a Default
Switch branches in the wrong orderA general case shadows a specific oneMost specific first

Troubleshooting

The node routes Fatal. The condition is empty, non-boolean, references an unknown outcome, or its source node has not executed on this path.

A numeric comparison never fires. The value is a string. Set the Read Text type to Number.

The wrong switch case is taken. Branches are evaluated top-to-bottom and the first true one wins. Reorder so the specific case precedes the general one.

A Match Text branch never runs. Check case sensitivity and the match mode. Fuzzy mode also depends on the threshold.

FAQ

How many switch branches are allowed? Up to 20.

How many candidate values in Match Text? Up to 500.

Can I mix AND and OR in Compare Values? Not in one node — rows share a single AND/OR. Use Expression mode, or chain two Ifs.

Does removing a switch branch break my wiring? The trailing port is dropped and the editor prunes its orphaned edge.

  • Branch — random selection instead of a condition
  • Variable — compute the values you compare
  • Read Text — supplies text for Match Text mode
  • Find Image — supplies outcomes for Node outcome mode
  • Loop — repetition rather than a one-off decision