FolioTier 1
if
Conditional routing — evaluate an expression, branch to one of two scenes.
Parameters
| Parameter | Kind | Required | Default | Notes |
|---|---|---|---|---|
| condition | expression | yes | — | Bounded expression evaluated against project state. Supports comparison (`>=`, `<`, `==`), boolean operators (`and`, `or`, `not`), arithmetic, membership (`in`), and subsystem references (`stats.<name>`, `inventory.has(<id>)`). Full grammar: see Phase 6 § Design — bounded expressions in verb arguments. |
| true target | scene target | yes | — | Scene to jump to when the condition evaluates truthy. Required — `if` is a routing construct, not a side-effecting block. |
| else target | scene target | yes | — | Scene to jump to when the condition evaluates falsy. Required, same reason as the true target. Use the same scene as the true target if you want a no-op fallthrough (rare in practice). |
Canonical example
if has-key -> unlock-door else -> rattle-door
if love >= 5 -> emma-route-good else -> emma-route-neutralif has_key:
jump unlock_door
else:
jump rattle_door
if love >= 5:
jump emma_route_good
else:
jump emma_route_neutralif is a one-line routing construct, not a Ren'Py-style block of
conditional code. The shape is if <condition> -> <true-target> else -> <false-target> — both arrows are mandatory. The runtime evaluates
the expression, jumps to one of the two scenes, and never falls
through.
This is a deliberate narrowing from Ren'Py's if / elif / else
chains. Folio's design favours making routing visible in the
scene-graph (every conditional becomes two outgoing edges) over giving
creators full control flow. Complex chains decompose into a series of
small two-target if scenes — verbose to write, cleaner to read in
the node editor.
Notes
The condition expression follows the closed grammar locked in G6.0. Common patterns:
- Stat comparison:
if love >= 5 -> ... - Inventory check:
if inventory.has("key") -> ... - Membership:
if location in ["bedroom", "bathroom"] -> ... - Boolean state:
if eaten-cookies-today -> ... - Combined:
if (love >= 5) and (charisma > 3) -> ...
What the grammar does not allow: function calls, list comprehensions, ternaries, modulo, chained comparisons. If you need one of those, you're probably hiding a subsystem the catalog should have — see Phase 6 § Failure mode #1.
The importer translates Ren'Py if/elif/else chains into a sequence
of two-target ifs. elif is not a Folio construct.
See also
jump— unconditional branchingset— assign the state variablesifreadsscene-flow— full routing vocabulary