Outils pour utilisateurs

Outils du site


en:yaml:modeles

Language / Langue : FR | EN

Models (YAML)

Models are reusable groups of rooms. They are useful for fights, repeated mini-games, puzzles or reusable systems.

Declare a Model

models:
  - name: simple_fight
    variables:
      enemy_hp: enemy_hp
    exits:
      victory: victory
      defeat: defeat
    rooms:
      - id: attack
        text: "You attack!"
        events:
          - if: "v_enemy_hp_v <= 0"
            to: victory
          - if: ~
            do: "enemy_hp.-.3"
            to: enemy_turn

      - id: enemy_turn
        text: "The enemy retaliates."
        events:
          - if: "v_hp_v <= 0"
            to: defeat
          - if: ~
            to: attack

Instantiate a Model

- id: goblin_fight
  text: "A goblin appears!"
  models:
    - name: simple_fight
      variables:
        enemy_hp: goblin_hp
      exits:
        victory: after_fight
        defeat: game_over

Internal rooms are automatically prefixed to avoid ID collisions. end_model is the reserved keyword used to return to the calling room flow.

en/yaml/modeles.txt · Dernière modification : de cyrilfiesta