Handle commands that dont match existing handlers

This commit is contained in:
Joe S 2021-02-24 16:14:20 -05:00
parent 1c4f962201
commit d1c85a7738
1 changed files with 4 additions and 2 deletions

View File

@ -59,7 +59,6 @@ class Handler(npyscreen.ButtonPress):
room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml') room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml')
# By now we should be situated in our room, and with our player. # 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! # TODO: Should upgrade these to use fuzzy words library! and not direct comparisons!
if command == 'LOOK': if command == 'LOOK':
@ -75,7 +74,7 @@ class Handler(npyscreen.ButtonPress):
except KeyError: except KeyError:
self.parent.update_log("Not sure what you're trying to look at.") self.parent.update_log("Not sure what you're trying to look at.")
if command == 'PICK': elif command == 'PICK':
if arguments[0] == 'UP': 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 if len(arguments) <= 2: # If there are only 2 args ex:up, item then we dont need to merge that last arg
try: try:
@ -91,6 +90,9 @@ class Handler(npyscreen.ButtonPress):
self.parent.update_log(room[long_arg.lower()]['pick_up']) self.parent.update_log(room[long_arg.lower()]['pick_up'])
except KeyError: except KeyError:
self.parent.update_log("You cant pick that up.") 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': if command == 'WHERE':
# TODO: this should take the human readable room name, not the code-name # TODO: this should take the human readable room name, not the code-name