41. Pass a live value with Expression
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.
| Parameter choice | Example |
|---|---|
| Fixed literal | amount = 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.
