User Tools

Site Tools


4rpl:commands:define

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:define [2021/01/13 22:29] virgilw4rpl:commands:define [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~NOTOC~~ + <=[[4rpl:start| Index]] 
-<=[[4rpl:start| Index]]+ 
 +====== Input Variables ====== 
 + 
 +===== Syntax =====
  
-=== Syntax === 
 $VAR:VAL $VAR:VAL
  
-=== Description === +===== Description =====
-Defines an input variable named VAR with a default value of VAL. Input variables are created at script start and assigned either the default value, or a value specified in the editor. Input variables must start with a $ sign. +
  
-=== Examples === +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. 
-<code 4rpl>$amt:+ 
 +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 ===== 
 + 
 +<code 4rpl> 
 +# input vars go at the top of a script, before the actual code 
 +$amt:
 $text:"abc" $text:"abc"
 $e:2.71828 $e:2.71828
- 
  
 SetCreeper(10 10 <-amt)  SetCreeper(10 10 <-amt) 
 </code> </code>
 +
 +~~NOTOC~~
 +
4rpl/commands/define.1610576946.txt.gz · Last modified: 2025/02/14 14:56 (external edit)