27. Pass values, not look-alike text
Many action fields are typed. A checkbox is Boolean. A quantity is numeric. A general Value field can contain JSON. Keep the distinction between a literal value and an expression that fetches another value.
| Entry / expression | Meaning |
|---|---|
| true / false | Boolean on/off values. |
| 7 or 2.5 | Numeric values. |
| "7" or "true" | Text strings, not the number or Boolean. |
| [0, 0, -2] | A three-number array used by vector fields. |
| {"$var":"score"} | Read the game variable score. |
| {"$context":"entityId"} | Read the current call's entityId. |
| {"$this":"id"} | Read the captured caller's ID. |
| {"$param":"points"} | Read a named parameter of a visual function. |
| {"$arg":0} | Read the first positional argument; indexing starts at zero. |
A mapping such as {"$var":"score"} must be a JSON object in an expression/variant field. Pasting its characters into a plain text field may just create literal text. Use the Expression option where the editor supplies one.
The runtime resolves these expressions recursively in action data. A missing variable, parameter or context key can resolve to null. It is better to validate an input near the start of a script than to let a later movement or reward action guess what null should mean.
