Outils pour utilisateurs

Outils du site


en:yaml:actions

Ceci est une ancienne révision du document !


Language / Langue : FR | EN

Custom Actions (YAML)

Custom actions add free-form commands. On web/desktop, the player types the verb directly. On Discord, they use the action command.

Declaration

Local actions live in a room's actions: block. Global actions live at root level in global_actions: and are available everywhere.

actions:
  - verb: examine
    target: chest
    if: ~
    text_ok: "An old wooden chest. It looks locked."
    text_ko: "Nothing interesting here."

  - verb: open
    target: chest
    if: "key"
    do:
      - "gold.+.50"
      - object: key
        to: inventory
        remove: true
    text_ok: "You open the chest! +50 gold."
    text_ko: "The chest is locked. You need a key."

target: all

With target: all, any typed target is accepted:

global_actions:
  - verb: go
    target: all
    if: ~
    do: "t_action_cible_ok_t"
    text_ko: "Unknown destination: t_action_cible_t."
Variable Value
t_action_cible_t Raw target typed by the player.
t_action_cible_ok_t Last valid target.

Same Verb and Target

Several actions with the same verb and target are tested in order. The first true condition wins.

actions:
  - verb: combine
    target: herb
    if: "herb t_combination_t.=.nothing"
    do:
      - object: herb
        to: inventory
        remove: true
      - text_var: combination
        value: "herb"
    text_ok: "The herb goes into the still."
    text_ko: "You do not have any herb."

  - verb: combine
    target: all
    if: ~
    text_ok: "t_action_cible_t is not a known ingredient."

Declare combination in text_vars: with the initial value nothing. Local actions are tested before global actions.

Action Alias

actions:
  - verb: inspect
    target: still
    alias: still
    if: ~
    text_ok: "The central still waits for ingredients."

The player can type still instead of inspect still.

Action Button

actions:
  - verb: use
    target: potion
    button: "Use the potion"
    visible-if: "potion"
    disabled-if: "v_hp_v >= v_hpmax_v"
    if: "potion"
    do:
      - object: potion
        to: inventory
        remove: true
      - "hp.+.5"
    text_ok: "You drink the potion. +5 HP!"
    text_ko: "You do not have a potion."

Data, loops and shortcuts (4.17)

do: accepts spaced effects such as health + 10, list operations, conditional groups and loops. See Lists, collections and loops.

Actions, choices and events can have a keyboard, mouse or gamepad shortcut, with or without a button. Interaction conditions and limits still apply.

Object display names

Action targets and t_action_target_t retain the object identifier, even when the player types its display name. Explicit targets keep priority. To change the visible name during play:

do:
  - display_name: workshop_key
    value: identified key

An empty value restores the original identifier. See Objects: display names, renaming and secret scenery for rules and examples.

en/yaml/actions.1792526967.txt.gz · Dernière modification : de cyrilfiesta