Outils pour utilisateurs

Outils du site


en:yaml:timers

Ceci est une ancienne révision du document !


Language / Langue : FR | EN

Timers (YAML)

JDR-Bot provides several timing mechanics.

Visual Pause {{timer:N}}

text: |
  The mechanism starts...
  {{timer:3}}
  The door opens!

Local Timer

A local timer is declared in an event and is cancelled when the player leaves the room.

events:
  - if: ~
    timer: hourglass
    duration: "30"
    to: expired_room
    text: "Timer started: v_hourglass_v seconds left."

Global Timer

global_timers:
  - id: bomb
    duration: 60
    state: OFF

events:
  - if: ~
    do: "timer_global:bomb:ON"

Autonomous global timers can run their own actions when they expire:

global_timers:
  - id: fatal_countdown
    duration: 60
    state: OFF
    text: "Time is up!"
    do:
      - "score.-.20"
    to: defeat_end

tick:

tick: runs every second on local or global timers.

events:
  - if: ~
    timer: tick_demo
    duration: "180"
    to: expired_room
    tick:
      - if: ~
        do: "ticks.+.1"
      - if: "v_ticks_v > 5"
        do: "other_var.+.1"

Stopping a timer

A local timer cancels itself as soon as the player leaves the room: it belongs to that room.

A global timer is stopped with the same switch that starts it:

faire: "timer_global:bombcount:OFF"      # pauses the timer
faire: "timer_global:bombcount:SWITCH"   # toggles its state

OFF keeps the remaining time: a later ON resumes where the timer stopped.

Find us on the Make&Play Discord

en/yaml/timers.1788117789.txt.gz · Dernière modification : de cyrilfiesta