Created
December 11, 2019 23:12
-
-
Save MightyAlex200/af9b5f1290cb68629ad81813da28c87f to your computer and use it in GitHub Desktop.
AIDungeon2 characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%bash | |
# Characters | |
echo """From 71790a90561a150963ad5a88800101e7b0c0c3a1 Mon Sep 17 00:00:00 2001 | |
From: MightyAlex200 <[email protected]> | |
Date: Wed, 11 Dec 2019 18:01:10 -0500 | |
Subject: [PATCH] Characters | |
--- | |
play.py | 32 +++++++++++++++++++++++++++----- | |
1 file changed, 27 insertions(+), 5 deletions(-) | |
diff --git a/play.py b/play.py | |
index 31cd2bd..1ca29e8 100644 | |
--- a/play.py | |
+++ b/play.py | |
@@ -115,6 +115,9 @@ def play_aidungeon_2(): | |
if story_manager.story != None: | |
del story_manager.story | |
+ characters = [] | |
+ current_character = \"You\" | |
+ | |
print(\"\\n\\n\") | |
splash_choice = splash() | |
@@ -207,6 +210,25 @@ def play_aidungeon_2(): | |
else: | |
console_print(story_manager.story.story_start) | |
continue | |
+ | |
+ elif len(action.split(\" \")) >= 2 and action.split(\" \")[0] == \"setchar\": | |
+ | |
+ new_char = action[len(action.split(\" \")[0]):].strip() | |
+ if new_char == \"\": | |
+ console_print(\"Character name cannot be empty\") | |
+ continue | |
+ is_known_char = False | |
+ for known_char in characters: | |
+ if known_char.lower() == new_char.lower(): | |
+ is_known_char = True | |
+ new_char = known_char | |
+ break | |
+ if not is_known_char: | |
+ characters.append(new_char) | |
+ | |
+ current_character = new_char | |
+ console_print(\"Switched to character \" + new_char) | |
+ continue | |
else: | |
if action == \"\": | |
@@ -215,20 +237,20 @@ def play_aidungeon_2(): | |
console_print(result) | |
elif action[0] == '\"': | |
- action = \"You say \" + action | |
+ if current_character == \"You\": | |
+ action = \"You say \" + action | |
+ else: | |
+ action = current_character + \" says \" + action | |
else: | |
action = action.strip() | |
action = action[0].lower() + action[1:] | |
- if \"You\" not in action[:6] and \"I\" not in action[:6]: | |
- action = \"You \" + action | |
+ action = current_character + \" \" + action | |
if action[-1] not in [\".\", \"?\", \"!\"]: | |
action = action + \".\" | |
- action = first_to_second_person(action) | |
- | |
action = \"\\n> \" + action + \"\\n\" | |
result = \"\\n\" + story_manager.act(action) | |
-- | |
2.24.0""" > fix.patch | |
# email and username required | |
git config user.email "[email protected]" | |
git config user.name "Anonymous" | |
git am --3way fix.patch && echo Patch Applied! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment