Adjusted the way game_title was displayed for games without a title line. Added clarification to the gamefile_syntax.md.

This commit is contained in:
Jonathan Hite 2025-02-07 10:19:10 -05:00
parent 91d31fc6f8
commit 34704013bd
4 changed files with 14 additions and 2 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ venv/
.idea
config.ini
fortunes.txt
offline_game_tester.py

View File

@ -806,7 +806,6 @@ def start_selected_game(sender_id, interface, state):
# Present the first segment
present_story_segment(sender_id, interface, new_state) # ✅ Pass updated state
def load_game_map(file_path):
"""Loads a game map from a CSV file and returns its structured format."""
@ -828,7 +827,7 @@ def load_game_map(file_path):
game_title = first_line.split("=", 1)[1].strip().strip('"')
game_lines = lines[1:] # Skip title
else:
game_title = file_path # Use filename if no title
game_title = os.path.splitext(os.path.basename(file_path))[0] # Use filename without path/extension
game_lines = lines
print(f"DEBUG: Game title detected -> {game_title}")

View File

@ -31,6 +31,8 @@ title="The Mysterious Forest"
- If present, the game uses this as the **title**.
- If absent, the **filename** is used as the title.
- The second line will then be the **first story segment**.
- If present, the game will consider the title line as line 0.
- Line 1 is always the first story segment.
---
@ -63,4 +65,7 @@ title="The Mysterious Forest"
## 📌 **Final Notes**
By following this format, you can create **interactive, branching text adventures** without modifying code! 🎮🚀
Remember, if using a title in the first line you need to offset your line mapping by -1. It's easiest to write
the story and mapping first, then adding the title after you're done. If you forget to offset your line numbers,
a simple script to increment each choice number by -1 will fix it for you!

View File

@ -0,0 +1,7 @@
What is your first choice?, East, 2, West, 3, North, 4, South, 5
You chose East. A dense forest appears., Run forward, 6, Look around, 7
You chose West. A river blocks your path., Try to swim, 8, Walk along the bank, 9
You chose North. The path is blocked by rocks.
You chose South. A cave entrance looms ahead., Enter the cave, 10, Turn back, 11
You went East and chose to run. The ground gives way and you fall. GAME OVER.
You went East and looked around. You see a hidden path., Follow it, 12, Stay put, 13