Outils pour utilisateurs

Outils du site


en:yaml:evenements

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:evenements [2026/05/07 03:31] – Correction rendu syntaxe JDR-Bot dans DokuWiki cyrilfiestaen:yaml:evenements [2026/08/31 20:52] (Version actuelle) – Wiki : fins de pages homogènes, liens Discord retirés cyrilfiesta
Ligne 14: Ligne 14:
 </code> </code>
  
-  * ''if:'' — trigger condition. ''~'' or missing means always true. +  * ''if:'' trigger condition. ''~'' or missing means always true. 
-  * ''do:'' — action or list of actions. +  * ''do:'' action or list of actions. 
-  * ''text:'' — optional displayed text.+  * ''text:'' optional displayed text.
  
 ===== Actions Available in do: ===== ===== Actions Available in do: =====
Ligne 81: Ligne 81:
       - text: "+10 score."       - text: "+10 score."
 </code> </code>
 +
 +
 +===== Conditional buttons (visible-si / grise-si) =====
 +
 +<code yaml>
 +events:
 +  - if: ~
 +    button: "⚔️ Attack"
 +    visible-if: "v_hp_v > 0"   # hidden when HP reach 0
 +    do: "score.+.5"
 +    text: "You attack!"
 +
 +  - if: ~
 +    button: "🏃 Flee"
 +    disabled-if: "v_hp_v <= 0" # visible but inactive when HP reach 0
 +    to: accueil
 +</code>
 +
 +''visible-if:'' hides the button when the condition is false. ''disabled-if:'' keeps the button visible but inactive when the condition is true.
 +
 +⚠ On Discord, buttons are frozen inside the message that was sent. Clicking 🔄 (refresh) forces a redisplay with up to date buttons.
 +
 +===== Conditional text on an event =====
 +
 +The ''text:'' field accepts a list of conditional blocks:
 +
 +<code yaml>
 +text:
 +  - if: "_max_atteint_"
 +    text: "No charge left!"
 +  - if: "v_score_v > 50"
 +    text: "🏆 Wealthy adventurer: score v_score_v!"
 +  - text: "Action done."   # fallback, always shown
 +</code>
 +
 +===== Sequential behaviour =====
 +
 +⚠ Important: events run in order. Each one sees the values **already changed** by the previous ones. An event carrying ''to:'' or ''end:'' **stops** the ones after it.
 +
 +===== Timer started by an event =====
 +
 +<code yaml>
 +events:
 +  - if: ~
 +    timer: hourglass
 +    duration: "30"
 +    to: expiration_room
 +    text: "The hourglass is running!"
 +</code>
 +
 +''v_hourglass_v'' holds the remaining seconds. A local timer is cancelled when the player leaves the room.
 +
 +===== Manual command inside do: (v4.9) =====
 +
 +The ''command:'' action inside ''do:'' runs a text command of the bot, from an event, a choice or an action:
 +
 +<code yaml>
 +do:
 +  - command: "take key"
 +  - command: "inspect chest"
 +  - command: "go laboratory"
 +</code>
 +
 +It works with the standard commands: ''go'', ''back'', ''take'', ''throw'', ''inspect'', ''inventory'', ''refresh'', ''reply'', ''edit'', ''vars''. Their French names are accepted too (''avancer'', ''reculer'', ''prendre'', ''jeter'', ''examiner'', ''inventaire'', ''rafraichir'', ''repondre'', ''modifier'', ''variables'').
 +
 +Useful to chain a series of actions automatically, or to simulate an interaction from an event.
  
  
Ligne 87: Ligne 153:
 A local event can be triggered by a tooltip or clickable element, and a ''source:'' + ''target:'' pair defines a drag&drop event. A local event can be triggered by a tooltip or clickable element, and a ''source:'' + ''target:'' pair defines a drag&drop event.
  
-  * [[en:yaml:tooltips|Interactive tooltips]]: ''%%{{label:?text:!id}}%%'' or ''{{label:!id}}''.+  * [[en:yaml:tooltips|Interactive tooltips]]: ''%%{{label:?text:!id}}%%'' or ''%%{{label:!id}}%%''.
   * [[en:yaml:clickable-elements|Clickable elements]]: ''%%{{label:@id}}%%''.   * [[en:yaml:clickable-elements|Clickable elements]]: ''%%{{label:@id}}%%''.
   * [[en:yaml:drag-drop|Drag & drop]]: ''source:'' + ''target:'' on the event.   * [[en:yaml:drag-drop|Drag & drop]]: ''source:'' + ''target:'' on the event.
  
 Local events can be controlled with ''event:id:ON'', ''event:id:OFF'' and ''event:id:SWITCH''. Local events can be controlled with ''event:id:ON'', ''event:id:OFF'' and ''event:id:SWITCH''.
- 
  
en/yaml/evenements.1778117473.txt.gz · Dernière modification : de cyrilfiesta