Added a repair tool for incorrectly formatted line mapping.

This commit is contained in:
Jonathan Hite 2025-02-08 23:22:24 -05:00
parent 775ab0c688
commit 9f2b60b9f2
2 changed files with 187 additions and 125 deletions

62
game_line_offset_fix.py Normal file
View file

@ -0,0 +1,62 @@
# This will fix a gamefile that was written with a title="Title" on line 1, but was not offset
# to account for that. If title="Title" is used on line 1, that line should then be treated
# as line 0. The gamefile processor assumes line 1 is the first line that doesn't start with title=
# This script will subtract one from every line number mapping in the gamefile.
# Alternatively, you could add a "dummy line" to the second storyline shifting the rest of
# the file down by one line.
import re
import os
def list_game_files(directory):
return [f for f in os.listdir(directory) if os.path.isfile(os.path.join(directory, f))]
def adjust_numbers_in_file(input_file, output_file):
with open(input_file, 'r', encoding='utf-8') as f:
lines = f.readlines()
updated_lines = []
for line in lines:
# Preserve title line
if line.startswith("title="):
updated_lines.append(line)
continue
# Find numbers and subtract 1 from each
def adjust_number(match):
return f", {match.group(1)}, {int(match.group(2)) - 1}"
updated_line = re.sub(r",\s*([^,]+)\s*,\s*(\d+)", adjust_number, line)
updated_lines.append(updated_line)
with open(output_file, 'w', encoding='utf-8') as f:
f.writelines(updated_lines)
def main():
games_dir = "./games"
game_files = list_game_files(games_dir)
if not game_files:
print("No files found in the ./games directory.")
return
print("Select a file to process:")
for idx, filename in enumerate(game_files, start=1):
print(f"{idx}: {filename}")
choice = int(input("Enter the number of the file: ")) - 1
if choice < 0 or choice >= len(game_files):
print("Invalid selection.")
return
input_filename = game_files[choice]
input_filepath = os.path.join(games_dir, input_filename)
output_filename = f"{os.path.splitext(input_filename)[0]}-linefix{os.path.splitext(input_filename)[1]}"
output_filepath = os.path.join(games_dir, output_filename)
adjust_numbers_in_file(input_filepath, output_filepath)
print(f"Processed file saved as: {output_filename}")
if __name__ == "__main__":
main()

View file

@ -279,17 +279,17 @@ The wind shifts revealing an untouched section of the ruins., Investigate, 337,
The ruins hold no more secrets—only dust and echoes. There is nothing left to find!
Walking away you choose the future over the past. Some mysteries must remain unsolved!
You dig deeper uncovering a hidden vault beneath the sand., Enter the vault, 339, Leave it buried, 340
Inside, the air is thick with age. The walls whisper of forgotten knowledge., Listen closely, 341, Seal the vault behind you, 342
Inside the air is thick with age. The walls whisper of forgotten knowledge., Listen closely, 341, Seal the vault behind you, 342
The voices reveal nothing but lost echoes. The ruins' story is already over!
You collapse the entrance, ensuring nothing will be disturbed again. Time reclaims the past!
Leaving the vault buried you turn away, letting history rest. Some doors are best left closed!
You collapse the entrance ensuring nothing will be disturbed again. Time reclaims the past!
Leaving the vault buried you turn away letting history rest. Some doors are best left closed!
A shadow looms over the horizon shifting and unnatural., Confront it, 343, Walk in the opposite direction, 344
The shadow engulfs you its purpose unknowable. Some mysteries should remain unsolved!
You avoid the presence pushing forward into the unknown leaving the past behind!
The desert air grows still as if the ruins themselves are fading from existence., Accept it, 345, Try to stop it, 346
You stand in silence knowing the past cannot be held forever. Time moves on!
Your efforts are in vain—the ruins dissolve into dust, lost to history!
A final doorway stands before you, untouched by the collapse., Step through, 347, Turn away, 348
Your efforts are in vain—the ruins dissolve into dust lost to history!
A final doorway stands before you untouched by the collapse., Step through, 347, Turn away, 348
Beyond the door is nothing but darkness. There is no more story to tell!
You walk away never knowing what lay beyond. Some doors are better left closed!
A distant storm approaches erasing the last traces of the ruins., Watch it unfold, 349, Seek shelter, 350
@ -297,7 +297,7 @@ The storm consumes everything wiping away all remnants of the past. The cycle is
You shelter from the storm emerging into a world that has already moved on!
The sands shift beneath your feet revealing something ancient., Examine it, 351, Walk away, 352
The object is a simple stone smoothed by time. No secrets remain!
You turn away, choosing the present over the past. The ruins are truly gone!
You turn away choosing the present over the past. The ruins are truly gone!
The last echoes of the ruins fade from your mind., Hold onto the memory, 353, Let it go, 354
You remember but memories are all that remain. Time moves on without them!
You release the past feeling lighter than before. The ruins vanish from history!
@ -310,162 +310,162 @@ You turn back but where once there were ruins now only emptiness remains!
A faint whisper carries on the wind a voice you once knew., Listen, 359, Ignore it and walk away, 360
The whisper fades leaving only silence. Some stories were never meant to be remembered!
You walk away never looking back. The past is gone and the present remains!
The sand beneath your feet shifts, revealing one final inscription., Read it, 361, Leave it untouched, 362
The words are unreadable, eroded by time. Its meaning is lost forever!
You leave the inscription behind, knowing some secrets were never meant to be uncovered!
A distant figure stands at the horizon, watching., Approach, 363, Ignore it and keep walking, 364
The sand beneath your feet shifts revealing one final inscription., Read it, 361, Leave it untouched, 362
The words are unreadable eroded by time. Its meaning is lost forever!
You leave the inscription behind knowing some secrets were never meant to be uncovered!
A distant figure stands at the horizon watching., Approach, 363, Ignore it and keep walking, 364
The figure vanishes as you draw near. Perhaps it was never there at all!
You continue walking, leaving everything behind. The ruins fade from memory!
A lone relic remains in your hands, the last piece of a forgotten age., Bury it, 365, Keep it as a reminder, 366
You let the relic sink into the sands, allowing the past to rest!
You hold onto the relic, but with time, even it fades to dust. Nothing lasts forever!
You continue walking leaving everything behind. The ruins fade from memory!
A lone relic remains in your hands the last piece of a forgotten age., Bury it, 365, Keep it as a reminder, 366
You let the relic sink into the sands allowing the past to rest!
You hold onto the relic but with time even it fades to dust. Nothing lasts forever!
The final grains of sand slip through your fingers., Accept the end, 367, Struggle against it, 368
The end comes, as it always must. The ruins are forgotten, their tale complete!
You resist, but time is an unrelenting force. All things must fade!
The end comes as it always must. The ruins are forgotten their tale complete!
You resist but time is an unrelenting force. All things must fade!
The wind carries away the last traces of the temple., Stand and watch, 369, Turn and leave, 370
You watch as history is erased, knowing its story will never be told again!
You walk away without looking back. The ruins existed once, but now they are gone!
The wind howls through the empty ruins, the last echoes of a forgotten age., Listen to the wind, 371, Walk away without a sound, 372
The wind fades, leaving only silence. The ruins are gone, and so is their story!
You leave without a trace, your presence as fleeting as those who came before!
You watch as history is erased knowing its story will never be told again!
You walk away without looking back. The ruins existed once but now they are gone!
The wind howls through the empty ruins the last echoes of a forgotten age., Listen to the wind, 371, Walk away without a sound, 372
The wind fades leaving only silence. The ruins are gone and so is their story!
You leave without a trace your presence as fleeting as those who came before!
The sky above darkens as the last remnants of the temple disappear., Watch the sky, 373, Close your eyes and move on, 374
You watch as the clouds swallow the ruins. In time, all things are erased!
You step forward into the unknown, leaving the ruins behind forever!
A single path remains before you, untouched by time., Follow it, 375, Turn back one last time, 376
The path leads nowhere, stretching into eternity. You have reached the end!
You turn back, but the ruins have already vanished. There is nothing left to return to!
You watch as the clouds swallow the ruins. In time all things are erased!
You step forward into the unknown leaving the ruins behind forever!
A single path remains before you untouched by time., Follow it, 375, Turn back one last time, 376
The path leads nowhere stretching into eternity. You have reached the end!
You turn back but the ruins have already vanished. There is nothing left to return to!
A faint whisper calls your name from the distance., Answer, 377, Ignore it and walk on, 378
The whisper fades before you can understand it. The past holds no answers!
You do not turn back, allowing the ruins to be forgotten at last!
You do not turn back allowing the ruins to be forgotten at last!
The ground beneath you shifts as the final remnants of the ruins crumble., Watch the collapse, 379, Keep moving forward, 380
You witness the last stone fall, and with it, the last memory of the temple!
You do not look back. The past is gone, and the future calls you elsewhere!
You witness the last stone fall and with it the last memory of the temple!
You do not look back. The past is gone and the future calls you elsewhere!
A single stone remains where the temple once stood., Touch it, 381, Leave it undisturbed, 382
The stone crumbles at your touch, scattering into dust!
You walk away, leaving the last remnant of the temple to time!
The air grows still, as if the world itself has forgotten this place., Breathe deeply, 383, Keep walking without hesitation, 384
You take in the silence, knowing you are the last to stand here!
You walk forward, leaving no trace behind. The ruins are gone, and so are you!
The sky above clears, revealing an endless horizon., Step toward the horizon, 385, Close your eyes and rest, 386
You walk toward the horizon, knowing there is nothing left to find!
You sit in the silence, letting time erase the past and the future alike!
The stone crumbles at your touch scattering into dust!
You walk away leaving the last remnant of the temple to time!
The air grows still as if the world itself has forgotten this place., Breathe deeply, 383, Keep walking without hesitation, 384
You take in the silence knowing you are the last to stand here!
You walk forward leaving no trace behind. The ruins are gone and so are you!
The sky above clears revealing an endless horizon., Step toward the horizon, 385, Close your eyes and rest, 386
You walk toward the horizon knowing there is nothing left to find!
You sit in the silence letting time erase the past and the future alike!
The wind carries the last echoes of the ruins away., Listen one final time, 387, Turn and walk without hesitation, 388
The whispering fades, leaving only the vast, empty world before you!
You move forward, never looking back, letting the ruins fade from memory!
The whispering fades leaving only the vast empty world before you!
You move forward never looking back letting the ruins fade from memory!
A final shadow flickers at the edge of your vision., Acknowledge it, 389, Ignore it and move on, 390
The shadow vanishes, just another trick of the past slipping away!
You continue forward, the ruins lost forever behind you!
The shadow vanishes just another trick of the past slipping away!
You continue forward the ruins lost forever behind you!
The path you walk leads to an unknown place., Follow it without question, 391, Look back one last time, 392
The unknown stretches ahead, vast and limitless. Your journey continues!
You hesitate, but the past has already been erased. The ruins no longer exist!
The unknown stretches ahead vast and limitless. Your journey continues!
You hesitate but the past has already been erased. The ruins no longer exist!
The sky above shimmers as the last remnants of magic dissolve., Watch the sky, 393, Keep walking, 394
You witness the final trace of the temple fade into nothingness!
You do not stop, leaving the past where it belongs!
The ruins whisper a name—perhaps yours, perhaps anothers., Speak your own name, 395, Stay silent, 396
The whisper fades, its meaning lost to time!
You leave in silence, carrying no answers, only the weight of what once was!
You do not stop leaving the past where it belongs!
The ruins whisper a name—perhaps yours perhaps anothers., Speak your own name, 395, Stay silent, 396
The whisper fades its meaning lost to time!
You leave in silence carrying no answers only the weight of what once was!
A single doorway stands in the vast emptiness ahead., Step through it, 397, Turn away, 398
You step forward, into something new, leaving all else behind!
You turn away, knowing the past must remain buried!
The ground beneath you is firm, untouched by what once was., Stand still and reflect, 399, Walk toward the unknown, 400
You reflect for a moment, then move on, never to return!
You take the first step into an uncertain future, free of the past!
You step forward into something new leaving all else behind!
You turn away knowing the past must remain buried!
The ground beneath you is firm untouched by what once was., Stand still and reflect, 399, Walk toward the unknown, 400
You reflect for a moment then move on never to return!
You take the first step into an uncertain future free of the past!
A gust of wind stirs the dust where the temple once stood., Watch it settle, 401, Keep walking, 402
The dust settles, the ruins gone, their secrets buried forever!
You do not stop. The ruins were only a moment in time, already forgotten!
The dust settles the ruins gone their secrets buried forever!
You do not stop. The ruins were only a moment in time already forgotten!
The last traces of the ruins drift away on the wind., Breathe in the air of a new beginning, 403, Walk away without another thought, 404
You inhale deeply, feeling the weight of the past lift from your shoulders!
You continue forward, leaving everything behind as if it never existed!
You inhale deeply feeling the weight of the past lift from your shoulders!
You continue forward leaving everything behind as if it never existed!
The stars above seem brighter now that the ruins are gone., Gaze up at them, 405, Keep your focus on the road ahead, 406
You stare at the stars, feeling small yet free beneath their endless glow!
You stare at the stars feeling small yet free beneath their endless glow!
You do not waver. The future is yours to shape without the ruins shadow!
The wind shifts, carrying a faint, final sound., Listen closely, 407, Ignore it and move on, 408
The sound fades, indistinguishable, and then silence remains!
You press on, knowing some things are best left unheard!
The wind shifts carrying a faint final sound., Listen closely, 407, Ignore it and move on, 408
The sound fades indistinguishable and then silence remains!
You press on knowing some things are best left unheard!
A single path stretches endlessly before you., Walk it without hesitation, 409, Pause and take one last look back, 410
You follow the path into the unknown, with nothing left to hold you back!
You hesitate, but the ruins have already vanished from existence!
You follow the path into the unknown with nothing left to hold you back!
You hesitate but the ruins have already vanished from existence!
A faint glow shimmers on the horizon., Approach it, 411, Walk in the opposite direction, 412
You move toward the light, stepping into the dawn of a new era!
You leave the glow behind, choosing your own way forward!
The echoes of the ruins are gone, but something lingers within you., Accept the feeling, 413, Try to shake it off, 414
You carry the ruins within, a quiet memory that will never fade!
You push away the thoughts, determined to start anew!
A crossroads appears, though you do not remember it being there., Choose a direction and keep walking, 415, Stand still and wait, 416
You walk a path unknown, yet somehow meant for you!
You wait, but nothing comes. The choice is yours alone to make!
The sky above is clear, free of the temples shadows., Take comfort in it, 417, Keep your gaze on the path ahead, 418
You find peace in the open sky, no longer bound by the past!
You do not stop, moving forward without hesitation!
The ruins have vanished, but their memory remains., Carry the memory forward, 419, Let it fade into the past, 420
You preserve the knowledge, ensuring the story is never forgotten!
You release the past, allowing yourself to move on without regret!
The road ahead is open, free from the burdens of the temple., Walk toward the horizon, 421, Take a moment to reflect, 422
You embrace the unknown, stepping into a new journey!
You pause, realizing how much you have changed, then continue forward!
You move toward the light stepping into the dawn of a new era!
You leave the glow behind choosing your own way forward!
The echoes of the ruins are gone but something lingers within you., Accept the feeling, 413, Try to shake it off, 414
You carry the ruins within a quiet memory that will never fade!
You push away the thoughts determined to start anew!
A crossroads appears though you do not remember it being there., Choose a direction and keep walking, 415, Stand still and wait, 416
You walk a path unknown yet somehow meant for you!
You wait but nothing comes. The choice is yours alone to make!
The sky above is clear free of the temples shadows., Take comfort in it, 417, Keep your gaze on the path ahead, 418
You find peace in the open sky no longer bound by the past!
You do not stop moving forward without hesitation!
The ruins have vanished but their memory remains., Carry the memory forward, 419, Let it fade into the past, 420
You preserve the knowledge ensuring the story is never forgotten!
You release the past allowing yourself to move on without regret!
The road ahead is open free from the burdens of the temple., Walk toward the horizon, 421, Take a moment to reflect, 422
You embrace the unknown stepping into a new journey!
You pause realizing how much you have changed then continue forward!
A gentle breeze stirs the dust where the ruins once stood., Feel the breeze and smile, 423, Turn away from it, 424
You welcome the wind as a sign of renewal, ready for what comes next!
You turn your back on it, setting your own course from here!
You welcome the wind as a sign of renewal ready for what comes next!
You turn your back on it setting your own course from here!
A quiet feeling of closure settles within you., Accept it, 425, Question if it's truly over, 426
You let peace take hold, knowing the story has reached its end!
You hesitate, but no more answers come. The temple is truly gone!
The night is calm, without the whispers of the past., Rest beneath the stars, 427, Keep walking, 428
You fall into a deep, dreamless sleep, unburdened at last!
You walk until the horizon swallows you, the past left behind!
You let peace take hold knowing the story has reached its end!
You hesitate but no more answers come. The temple is truly gone!
The night is calm without the whispers of the past., Rest beneath the stars, 427, Keep walking, 428
You fall into a deep dreamless sleep unburdened at last!
You walk until the horizon swallows you the past left behind!
A single thought lingers—was it all real?, Dismiss the thought, 429, Hold onto it as a mystery, 430
You shake your head and move on. It no longer matters!
You keep the mystery alive, a secret that only you will ever know!
A fork in the path awaits, though neither road is familiar., Choose one without looking back, 431, Stop and consider the options, 432
You take the first step forward, unafraid of what lies ahead!
You weigh your choices, but in the end, all roads lead forward!
For the first time in a long while, you are free., Embrace your freedom, 433, Wonder if you will ever return, 434
You walk forward with a light heart, unchained from the past!
You glance back one last time, but the ruins are gone forever!
The ruins exist now only in memory, their mysteries sealed forever., Let go of the past, 435, Keep the knowledge alive, 436
You keep the mystery alive a secret that only you will ever know!
A fork in the path awaits though neither road is familiar., Choose one without looking back, 431, Stop and consider the options, 432
You take the first step forward unafraid of what lies ahead!
You weigh your choices but in the end all roads lead forward!
For the first time in a long while you are free., Embrace your freedom, 433, Wonder if you will ever return, 434
You walk forward with a light heart unchained from the past!
You glance back one last time but the ruins are gone forever!
The ruins exist now only in memory their mysteries sealed forever., Let go of the past, 435, Keep the knowledge alive, 436
You release the past and step into the future with no regrets!
You become a guardian of the forgotten, ensuring the story is never truly lost!
A quiet road stretches ahead, untouched by time., Walk forward without hesitation, 437, Look back one last time, 438
You step into the unknown, ready for a new chapter!
You see nothing but empty land where the ruins once stood, and turn away!
You become a guardian of the forgotten ensuring the story is never truly lost!
A quiet road stretches ahead untouched by time., Walk forward without hesitation, 437, Look back one last time, 438
You step into the unknown ready for a new chapter!
You see nothing but empty land where the ruins once stood and turn away!
The weight of the past finally lifts from your shoulders., Accept the peace, 439, Question what comes next, 440
You find comfort in the quiet, knowing you have done all you could!
You wonder if the ruins will ever return, but that is a question for another time!
The whispers are gone, replaced by the sound of the wind., Let the wind guide you, 441, Stand still and listen, 442
You walk forward, allowing fate to take you wherever it may!
You listen, but there is only silence. The story has ended!
You find comfort in the quiet knowing you have done all you could!
You wonder if the ruins will ever return but that is a question for another time!
The whispers are gone replaced by the sound of the wind., Let the wind guide you, 441, Stand still and listen, 442
You walk forward allowing fate to take you wherever it may!
You listen but there is only silence. The story has ended!
A distant light flickers on the horizon., Follow it, 443, Ignore it and continue walking, 444
You step toward the light, uncertain but unafraid!
You leave the light behind, choosing your own path instead!
You step toward the light uncertain but unafraid!
You leave the light behind choosing your own path instead!
The stars above seem brighter than before., Take it as a sign, 445, Ignore it and move on, 446
You smile, knowing that even in endings, there is beauty!
You walk forward, leaving the past fully behind!
You smile knowing that even in endings there is beauty!
You walk forward leaving the past fully behind!
A lone traveler crosses your path., Speak to them, 447, Continue on your way, 448
You exchange stories, but nothing will ever match what you have seen!
You pass by without a word, your journey yours alone!
The ruins may be gone, but something deep inside you has changed., Accept the change, 449, Resist it and try to return to normal, 450
You exchange stories but nothing will ever match what you have seen!
You pass by without a word your journey yours alone!
The ruins may be gone but something deep inside you has changed., Accept the change, 449, Resist it and try to return to normal, 450
You embrace the person you have become and move forward!
You try to return to who you were, but some journeys cannot be undone!
You try to return to who you were but some journeys cannot be undone!
The last echoes of the ruins fade from your mind., Walk away without looking back, 451, Try to remember every detail, 452
You leave the past behind, knowing some mysteries are meant to be forgotten!
You cling to the memories, but time erodes even the deepest truths!
You leave the past behind knowing some mysteries are meant to be forgotten!
You cling to the memories but time erodes even the deepest truths!
A cold wind brushes against your skin as you step forward., Accept the chill as a farewell, 453, Wrap yourself in your cloak and move on, 454
You take a deep breath and walk into the unknown, ready for what comes next!
The warmth of your cloak brings comfort, but your journey is done!
You take a deep breath and walk into the unknown ready for what comes next!
The warmth of your cloak brings comfort but your journey is done!
The road stretches endlessly before you., Keep walking without pause, 455, Find a place to rest, 456
You walk on, the past behind you and the future unwritten!
You rest, but the ruins still linger in your thoughts before sleep takes you!
You walk on the past behind you and the future unwritten!
You rest but the ruins still linger in your thoughts before sleep takes you!
The night sky glows with unfamiliar constellations., Marvel at the sight, 457, Keep your focus ahead, 458
The stars remind you that the world is vast, and your story is but one of many!
You press forward, unshaken by what you have left behind!
The stars remind you that the world is vast and your story is but one of many!
You press forward unshaken by what you have left behind!
A faint song echoes through the air., Follow the melody, 459, Ignore it and continue walking, 460
You listen and follow, but the song fades, leaving only silence!
You walk on, ignoring the call of the unknown!
You listen and follow but the song fades leaving only silence!
You walk on ignoring the call of the unknown!
The road comes to a fork., Take the left path, 461, Take the right path, 462
Each step takes you further from what once was, and that is enough!
No matter which way you turn, your journey is your own!
Each step takes you further from what once was and that is enough!
No matter which way you turn your journey is your own!
A small village appears in the distance., Approach it, 463, Walk past it and continue alone, 464
You find peace among strangers, a quiet place to call home!
You choose solitude, letting the road take you wherever it may!
You find peace among strangers a quiet place to call home!
You choose solitude letting the road take you wherever it may!
The wind carries the last remnants of the past away., Whisper a farewell, 465, Say nothing and move on, 466
Your whispered goodbye is the final closure you needed!
You say nothing but deep inside you know it is over!

Can't render this file because it contains an unexpected character in line 1 and column 7.