Calculate Variable
The Calculate Variable block allows you to create a variable and perform calculations on it. It is the only block that can be used to perform calculations in an automation. You cannot directly calculate in any other value fields.
Calculations can be single-line, such as adding two numbers, or they can be multiline. Multiline calculations must have a yield statement that returns the final output of the calculation.
Automation calculations use a custom DSL similar to PHP with some JavaScript niceties. We call it LobbyScript. Most PHP functions are supported.
The editor has built-in code completion for all functions that you can use. Start typing a function name, and all functions starting with those letters will be available to pick from. The editor will also show help for any function when your cursor is on the function name.
When you press the "@" symbol, a list of all the available variables is presented from which you can choose any variable.
Help documentation for calculate variable is available by clicking the help link under the formula field.
Here are some resources you can refer to when creating formulas.
Need some help to create calculations?
Use the AI bot, tell it what you need to calculate and click OK.
Please note that the bots don't always get it right and you should always double-check the work.