**Language / Langue :** [[fr:yaml:choix|FR]] | **EN** ====== Choices and Buttons (YAML) ====== Choices define the exits available from a room — navigation, access conditions and buttons shown to the player. ===== Minimal syntax ===== The simplest form: a destination, nothing else. choices: - to: forest - to: village 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. choices: - button: "âŦ†ī¸ Go north" to: forest - button: "🏠 Back to village" to: village ===== Typed command ===== ''command:'' defines a keyword the player can type (in addition to the button). choices: - command: north button: "âŦ†ī¸ Go north" to: forest 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. rooms: - id: laboratory button: "âš—ī¸ Laboratory" text: "..." - id: corridor choices: - to: laboratory # displays "âš—ī¸ Laboratory" without repeating it here ===== to: previous ===== ''to: previous'' returns to the room the player came from. choices: - command: back button: "â†Šī¸ Back" to: previous ===== Access condition (if:) ===== ''if:'' blocks access if the condition is not met. The player receives ''text_ko:'' as feedback. choices: - command: enter button: "đŸšĒ Enter" to: secret_room if: "key" text_ko: "The door is locked." text_ok: "You enter the secret room." * ''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) ===== choices: - command: expert button: "🏆 Expert mode" to: expert_room visible-if: "v_score_v > 50" # button hidden if score <= 50 - command: move button: "💀 Move on" to: next_room disabled-if: "v_hp_v <= 0" # button visible but inactive if HP = 0 * ''visible-if:'' — the button disappears if the condition is false * ''disabled-if:'' — the button stays visible but cannot be clicked ===== Click effect (effect:) ===== ''effect:'' runs an action **before** moving to the destination. choices: - command: buy button: "đŸĒ™ Buy (-10 gold)" to: shop if: "v_gold_v >= 10" effect: "gold.-.10" ===== Clear HUD on click ===== choices: - command: back button: "â†Šī¸ Back" to: home clear-hud: - all **Join us on [[https://discord.gg/Z63DtVV|Discord Make&Play]]**