Outils pour utilisateurs

Outils du site


en:yaml:texte

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
en:yaml:texte [2026/05/03 18:47] – Harmonize FR/EN language switch cyrilfiestaen:yaml:texte [2026/11/04 23:30] (Version actuelle) – Documentation 4.17 : objets, evenements et mise en page verifies cyrilfiesta
Ligne 27: Ligne 27:
 | ''%%||text||%%'' | Spoiler | | ''%%||text||%%'' | Spoiler |
 | ''> text'' on its own line | Block quote | | ''> text'' on its own line | Block quote |
 +
 +===== Highlighted code blocks =====
 +
 +<code yaml>
 +text: |
 +  ```diff
 +  - old rule
 +  + new rule
 +  ```
 +
 +  ```python
 +  def roll_dice(faces):
 +      return random.randint(1, faces)
 +  ```
 +</code>
 +
 +Supported languages: ''diff'', ''yaml'', ''python'', ''js'', ''json'', ''bash'', and every language handled by highlight.js on web and desktop. On Discord, they fall back to a plain code block.
  
 ===== Story Blocks ===== ===== Story Blocks =====
Ligne 71: Ligne 88:
     text: "A styled badge"     text: "A styled badge"
 </code> </code>
 +
 +^ Key ^ Value ^
 +| ''size:'' | Size in pixels, such as ''18'' or ''24''. |
 +| ''font:'' | CSS font family, such as ''Georgia'', ''monospace'' or ''cursive''. |
 +| ''background:'' | CSS background color, such as ''"#111827"''. |
 +| ''text-color:'' | CSS text color, such as ''"#facc15"''. |
 +
 +These keys apply to the whole block on Web and Desktop; Discord and Terminal ignore them. Use inline Markdown to style a single word.
  
 ===== Room Background ===== ===== Room Background =====
Ligne 80: Ligne 105:
   text: "The room is dark."   text: "The room is dark."
 </code> </code>
 +
 +===== The global markdown: field =====
 +
 +Set in the scenario header, it wraps **all** room texts:
 +
 +^ Value ^ Rendering ^
 +| ''fix'' | Monospace block (default) |
 +| ''none'' | Plain text |
 +| ''bold'' | Bold |
 +| ''italic'' | Italic |
 +| ''quote'' | Blockquote |
 +| ''story'' | Story blocks enabled |
 +| ''py'' / ''yaml'' / ''js'' / ... | Highlighted code block |
 +
 +===== Interactive Inline Elements =====
 +
 +Double braces can also make a word, phrase or picture interactive:
 +
 +<code yaml>
 +text:
 +  - "The {{door:?An old door.}} is locked."
 +  - "Touch the {{lever:@pull_lever}}."
 +  - "Drop the {{key:>key}} onto the {{door:$door}}."
 +</code>
 +
 +See [[en:yaml:tooltips|Interactive tooltips]], [[en:yaml:clickable-elements|Clickable elements]] and [[en:yaml:drag-drop|Drag & drop]].
 +
 +Tiles and grids use the extended picture syntax: [[en:yaml:tiles-tilemaps|Tiles and tilemaps]].
 +
 +===== Reusing the text of another room =====
 +
 +''%%[[ROOM:n]]%%'' inserts the narrative content of room number //n// where you write it. Useful for a recurring description or reply, written only once.
 +
 +<code yaml>
 +text: "The corridor goes on.[[ROOM:12]]"
 +</code>
 +
 +The French form is ''%%[[SALLE:n]]%%''. Circular references are detected and stopped: a room cannot include itself, directly or indirectly.
 +
 +The reference works on the web, in the desktop application and in an HTML5 export. Discord, the Terminal and the PDF show the referenced text in their usual linear form.
 +
 +To build a conversation rather than plain text, see [[en:yaml:dialogues|Dialogues and sequences]].
 +
 +===== Listing choices in the text =====
 +
 +''%%[[choice_vertical]]%%'' lists the current room's choice aliases on separate lines. ''%%[[choice_horizontal]]%%'' separates them with "/". The French forms ''%%[[choix_vertical]]%%'' and ''%%[[choix_horizontal]]%%'' work too.
 +
 +<code yaml>
 +rooms:
 +  - id: start
 +    text: |
 +      What would you like to do?
 +
 +      [[choice_vertical]]
 +    choices:
 +      - command: search
 +        to: chest
 +      - to: corridor
 +  - id: chest
 +    text: The chest.
 +  - id: corridor
 +    text: The corridor.
 +</code>
 +
 +The list shows "search" and "2". Without an alias, a choice uses its position in the declared list, usable directly or with ''go''. Edited aliases and added choices are included during play and in the preview. Choices hidden by conditions are omitted; the other choices keep their numbers.
 +
 +The [[en:editeur:generation|interactive fiction generator]] can add this text, numbered aliases and choice buttons. Directional exit text for mazes and dungeons is replaced during generation instead.
 +
 +===== Composed text and loops (4.17) =====
 +
 +A group can carry a condition and style, then contain other text blocks or loops. Styles are inherited; children can override them.
 +
 +<code yaml>
 +text:
 +  - if: v_visible_v = 1
 +    size: 23
 +    text:
 +      - for_each: item
 +        in: bag
 +        do:
 +          - text: t_item_t
 +</code>
 +
 +Declare ''visible'' in ''vars:'' and ''bag'' in ''lists:''. In text or a HUD, loops cannot change data. The usual media are allowed, without pauses or interactions; repetition depends on author conditions and the client's playback rules.
 +
 +Write media tags in the scenario: ''%%[[t_item.image_t]]%%'' reads an address. An inserted value such as ''t_item.name_t'' stays text even if it contains tags. See [[en:yaml:listes-boucles|Lists and loops]]. In the editor, **Composed content** creates this group.
 +
 +===== Furniture item and vertical inventory =====
 +
 +''%%[[ITEM_IN:coffre]]%%'' inserts the identifier of the first item present in that furniture in the current room, or empty text if it is empty. The French form is ''%%[[OBJET_DANS:coffre]]%%''.
 +
 +''%%[[INVENTORY_VERTICAL]]%%'' lists one item per line, using item identifiers and grouped quantities. The French form is ''%%[[INVENTAIRE_VERTICAL]]%%''.
 +
 +<code yaml>
 +title: 'Wiki 4.17: inventory'
 +language: en
 +rooms:
 +  - id: atelier
 +    auto_refresh: true
 +    text: |
 +      Inventory:
 +      [[INVENTORY_VERTICAL]]
 +      First item in coffre: [[ITEM_IN:coffre]]
 +    objects:
 +      - name: cle
 +        location: coffre
 +        pickup_reaction: Take
 +    choices:
 +      - command: regarder
 +        button: Look
 +        to: atelier
 +</code>
 +
 +''pickup_reaction: Take'' adds the native pickup button for this item in its furniture. ''auto_refresh: true'' refreshes the text after pickup: the key appears in the vertical inventory and the chest is empty. The "Look" choice displays the room again without taking an item.
 +
 +===== Previous room name =====
 +
 +''%%[[SALLE_PRECEDENTE]]%%'' inserts the known previous room ID, not its text or button label. Before the first move, the result is empty. Keep this French tag on English pages too: it has no English alias.
 +
 +<code yaml>
 +title: 'Wiki 4.17: previous'
 +rooms:
 +- id: entree
 +  text: 'Previous: [[SALLE_PRECEDENTE]]'
 +  choices:
 +  - button: Continue
 +    to: atelier
 +- id: atelier
 +  text: 'Previous: [[SALLE_PRECEDENTE]]'
 +  choices:
 +  - button: Back
 +    to: entree
 +</code>
 +
 +===== Local alignment and sized splits =====
 +
 +On Web, Desktop and in HTML exports, ''%%[[align:left]]text[[/align]]%%'' aligns a block. Directions are ''left'', ''center'', ''right'' or ''gauche'', ''centre'', ''droite''. A text variable such as ''t_cote_t'' can provide the direction. Close the block with ''%%[[/align]]%%''.
 +
 +''%%[[split]]%%'' separates zones. ''%%[[split:40]]%%'' gives 40% to the previous zone; the next receives the remainder. Splits and alignment also work in HUD panels.
 +
 +<code yaml>
 +title: 'Wiki 4.17: alignment'
 +vars_text:
 +  cote: right
 +rooms:
 +- id: atelier
 +  text: |
 +    [[align:left]]Left.[[/align]]
 +    [[align:center]]Center.[[/align]]
 +    [[align:t_cote_t]]Right.[[/align]]
 +    [[split:40]]
 +    Second zone.
 +  choices:
 +  - command: rester
 +    button: Stay
 +    to: atelier
 +</code>
 +
en/yaml/texte.1777826866.txt.gz · Dernière modification : de cyrilfiesta