en:yaml:modeles
Ceci est une ancienne révision du document !
Table des matières
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.
See also
Bound lists and collections (4.17)
A model can declare generic lists and collections. Its instance binds them to scenario data without copying:
lists: products: world.shop.bag collections: hero: world.state
These fields belong in the model instance. Paths cross collections only, with no retained list index. Required properties are checked when a parent is replaced or a saved game is resumed. See Lists and collections.
en/yaml/modeles.1792356507.txt.gz · Dernière modification : de cyrilfiesta
