def change(key): if app.config.has_key(key): value = game.input("Change to: ") # Convert what the user input to the previous value type of the setting keytype = type(app.config[key]) value = keytype(eval(value)) app.config[key] = value game.output("You write %s under %s." % (value, key)) else: game.output("The paper has no field named %s." % key)
def do_shell(self): game.output(self.messages["activate"](me=self.name)) game.output("Type \"done\" to exit.") cmd = None while cmd != "done": if cmd: try: print repr(eval(cmd)) except SyntaxError: try: exec cmd except: traceback.print_exc() except: traceback.print_exc() cmd = game.input(">>> ") game.output(self.messages["deactivate"](me=self.name))