Outils pour utilisateurs

Outils du site


en:txt:syntaxe-base

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:txt:syntaxe-base [2026/05/03 18:47] – Harmonize FR/EN language switch cyrilfiestaen:txt:syntaxe-base [2026/08/31 20:48] (Version actuelle) – Wiki : fins de pages homogènes, liens Discord retirés cyrilfiesta
Ligne 1: Ligne 1:
 **Language / Langue :** [[fr:txt:syntaxe-base|FR]] | **EN** **Language / Langue :** [[fr:txt:syntaxe-base|FR]] | **EN**
  
-====== TXT Syntax — Base ======+====== Basic syntax (.txt format) ======
  
-The .txt format is the legacy JDR-Bot syntax. It is still supported, but new scenarios should use YAML.+<note> 
 +The .txt format is the legacy JDR-Bot syntaxstill supported. For new scenarios, prefer the [[en:yaml:syntaxe-base|YAML format]], which is more powerful. 
 +</note>
  
-room is made of several lines: number, title/textvariables/objects, then exits and events.+.txt scenario is a text file encoded in **UTF-8**, made of blocks separated by lines of stars. 
 + 
 +===== General structure ===== 
 + 
 +<code> 
 +Scenario title 
 +Number of rooms 
 +1 room_name_1 
 +Text of room 1 
 +
 +
 +exit->
 +*************** 
 +2 room_name_2 
 +Text of room 2 
 +
 +999|You win! 
 +*************** 
 +</code> 
 + 
 +===== Each block in detail ===== 
 + 
 +**Line 1 - Scenario title** 
 + 
 +The title is shown when the game starts. It may be followed by options separated with "|" (see [[en:txt:alias|Aliases and reactions]]). 
 +⚠ Do not use "|" inside the title itself, it is a delimiter. 
 + 
 +**Line 2 - Number of rooms** 
 + 
 +The total number of rooms in the scenario. A Discord markdown mode can be added next to it: ''3 fix'' (''fix'' is the default value). 
 + 
 +**Room blocks** 
 + 
 +Each room is made of **exactly 4 lines**in this order: 
 + 
 +  - ''[number] [internal_name]'' - unique identifier of the room 
 +  - Text shown to the player (may be ''null'' for no text
 +  - Objects / variables / states (or ''|'' when empty - **required**) 
 +  - Available exits and events 
 + 
 +Rooms are separated with ''*****'' (at least five stars). 
 + 
 +  * **No separator before the first room.** 
 +  * **One separator after EVERY room, the last one included.** Without it the engine rejects the scenario: it looks for the end of the last block and runs past the end of the file. The number of ''*****'' lines must therefore equal the number of rooms. 
 + 
 +Whatever follows the last separator, online variables and global aliases, is not a room. 
 + 
 +===== Available exits ===== 
 + 
 +^ Syntax ^ Effect ^ 
 +| ''2'' | Room 2 reachable with no condition | 
 +| ''2%%|%%object%%|%%KO text%%|%%OK text'' | Room 2 with an object condition | 
 +| ''2%%|%%v_var_v.>=.5%%|%%KO text%%|%%OK text'' | Room 2 with a variable condition | 
 +| ''alias->2'' | The ''alias'' word leads to room 2 | 
 +| ''previous'' or ''precedent'' | Allows going back to the previous room | 
 +| ''997'' | Automatic event (see [[en:txt:evenements|Events]]) | 
 +| ''998%%|%%Defeat text'' | End of game - defeat | 
 +| ''999%%|%%Victory text'' | End of game - victory | 
 + 
 +===== Ending examples ===== 
 + 
 +''998'' and ''999'' are special room numbers. If one of them appears in the exits of a room, the game ends with the matching text: 
 + 
 +<code> 
 +999|Congratulations! You solved the escape game! 
 +998|Game over. The dungeon got the better of you... 
 +</code> 
 + 
 +===== Testing your scenario ===== 
 + 
 +To start your scenario on the Discord bot: 
 + 
 +<code> 
 +play https://your-url/your_scenario.txt 
 +</code> 
 + 
 +Or, if you have set a base URL: 
 + 
 +<code> 
 +play scenario_name 
 +</code>
  
-Use the existing examples and the linter when maintaining legacy scenarios. 
en/txt/syntaxe-base.1777826874.txt.gz · Dernière modification : de cyrilfiesta