Outils pour utilisateurs

Outils du site


en:yaml:variables

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
en:yaml:variables [2026/09/26 03:42] – documentation 4.15 : succès, variables persistantes et exports cyrilfiestaen:yaml:variables [2026/10/20 22:12] (Version actuelle) – Mod?les sur_place, port?e des encadr?s et objets 4.17 cyrilfiesta
Ligne 62: Ligne 62:
 ===== Online _o variables ===== ===== Online _o variables =====
  
-An ''_o'' variable is stored on the server and shared by players loading the same source. It belongs to the scenario URL or path, not to its ''id:''.+For a scenario source authorised by the server, an ''_o'' variable is shared between players. It belongs to the scenario URL or path, not to its ''id:''. Outside these sources, it stays local to the game.
  
 <code yaml> <code yaml>
Ligne 90: Ligne 90:
 ===== Free-form answers ===== ===== Free-form answers =====
  
-Add ''reply: true'' to a variable declared in the room to wait for free-form input:+In a room's ''init:'', ''reply: true'' lets the player enter a value:
  
 <code yaml> <code yaml>
-text_vars: +init: 
-  hero_name:+  - text_var: hero_name
     value: "Adventurer"     value: "Adventurer"
     reply: true     reply: true
Ligne 119: Ligne 119:
 | ''v_timer_name_v'' | Seconds left on the ''timer_name'' timer | | ''v_timer_name_v'' | Seconds left on the ''timer_name'' timer |
  
-These system names stay in French. ''v_turn_v|pad2'' pads a number with zeroes: 7 becomes 07.+The system names above also work in English scenarios. For a declared ''turn'' variable, ''v_turn_v|pad2'' displays 7 as 07.
  
 ===== A common trap ===== ===== A common trap =====
Ligne 131: Ligne 131:
     text: "New record: v_score_v"     text: "New record: v_score_v"
 </code> </code>
 +
 +===== Paths and spaced effects (4.17) =====
 +
 +[[en:yaml:listes-boucles|Lists and collections]] add paths such as ''hero.health'', ''bag[0]'' or ''party[v_position_v].health''. The markers remain ''v_..._v'' and ''t_..._t''.
 +
 +In ''do:'', ''health + 10'' is equivalent to ''health.+.10''. Operators: ''<nowiki>= + - * / // ** %%</nowiki>'' and random ''%''. ''/'' rounds ties to even, ''//'' truncates towards zero and ''<nowiki>%%</nowiki>'' is modulo. Division by zero is an error.
 +
 +<code yaml>
 +do:
 +  - hero.health + 10
 +  - score + %1:6
 +  - score + %2:70,5:30
 +</code>
 +
 +The last example draws 2 with weight 70 or 5 with weight 30. ''result'' holds the drawn number before the operator is applied. Older forms remain accepted.
 +
 +''init:'' also accepts ''var: hero.health'' or ''text_var: hero.name'', with ''modifiable: true'' or ''reply: true''. These input paths must cross collections only and target an existing simple property; list indices are excluded.
 +
 +===== Describing structured data =====
 +
 +Lists, collections, properties and elements can have descriptions separate from their values, in ''data_info:'' (French: ''infos_donnees:''). ''examine hero.health'' shows the value and its description. Roots can also be bound to tags to reset their whole contents. See [[en:yaml:listes-boucles|Structured data descriptions and tags]].
 +
 +In the editor, online variables remain grouped with numbers or text according to their type. Declare an ''_o'' number in ''vars'' and an ''_o'' text variable in ''text_vars''. Historical ''vars_online'' declarations remain readable on import.
  
en/yaml/variables.1790386958.txt.gz · Dernière modification : de cyrilfiesta