Formula parameters
A parameter is a named value supplied when the formula runs, not read from a record. A damage formula might take the target's armour, which only your game knows. Add a parameter and the formula becomes a runtime formula.
Add a parameter
In the Setup panel, choose Add parameter under Parameters. Enter a name and choose a type:
| Type | Holds |
|---|---|
| Number | A decimal number |
| Integer | A whole number |
| Boolean | True or false |
| String | Text |
The type becomes the parameter type in the generated C# method, so choose the one your code will pass.
Use a parameter in the formula by its name with a $ in front, or from the Parameters tab of the block palette.
You can reorder parameters by dragging, and remove one with the X. The order is the order of the arguments in the C# method.
Test with different values
Parameters have no value in the editor, so Test values appears in the side panel. Set a value for each parameter to see the result with different inputs. They are only for testing. Nothing is saved with them.
Changing parameters after release
Once a formula has shipped, your game code calls it by its name and its parameters in order. These edits change that call:
- Adding, removing or renaming a parameter
- Reordering parameters
- Changing a parameter's type
- Renaming the formula
The parameter shows a warning badge such as Renamed or Type changed, and saving shows a Breaking changes banner with a Review changes button. Review them before saving, because your game's code will stop compiling until it's updated.