Outils pour utilisateurs

Outils du site


en:yaml:choix

Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
en:yaml:choix [2026/05/03 18:29] – Add English wiki page using real engine keys cyrilfiestaen:yaml:choix [2026/05/03 23:59] (Version actuelle) – mise a jour wiki cyrilfiesta
Ligne 1: Ligne 1:
-**Language:** [[fr:yaml:choix|Français]] | **English**+**Language / Langue :** [[fr:yaml:choix|FR]] | **EN**
  
 ====== Choices and Buttons (YAML) ====== ====== Choices and Buttons (YAML) ======
  
-Choices define navigation commands and buttons shown to the player.+Choices define the exits available from a room — navigation, access conditions and buttons shown to the player.
  
-===== Base Syntax =====+===== Minimal syntax ===== 
 + 
 +The simplest form: a destination, nothing else.
  
 <code yaml> <code yaml>
 choices: choices:
-  - commandnorth +  - toforest 
-    button: "Go north"+  - to: village 
 +</code> 
 + 
 +The room ''forest'' is reachable by typing ''go forest''. No button is displayed. 
 + 
 +===== Adding a button ===== 
 + 
 +''button:'' displays a clickable button below the room text. 
 + 
 +<code yaml> 
 +choices: 
 +  - button: "⬆️ Go north"
     to: forest     to: forest
  
-  - commandback +  - button"🏠 Back to village" 
-    to: home+    to: village
 </code> </code>
  
-  * ''command:'' — keyword the player can type. +===== Typed command =====
-  * ''button:'' — visible button label. If absent, no local button is shown unless a global alias provides one. +
-  * ''to:'' — destination room.+
  
-===== Button Defined on the Room =====+''command:'' defines a keyword the player can type (in addition to the button).
  
 <code yaml> <code yaml>
-idtimers_demo +choices: 
-  button: "Timers+  commandnorth 
-  text"..."+    button: "⬆️ Go north
 +    toforest
 </code> </code>
  
-A choice pointing to this room without its own ''button:'' can inherit the room button.+The player can click the button **or** type ''go north''
 +Without ''command:'', only ''go forest'' (the room id) works. 
 + 
 +See [[en:yaml:alias|Aliases and commands]] for global shortcuts and action aliases. 
 + 
 +===== Button inherited from the room ===== 
 + 
 +If the destination room has a ''button:'', choices pointing to it without their own ''button:'' inherit that label automatically. 
 + 
 +<code yaml> 
 +rooms: 
 +  - id: laboratory 
 +    button: "⚗️ Laboratory" 
 +    text: "..." 
 + 
 +  - id: corridor 
 +    choices: 
 +      - to: laboratory    # displays "⚗️ Laboratory" without repeating it here 
 +</code>
  
 ===== to: previous ===== ===== to: previous =====
 +
 +''to: previous'' returns to the room the player came from.
  
 <code yaml> <code yaml>
 choices: choices:
   - command: back   - command: back
-    button: "Back"+    button: "↩️ Back"
     to: previous     to: previous
 </code> </code>
  
-===== Access Conditions =====+===== Access condition (if:) ===== 
 + 
 +''if:'' blocks access if the condition is not met. The player receives ''text_ko:'' as feedback.
  
 <code yaml> <code yaml>
 choices: choices:
   - command: enter   - command: enter
-    button: "Enter the secret room"+    button: "🚪 Enter"
     to: secret_room     to: secret_room
-    if: "key v_score_v > 10+    if: "key" 
-    text_ko: "The door remains closed."+    text_ko: "The door is locked." 
 +    text_ok: "You enter the secret room."
 </code> </code>
  
-===== Conditional Buttons =====+  * ''text_ko:'' — shown if the condition fails (access denied) 
 +  * ''text_ok:'' — shown if the condition succeeds, before moving 
 + 
 +Without a condition, ''text_ok:'' and ''text_ko:'' are not used. 
 + 
 +===== Conditional button (visible-if / disabled-if) =====
  
 <code yaml> <code yaml>
 choices: choices:
   - command: expert   - command: expert
-    button: "Expert mode"+    button: "🏆 Expert mode"
     to: expert_room     to: expert_room
-    visible-if: "v_score_v > 50"+    visible-if: "v_score_v > 50"    # button hidden if score <= 50
  
-  - command: weakened +  - command: move 
-    button: "Move on"+    button: "💀 Move on"
     to: next_room     to: next_room
-    disabled-if: "v_hp_v <= 0"+    disabled-if: "v_hp_v <= 0"      # button visible but inactive if HP = 0
 </code> </code>
  
-===== Click Effect =====+  * ''visible-if:'' — the button disappears if the condition is false 
 +  * ''disabled-if:'' — the button stays visible but cannot be clicked
  
-''effect:'' runs before moving to the destination.+===== Click effect (effect:) ===== 
 + 
 +''effect:'' runs an action **before** moving to the destination.
  
 <code yaml> <code yaml>
 choices: choices:
   - command: buy   - command: buy
-    button: "Buy (-10 gold)"+    button: "🪙 Buy (-10 gold)"
     to: shop     to: shop
-    effect: "gold.-.10" 
     if: "v_gold_v >= 10"     if: "v_gold_v >= 10"
 +    effect: "gold.-.10"
 </code> </code>
  
-===== Clear HUD on Click =====+===== Clear HUD on click =====
  
 <code yaml> <code yaml>
 choices: choices:
   - command: back   - command: back
-    button: "Back"+    button: "↩️ Back"
     to: home     to: home
     clear-hud:     clear-hud:
       - all       - all
 </code> </code>
 +
 +**Join us on [[https://discord.gg/Z63DtVV|Discord Make&Play]]**
  
en/yaml/choix.1777825786.txt.gz · Dernière modification : de cyrilfiesta