def mainloop(): global here while True: screen_clear() msg = "" print(here) print("\n\n") print("If you want to search around, type search or ls") print("If you want to view map, type map") print("If you want to view pocket, type pocket") print("If you want to go somewhere else, " "type goto _location_ or cd _location_") print() inp = input("Your choice: ") match_obj = re.search(r"^(goto|cd) .*", inp) if re.search(r"^(search|ls)$", inp): msg = here.search() elif match_obj: new_loc = inp[len(match_obj.group(1)) + 1:] msg, here = here.goto(new_loc) elif re.search(r"^map$", inp): print("Close map to continue") makemap(here) elif re.search(r"^pocket$", inp): Pocket.show() elif re.search(r"^exit$", inp): if input("Type exit again to exit, anything else to go back: ") == "exit": close_game() else: msg = "Invalid Input" if (msg): timed_print(msg, 3)
def systest(): screen_clear() print("This is a system test. Report to devs if any errors are shown.") if input("Enter to Start systest") == "skip": return print() print("You will be shown a map. This test will be a success if you can see the map. Close the map to continue...") input("Enter to continue") makemap(Rotunda) print("makemap success") print() print("You will be shown an image. This test will be a success if you can see the image. Close the image to continue...") input("Enter to continue") im_show("owl.jpg") print("im_show success") print() print("You will be asked to save a file. Success if file is saved correctly") input("Enter to continue") if copyFile("test.txt"): print("copyFile success") else: print("copyFile fail") print() print("You will be redirected to a test site") input("Enter to continue") opensite("test.html") print("If website shown correctly, opensite success") print() input("This concludes systest. Enter to continue")
def show(self): screen_clear() print("This is your pocket: ") print() for i in self.contents: print(i) print() input("Enter to close")
def search(self): """Search for unhidden Notes Returns: None """ timed_print("Searching", randint(3, 7)) if len([i for i in self.notes if not i.hidden]) == 0: return "Nothing here" else: for i in self.notes: screen_clear() i.show() print() input("Press Enter to continue searching") return "Nothing else here!"
def show(self): print(self) if (self.action is not None and input("Do you want to check it out[Y N]? ") == "Y"): while True: screen_clear() if (self.action()): print(self.onComplete) self.hidden = True for i in self.nextnotes: i.hidden = False break else: print(self.onFail) if (input("Try again[Y N]? ") == "N"): break
msg, here = here.goto(new_loc) elif re.search(r"^map$", inp): print("Close map to continue") makemap(here) elif re.search(r"^pocket$", inp): Pocket.show() elif re.search(r"^exit$", inp): if input("Type exit again to exit, anything else to go back: ") == "exit": close_game() else: msg = "Invalid Input" if (msg): timed_print(msg, 3) screen_clear() print(hello_banner) input("Press Enter to start systest") systest() screen_clear() print(""" How to play - Use `ls` or `search` to look around for clues and other helpful items Use `goto location name` or `cd location name` to move to connecting locations Use `map` to open up the map. Note that as you collect more items, new locations open up! Use `pocket` to view a list of items collected. This is very helpful if you get stuck. Go ahead and enjoy! Good Luck! """) input("Press Enter to start the Game!") mainloop()