**Language / Langue :** [[fr:txt:variables|FR]] | **EN**
====== Variables (.txt format) ======
===== Numeric variables =====
Numeric variables are declared on **line 3** of a room. Format:
variable_name|variable|initial_value|displayed_text|description
* ''variable'' - required keyword
* ''initial_value'' - a fixed number (''=5''), a random one (''%=1:6''), or a change (''+5'', ''-3'')
* ''displayed_text'' - shown when the variable changes (or ''null'')
* ''description'' - shown when the player types ''inspect variable_name''
^ Syntax ^ Effect ^
| ''=X'' | Sets the value to X |
| ''%=X:Y'' | Random value between X and Y |
| ''+X'' | Adds X to the current value |
| ''-X'' | Subtracts X |
| ''%+X:Y'' | Adds a random amount between X and Y |
| ''%-X:Y'' | Subtracts a random amount between X and Y |
To display the value inside a text: ''v_variable_name_v''
===== Text variables =====
Text variables hold a word or a sentence. Keyword: ''variable_t'':
variable_name|variable_t|initial_value|change_text|description
To display it inside a text: ''t_variable_name_t''
The player can change the value with the ''reply value'' command, provided the variable is declared in the current room.
===== Online variables =====
Online variables are **kept between games and between servers**. They are declared **after the last room** (after the final ''*****''):
variable_name_o|default_value|description
The name **must end with ''_o''**. Usage is the same as for regular variables: ''v_variable_name_o_v''.
Predefined variable: ''v_nb_parties_o_v'' - automatically increased each time the scenario starts.
===== System variables =====
^ Variable ^ Value ^
| ''v_resultat_v'' | Result of the last ''%=X:Y'' random draw |
| ''v_valeur_v'' | Last code entered through ''go room code'' |
| ''v_reponse_v'' | Value entered with ''reply'' |