From d1c85a7738456570a394c7c039fc67810de22328 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Wed, 24 Feb 2021 16:14:20 -0500 Subject: [PATCH] Handle commands that dont match existing handlers --- Adventure Game/adventure_game/Handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Adventure Game/adventure_game/Handler.py b/Adventure Game/adventure_game/Handler.py index 6580229..989adea 100644 --- a/Adventure Game/adventure_game/Handler.py +++ b/Adventure Game/adventure_game/Handler.py @@ -59,7 +59,6 @@ class Handler(npyscreen.ButtonPress): room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml') # By now we should be situated in our room, and with our player. - self.parent.parentApp.log.debug(room) # TODO: Should upgrade these to use fuzzy words library! and not direct comparisons! if command == 'LOOK': @@ -75,7 +74,7 @@ class Handler(npyscreen.ButtonPress): except KeyError: self.parent.update_log("Not sure what you're trying to look at.") - if command == 'PICK': + elif command == 'PICK': if arguments[0] == 'UP': if len(arguments) <= 2: # If there are only 2 args ex:up, item then we dont need to merge that last arg try: @@ -91,6 +90,9 @@ class Handler(npyscreen.ButtonPress): self.parent.update_log(room[long_arg.lower()]['pick_up']) except KeyError: self.parent.update_log("You cant pick that up.") + else: + self.parent.parentApp.log.info('Player\'s command was not understood: {0}'.format(command)) + self.parent.update_log('I didn\'t understand {0}'.format(command)) if command == 'WHERE': # TODO: this should take the human readable room name, not the code-name