I thought it would be cool to make a text-based adventure game. I am having a problem with a naming error in this block of code:
elif room1_choice1=='Search the room':
print('You have chosen to search the room')
print("As you walk around the room you find a chest that you couldn't see from the doorway")
print('You see only two choices, to attempt to open it or to search the rest of the room')
print("Type 'Attempt to open' to try to open the chest or type 'Keep searching' to continue your search")
room1_chestChoice=input(':')
if room1_chestChoice=='Attempt to open':
print('You heave at the lid with all your strength but fail to open it.')
print('It looks like it is locked and you need a key')
print("Type 'Keep searching' to try and find the key")
room1_chestChoice=input(':')
I get an error at the if in the middle:
Traceback (most recent call last):
File "C:/Users/maxim/PycharmProjects/APCSP project/Prototype 1.py", line 41, in <module>
if room1_chestChoice=='Attempt to open':
NameError: name 'room1_chestChoice' is not defined
Can anyone help?
room1_choice1?