Outils pour utilisateurs

Outils du site


en:txt:actions

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:txt:actions [2026/05/03 18:48] – Harmonize FR/EN language switch cyrilfiestaen:txt:actions [2026/08/31 20:45] (Version actuelle) – Wiki : fins de pages homogènes, liens Discord retirés cyrilfiesta
Ligne 1: Ligne 1:
 **Language / Langue :** [[fr:txt:actions|FR]] | **EN** **Language / Langue :** [[fr:txt:actions|FR]] | **EN**
  
-====== TXT — Custom Actions ======+====== Custom actions (.txt format) ======
  
-Legacy custom actions are supported, but YAML ''actions:'' is clearer:+Custom actions add freely named commands to your scenario. The player then types ''actionname target''.
  
-<code yaml> +===== Declaration ===== 
-actions: + 
-  - verbinspect +An action goes either in the exit list of a room (**local** action) or after the last ''*****'' (**global** action)
-    target: chest + 
-    if: ~ +<code> 
-    text_ok"An old chest."+action:target|condition(s)|effect|OK text|KO text
 </code> </code>
 +
 +  * ''action'' - the command verb (for example ''open'', ''combine'', ''inspect'')
 +  * ''target'' - the specific target (''door'', ''chest'') or ''all'' to accept anything
 +  * ''condition'' - required objects or variables (or ''null'')
 +  * ''effect'' - variable change, object added, using the same syntax as a 997 event
 +  * ''OK text'' / ''KO text'' - messages shown when the condition is met or not
 +
 +The player then types ''open door'', ''combine herb'', and so on.
 +
 +===== The all target =====
 +
 +With ''all'', the command accepts any target. The variable ''action_cible'' holds what the player typed, and ''action_cible_ok'' holds the **last valid target**. These names stay in French: they are reserved variables of the engine.
 +
 +<code>
 +inspect:all|null|null|You look closely at «action_cible».|Nothing of interest here.
 +</code>
 +
 +===== Priority and multiple conditions =====
 +
 +  * The same ''action:target'' can be declared several times with different conditions. The first one whose conditions are met is executed.
 +  * **Local** actions are tested before **global** ones.
 +  * If no condition is met, the KO text of the last line is shown.
 +
 +===== Full example =====
 +
 +<code>
 +open:chest|key|null|You open the chest with the key!|You need a key.
 +open:chest|null|null|The chest is locked.|null
 +break:all|null|null|You strike «action_cible» with all your strength!|null
 +</code>
 +
en/txt/actions.1777826883.txt.gz · Dernière modification : de cyrilfiesta