**Language / Langue :** [[fr:yaml:evenements|FR]] | **EN** ====== Events (YAML) ====== Events are action blocks triggered automatically when entering a room, or manually through buttons. ===== Base Syntax ===== events: - if: "condition" do: "action" text: "Displayed message" * ''if:'' — trigger condition. ''~'' or missing means always true. * ''do:'' — action or list of actions. * ''text:'' — optional displayed text. ===== Actions Available in do: ===== ^ Syntax ^ Effect ^ | ''score.+.10'' | Add 10 to ''score''. | | ''hp.-.3'' | Subtract 3 from ''hp''. | | ''score.=.0'' | Set ''score'' to 0. | | ''score.=.v_other_v'' | Copy another variable. | | ''score.=.%1:6'' | Random value from 1 to 6. | | ''object&&inventory&&Description'' | Add an object. | | ''-object&&inventory&&null'' | Remove an object. | | ''event_global:id:ON'' | Enable a global event. | | ''event_global:id:OFF'' | Disable a global event. | | ''event_global:id:SWITCH'' | Toggle a global event. | | ''timer_global:id:ON'' | Start a global timer. | | ''timer_global:id:OFF'' | Stop a global timer. | | ''trigger_event:id'' | Trigger a global event directly. | ===== Endings ===== events: - if: "v_hp_v <= 0" end: defeat text: "You died." - if: "v_score_v >= 100" end: victory text: "Congratulations!" ===== Redirection ===== events: - if: "v_hp_v <= 0" to: death_room text: "You pass out..." An event with ''to:'' stops following events. ===== Event Button ===== events: - if: ~ button: "Eat an apple (+3 HP)" do: "hp.+.3" text: "You eat the apple. HP: v_hp_v" ===== Limit Uses ===== events: - if: ~ button: "Pick up a coin" do: "score.+.10" max: 3 text: - if: "_max_atteint_" text: "No coins remain." - text: "+10 score."