[[fetch]] files = [ "src/python/CtrlS/src/chapters/ctrls.py", "src/python/CtrlS/src/chapters/prologue.py" ] [dependencies] prologue = "0.9.3"

Thomas J Butler

Game Showcase

CTRL-S - The World | A Python Text Adventure

Experience an out of this world text adventure with amazing ASCII art!

Game Window

from js import document from pyodide.ffi import create_proxy import sys sys.path.append("src/python/CtrlS/src/chapters") from ctrls import run_game, handle_input, welcome_message def display(text): output = document.getElementById("game-output") output.innerHTML += f"{text}
" output.scrollTop = output.scrollHeight def on_key_press(event): if event.key == "Enter": input_element = document.getElementById("game-input") user_input = input_element.value.lower().strip() input_element.value = "" display(f"> {user_input}") if user_input == "start": try: welcome_message() # Start the story display("Type 'c' to proceed with the story...") except Exception as e: display(f"Error: {str(e)}") elif user_input == "help": display("Available commands:\n- start: Begin the game\n- help: Show this help message\n- c: Proceed with the story") else: result = handle_input(user_input) if result: display(result) def start_game_handler(event): document.getElementById("game-output").innerHTML = "" initial_text = run_game() if initial_text: display(initial_text) # Set up event handlers document.getElementById("start-game").onclick = create_proxy(start_game_handler) document.getElementById("game-input").onkeypress = create_proxy(on_key_press)

How to Play

Click 'Start Game' to begin. Type 'help' for available commands. Enjoy the ASCII art and storyline!