From 80d4689fe751b4bad22d231b8b6fdd6f16f4caa0 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Wed, 16 Feb 2022 05:39:46 +0000 Subject: Add a custom scenario option. --- gpt_adventure.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gpt_adventure.py') 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: -- cgit v1.3.1