Want to have a system where it records how many attempts for each room, as well as being able to repeatedly ask for what you want to look at in each room.
I wanted to have something that has a 3 room system, record how many attempts it took to get to the next room, display them at the end, while also asking for if you'd like to continue looking at other things in the room, or try the password and then proceed to the next room. Any feedback welcome, I haven't touched Python in years, it's also a bit silly because his favorite animal is a duck. I'm using Renpy.
This is my code so far:
#escaping the ducks. they are chasing and honking at you. but youre stuck
print("Welcome to your Escape Room! You've entered a room to escape the duck.")
print("It honks angrily.")
r1attempts = 0
r2attempts = 0
r3attempts = 0
#first room has the number 78225, which means quack in numbers
userName = input("Before we get started, whats your name? ")
print("Thank you, " + userName)
print("You enter the first room, where you look around. Theres a few things to see.")
def room1():
print("You can look under the table, at the ceiling, or at the door infront of you. You can also attempt the password.")
print("Which do you choose?")
#this is where i want it to keep asking
def r1pass(p):
password = "78225"
print("You look at the numberpad.")
while (password != p) :
p = input("What is your input? ")
if (password != p ):
print("Incorrect. Please try again.")
r1attempts + 1
return False
elif (password == p):
print("The door creaks open.")
print("It took you " + r1attempts + " to guess the password for Room 1!")
return True
tcde = ['Table', 'Ceiling', 'Door', 'Password']
room1()
choice1 = input("Please type 'Table', 'Ceiling', or 'Door' to look at the respective. Or, you can attempt the password by typing 'Password'. ")
if(choice1 == "Table"):
print("You look at the table. It doesn't seem to have anything but a strange number.")
print("Scratched into the wood, faintly, it looks like 78225")
room1()
elif(choice1 == "Ceiling"):
print("You look at the ceiling. It seems to have a morse code in the popcorn ceiling, if you squint.")
print("It looks like the morse code spells out the numbers 3825. Whatever that means.")
room1()
#Its the numbers for the word Duck!
elif(choice1 == "Door"):
print("You look at the door. It seems to have a numberpad, with letters under each number.")
print("The number pads 4, 6, 5, 3, and 7 seem worn.")
room1()
#This is misleading. whoever was before you tried to enter honker. it didnt work. two of these hints are red herrings.
elif(choice1 == "Password"):
r1pass()
else:
print("That didn't seem to be a valid answer. Please make sure you type the options listed above.")
room1()
#secound room asks how many more pounds of eggs can a duck lay in a year than the best laying chicken breed, which is 18
#third room asks for the player to pick up a golden egg or leave it, if you leave it, youll live and if you pick it up the quacker gets you
Unfortunately, it yeilds result of successfully returning the first wave of asking what choice you want, but gets as far as that and if it asks a secound time, it gives a error message of something like this,
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Ceiling' is not defined
Any help greatly appreciated.