Skip to reading
Visual Scripting in Depth

41. Pass a live value with Expression

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 illustrations

Figure 29. Expression lets a function parameter read a runtime value instead of keeping a fixed literal.

1. Select the Call Script Function node.

2. For amount, turn on Expression.

3. Replace the initial expression with {"$var":"pulse_count"}.

4. Commit the field and save.

5. Set pulse_count to 3 through the loop example, then call the function.

6. The call should add three points and return 3.

The expression must resolve to a value accepted by the declared parameter type. An int parameter needs an integer-valued number. Text containing "three" is not a valid substitute.

Source table from 41. Pass a live value with Expression, page 45
Parameter choiceExample
Fixed literalamount = 7 with Expression off.
Project/runtime variable{"$var":"pulse_count"}
Caller name for a string parameter{"$this":"name"}
Outer function argument{"$param":"amount"}
Event field{"$context":"entityId"}
Positional argument{"$arg":0}

Turning Expression on initially creates a caller-ID expression. Replace it with the expression your parameter actually needs. Turning it off restores the parameter’s default rather than preserving the expression as a literal.

Page 45 of 93Permalink
Go to page