def Start(): """ Start of game || Sets the room up """ global Plyr, instances print("Objective: Escape the room") print("Commands:") print(" search, take, use, examine, exit") print(" Try 'examine player'") Plyr = Player("Player") # Player Obj Exit = ExitDoor("Door_Exit") # Door_Exit Obj instances.append(Plyr) instances.append(Exit) Bathroom = Room("Bathroom") # Room Obj Plyr.moveTo(Bathroom) instances.append(Bathroom) Cupboard_1 = Storage("Left_Cupboard") # Storage Obj instances.append(Cupboard_1) Cupboard_2 = Storage("Right_Cupboard") # Storage Obj instances.append(Cupboard_2) Cupboard_1.locked = True # Whether its locked or not Cupboard_1.lock_id = 61 # The Id to unlock it Cupboard_2.lock_id = 312 # The Id to unlock it Cupboard_2.locked = True # Whether its locked or not Key_1 = Key("Silver_Key", Cupboard_1.lock_id) # Key Obj instances.append(Key_1) Plyr.inventory.append(Key_1) Key_1.parent = Plyr # The Parent Of The Key Exit.lock_id = 31 # The id to unlock it Exit.locked = True # Whether its locked or not Key_2 = Key("Gold_Key", Exit.lock_id) # Key Obj instances.append(Key_2) Cupboard_1.AddContent(Key_2) Bathroom.AddContent(Cupboard_1) Bathroom.AddContent(Cupboard_2) Bathroom.AddContent(Exit) while True: op = rec() # Output from rec() function if isinstance(op, list): if len(op) >= 2: # String to be executed strng = ("op[0]" + "." + op[1] + "(Plyr, instances)") exec(strng)