Skip to content
FREN

Write a formula

The Expression node replaces a small chain of nodes with one line of maths.

  • 6 min
  • follows lesson 4
  • at the end: one line instead of the Remap

The Remap from lesson 3 does simple maths that one line says just as well. And the same line can clamp it, which the Remap doesn’t. The Expression node grows its dots from what you write in it.

Step 1 / 3

Drop an Expression

Tab, Expression. The node starts with $out = value: one input value, one output out.

Step 2 / 3

Write the formula

Click the code and replace it with $t = clamp((@rpm - 5000) / 3000, 0, 1). The node loses its input and gets a t output: @rpm reads the revs without a wire, $t declares the output.

Step 3 / 3

Replace the Remap

Wire t to the bar’s value and to the Ramp’s t, then select the Remap and Del. Same bar, same colour, and the value no longer drops below 0: clamp keeps it between 0 and 1.

The program runs here on the app’s expression engine. Its second line, $shift = @rpm > 7800, adds an output that turns to 1 near the limiter. Edit it: the page rereads it on every keystroke.

Three signs make the dots. @channel reads a game channel directly, with no wire. $name = … declares an output, and it’s the only way to make one. A bare name that’s never assigned becomes an input, a dot to wire: write rpm without @, and the node asks for one. A name assigned without $, like ratio = @rpm / 8000;, stays a variable of the calculation. Statements are separated by ;.

Every function is in the Expressions reference.

The node has no output. The $ is missing: t = … is a variable, not an output.

An rpm dot shows up on the left. The @ is missing: without it, rpm is an input to wire, not the channel.