en:yaml:modeles
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| en:yaml:modeles [2026/08/30 21:21] – maj 4.14 : dialogues, videos hebergees, mise en page, doc EN completee cyrilfiesta | en:yaml:modeles [2026/10/20 22:23] (Version actuelle) – Modèles sur_place, portée des encadrés et objets 4.17 cyrilfiesta | ||
|---|---|---|---|
| Ligne 3: | Ligne 3: | ||
| ====== Models (YAML) ====== | ====== Models (YAML) ====== | ||
| - | Models are reusable | + | A model contains |
| - | ===== Declare | + | ===== Example: |
| + | |||
| + | This scenario opens the model, lets the player heal, then returns to the calling room's choices. | ||
| <code yaml> | <code yaml> | ||
| + | title: Infirmary | ||
| + | vars: | ||
| + | hp: 10 | ||
| models: | models: | ||
| - | | + | |
| variables: | variables: | ||
| - | | + | |
| - | exits: | + | |
| - | victory: victory | + | |
| - | defeat: defeat | + | |
| rooms: | rooms: | ||
| - | - id: attack | + | - id: sheet |
| - | text: "You attack!" | + | text: ' |
| - | | + | |
| - | - if: " | + | actions: |
| - | | + | - verb: heal |
| - | - if: ~ | + | |
| - | | + | button: Heal |
| - | to: enemy_turn | + | do: health + 5 |
| + | choices: | ||
| + | - button: Leave | ||
| + | | ||
| + | rooms: | ||
| + | | ||
| + | text: You enter the infirmary. | ||
| + | | ||
| + | - model: healing | ||
| + | variables: | ||
| + | health: hp | ||
| + | choices: | ||
| + | - button: Finish | ||
| + | | ||
| + | - id: conclusion | ||
| + | events: | ||
| + | - end: victory | ||
| + | </ | ||
| - | - id: enemy_turn | + | The '' |
| - | text: "The enemy retaliates." | + | |
| - | | + | Internal rooms receive a prefix to avoid ID collisions. '' |
| - | - if: " | + | |
| - | to: defeat | + | ===== Bound lists and collections (4.17) ===== |
| - | - if: ~ | + | |
| - | to: attack | + | A model can declare generic lists and collections. Bind them to scenario data in the instance, without copying: |
| + | |||
| + | <code yaml> | ||
| + | lists: | ||
| + | | ||
| + | collections: | ||
| + | hero: world.state | ||
| </ | </ | ||
| - | ===== Instantiate | + | Targets must exist. Paths cross collections only, without list indices. Required properties are checked when a parent is replaced or a saved game is resumed. |
| + | |||
| + | See [[en: | ||
| + | |||
| + | ===== Adding | ||
| + | |||
| + | Set '' | ||
| <code yaml> | <code yaml> | ||
| - | - id: goblin_fight | + | title: A model in the workshop |
| - | text: "A goblin appears!" | + | collections: |
| - | | + | player: {} |
| - | | + | models: |
| - | | + | inline_healing: |
| - | | + | inline: true |
| - | | + | collections: |
| - | | + | hero: {health: 0} |
| - | | + | defaults: |
| + | hero: {health: 100} | ||
| + | rooms: | ||
| + | | ||
| + | | ||
| + | position: top-right | ||
| + | scope: room | ||
| + | | ||
| + | actions: | ||
| + | - verb: heal | ||
| + | target: all | ||
| + | button: Heal | ||
| + | do: hero.health + 1 | ||
| + | rooms: | ||
| + | | ||
| + | | ||
| + | models: | ||
| + | | ||
| + | | ||
| + | choices: | ||
| + | | ||
| + | - id: corridor | ||
| + | text: The corridor. | ||
| + | choices: | ||
| + | - {command: return, to: workshop} | ||
| </ | </ | ||
| - | Internal rooms are automatically prefixed to avoid ID collisions. '' | + | Heal acts in the workshop and Leave remains available. Returning preserves |
| + | |||
| + | '' | ||
| + | |||
| + | '' | ||
| + | |||
| + | ===== Collection defaults ===== | ||
| - | ===== See also ===== | + | The example' |
| - | * [[en:yaml: | + | The editor exposes inline insertion and defaults for each generic collection in the model definition. The French key is '' |
| - | * [[en: | + | |
| - | **Find us on the [[https:// | + | The supplied library includes '' |
en/yaml/modeles.1788117667.txt.gz · Dernière modification : de cyrilfiesta
