Set Variable sets the value of a variable to a number. It can also evaluate a mathematical expression and set the value of the variable to the result. See Math Functions for a guide to writing math expressions.

Target variable

The variable to set.

Expression

The value to set the variable to. This field may contain a mathematical formula rather than just a number. Math Functions documents the syntax and supported math functions for expressions.

Pro Tip

While using math expressions to set variables is optional, it is an incredibly powerful aspect of Story Machine. You can use Set Variable and math formulas to animate objects, implement physics, or control complex UI elements. For example, if you created a variable called “Position Y” and set an object’s Y position to this variable, you could make that object animate up and down with the following expression: sin(time) * 100.