This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| crpl:docs:define [2013/01/14 16:03] – virgilw | crpl:docs:define [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | abc | + | <- [[crpl: |
| - | 123 | + | |
| - | asd | + | |
| + | ===== $VARNAME: | ||
| + | |||
| + | ===== Syntax ===== | ||
| + | |||
| + | $VAR:VAL | ||
| + | |||
| + | ===== Description ===== | ||
| + | |||
| + | Input variables must start with a $ sign and be placed before any of the actual code in a script. They define a variable named **VAR **with a default value of **VAL** which may be of type int, float or string. | ||
| + | |||
| + | Input variables will show up in a unit's Script Settings when selected in the editor, this allows the editor to place the unit with a different value than the default specified in the script itself, but also allows the the value to be changed at any moment in time. | ||
| + | |||
| + | Input variables are created at the same time as the unit itself (even if the game is paused and the script hasn't executed once) and assigned either the default value **VAL** (which may be overwritten if the initParams of a CreateUnit call specify it), or a value specified in the editor through the Script Settings. | ||
| + | |||
| + | === Examples === | ||
| + | |||
| + | Commands used in example: | ||
| + | * [[crpl: | ||
| + | * [[crpl: | ||
| + | * [[crpl: | ||
| + | <code 4rpl> | ||
| + | $amtToEmit: | ||
| + | $interval: | ||
| + | CurrentCoords < | ||
| + | < | ||
| + | </ | ||