diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-02-16 05:39:46 +0000 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-02-16 05:39:46 +0000 |
| commit | 80d4689fe751b4bad22d231b8b6fdd6f16f4caa0 (patch) | |
| tree | 24dd4d310fd205966b33f6512f0c7aece0c6438d | |
| parent | 7d447d586446e82a88252ce81136a55556c09503 (diff) | |
| download | gpt-adventure-80d4689fe751b4bad22d231b8b6fdd6f16f4caa0.tar.zst | |
Add a custom scenario option.
| -rwxr-xr-x | gpt_adventure.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gpt_adventure.py b/gpt_adventure.py index c151cdc..68f8f58 100755 --- a/gpt_adventure.py +++ b/gpt_adventure.py @@ -73,6 +73,7 @@ def pick_flavor() -> str: for i, (scenario, script) in enumerate(flavors.items()): print(f"{i}.\t{scenario}") choices.append(script) + print(f"{len(choices)}.\tcustom") while True: choice = input("Choose a scenario: ") try: @@ -80,6 +81,9 @@ def pick_flavor() -> str: except ValueError: print("Input must be an integer.") continue + if choice_int == len(choices): + print("Enter a custom prompt. Press control-D when you're done.") + return sys.stdin.read().strip() try: return choices[choice_int] except IndexError: |
