Skip to reading
Action Lists & Events

Advanced: a nested conditional in raw data

Edition 0.86.4.3

0.86.4.3 edition with revised lessons, updated cross-references and new cinematic/camera-safety supplements. Earlier examples, screenshots and registry figures retain their stated edition context.

Download PDFView PDF page

The runtime supports an IfVariable action with nested then and else arrays. Existing project data can contain this form. It is not a condition row offered by the normal shared sequence picker. A visual graph is easier to edit and inspect for most authors.

Code example
{
  "type":"IfVariable",
  "name":"key_taken",
  "equals":true,
  "then":[
    {"type":"ShowMessage", "text":"I have the key.",
     "duration":2.2}
  ],
  "else":[
    {"type":"ShowMessage", "text":"I need the key.",
     "duration":2.2}
  ]
}

Only the selected nested branch runs. After it finishes, the outer list continues with its next action. Do not confuse that branch selection with a returned false value from some other action; the ordinary list runner does not interpret every result as a condition.

The example was checked in the runtime. For a new authoring workflow, use If Variable, Has Inventory or If Compare in a graph, then call the graph from the inspector.

A story flag such as key_taken answers whether the pickup happened. Has Inventory answers whether the character currently carries the item. Choose the condition that matches the rule; those can differ after an item is consumed or transferred.

Page 177 of 189Permalink
Go to page