Skip to reading
Visual Scripting in Depth

19. Read values with expressions

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

Expressions are small JSON dictionaries with one special key. The runner resolves them when it reaches the node, so a later node sees values changed by an earlier one.

Source table from 19. Read values with expressions, page 23
ExpressionReads
{"$var":"score"}The live project/runtime variable score.
{"$context":"entityId"}entityId supplied by the event or caller.
{"$this":"id"}The captured caller’s ID.
{"$this":"name"}The captured caller’s name property.
{"$param":"amount"}The named parameter of the current exposed visual function.
{"$arg":0}The first positional call argument; 1 means the second.

Use these in fields labeled as JSON values, such as If Compare Left/Right, Return Value, Call Script Arguments, Change Variable Value and Emit Event context. Call Script Function supplies its own Expression checkbox for each named parameter.

Code example
{
  "owner": {"$this":"id"},
  "amount": {"$param":"amount"},
  "items": ["brass_key_item", {"$var":"score"}]
}

Values are resolved recursively inside arrays and dictionaries. A dictionary used as a special expression must contain just that special key. The dictionary above is an ordinary result object whose individual values contain expressions.

These are lookups, not arbitrary formula strings. {"$var":"score + 1"} looks for a variable literally named score + 1. Use Change Variable → add for the arithmetic.

Page 23 of 93Permalink
Go to page