Documentation / Advanced reference

Conditional route behavior

Available now

Conditions are declarative and are evaluated again whenever a decision opens.

On this page

Conditions

{ "all": [ … ] }   { "any": [ … ] }   { "not": … }
{ "selected": { "decision": "id", "option": "id" } }
{ "visited": "videoOrEndingId" }
{ "variable": "name", "equals": value }
{ "compare": { "variable": "score", "op": "gte", "value": 3 } }
{ "discovered": "id" }

Effects

{ "set": { "variable": "name", "value": value } }
{ "add": { "variable": "score", "value": -2 } }
{ "discover": "id" }

Evaluation

Conditions are evaluated when a decision opens, after an effect and after a rewind. Choice effects apply in array order before the destination; add accumulates a finite number on a declared numeric variable. Numeric compare uses gt, gte, lt or lte; these and add require story version 1.2.0. Equality still works for boolean, number or string variables.

A Router evaluates its ordered rules on entry, takes the first true rule, then its required fallback if none match. It does not apply choice effects. Try a scored route.

Back to all documentation