Outils pour utilisateurs

Outils du site


en:yaml:alias

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
en:yaml:alias [2026/05/03 18:47] – Harmonize FR/EN language switch cyrilfiestaen:yaml:alias [2026/05/03 23:59] (Version actuelle) – mise a jour wiki cyrilfiesta
Ligne 1: Ligne 1:
 **Language / Langue :** [[fr:yaml:alias|FR]] | **EN** **Language / Langue :** [[fr:yaml:alias|FR]] | **EN**
  
-====== Aliases, Commands and Buttons (YAML) ======+====== Aliases and Commands (YAML) ======
  
-Modern YAML does not use a ''reaction:'' field next to choices or actions. Visible buttons are declared with ''button:''and typed commands with ''command:'' or ''alias:''.+Aliases let the player navigate or interact by typing a short keywordwithout knowing the exact room id or action name.
  
-===== Choices =====+===== Command in a choice ===== 
 + 
 +''command:'' in a choice defines the keyword the player can type to take that exit.
  
 <code yaml> <code yaml>
 choices: choices:
   - command: north   - command: north
-    button: "Go north" +    button: "⬆️ Go north" 
-    to: north_room+    to: north_forest 
 + 
 +  - command: back 
 +    to: home
 </code> </code>
  
-===== Global Aliases =====+Without ''command:'', the room is still reachable via its id (''go north_forest''), but not via a custom shortcut. 
 + 
 +===== Global aliases ===== 
 + 
 +''global_aliases:'' maps a command to a reusable button label available in every room. Useful for recurring buttons (back, inventory, help…).
  
 <code yaml> <code yaml>
 global_aliases: global_aliases:
-  back: "Home" +  back: "🏠 Home" 
-  help: "Help"+  help: "❓ Help" 
 +</code>
  
-rooms: +In any room, a choice with ''commandback'' automatically inherits the label ''🏠 Home'' without repeating ''button:'' everywhere
-  - idcorridor + 
-    choices: +<code yaml> 
-      - command: back +choices: 
-        to: home+  - command: back 
 +    to: home      # displays "🏠 Home" from global_aliases
 </code> </code>
  
-===== Action Alias =====+===== Action alias ===== 
 + 
 +In ''actions:'', ''alias:'' creates a shortcut: the player can type the word alone instead of the full ''verb target'' pair.
  
 <code yaml> <code yaml>
Ligne 36: Ligne 49:
     alias: still     alias: still
     if: ~     if: ~
-    text_ok: "The still waits for your ingredients."+    text_ok: "The still awaits your ingredients."
 </code> </code>
  
 The player can type ''still'' instead of ''inspect still''. The player can type ''still'' instead of ''inspect still''.
  
-===== Action and Event Buttons =====+===== Global navigation aliases ===== 
 + 
 +''global_aliases:'' can also point to a room to make it accessible from everywhere:
  
 <code yaml> <code yaml>
-actions+global_aliases
-  - verb: use +  map: "🗺️ View map"
-    target: potion +
-    button: "Drink potion" +
-    if: "potion" +
-    do: "hp.+.10" +
-    text_ok: "+10 HP!"+
  
-events+rooms
-  - if~ +  - idworld_map 
-    button"Meditate" +    ... 
-    do"mana.+.5" +  - idcorridor 
-    text: "+5 mana."+    choices
 +      - commandmap 
 +        to: world_map    # "mapavailable from every room
 </code> </code>
 +
 +===== See also =====
 +
 +  * [[en:yaml:choix|Choices and buttons]]
 +  * [[en:yaml:actions|Custom actions]]
 +  * [[en:yaml:evenements-globaux|Global events]]
 +
 +**Join us on [[https://discord.gg/Z63DtVV|Discord Make&Play]]**
 +
en/yaml/alias.1777826872.txt.gz · Dernière modification : de cyrilfiesta