**Language / Langue :** [[fr:txt:syntaxe-base|FR]] | **EN**
====== Basic syntax (.txt format) ======
The .txt format is the legacy JDR-Bot syntax, still supported. For new scenarios, prefer the [[en:yaml:syntaxe-base|YAML format]], which is more powerful.
A .txt scenario is a text file encoded in **UTF-8**, made of blocks separated by lines of stars.
===== General structure =====
Scenario title
Number of rooms
1 room_name_1
Text of room 1
|
2
exit->2
***************
2 room_name_2
Text of room 2
|
999|You win!
***************
===== 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:
999|Congratulations! You solved the escape game!
998|Game over. The dungeon got the better of you...
===== Testing your scenario =====
To start your scenario on the Discord bot:
play https://your-url/your_scenario.txt
Or, if you have set a base URL:
play scenario_name