Aug-20-2020, 02:00 PM
(This post was last modified: Aug-20-2020, 02:02 PM by Gribouillis.)
Hello, I am a new coder and am trying to make a short choose-your-own-adventure game in an attempt to learn the basics of python. no matter what i do, though, one of my variables keeps getting read as undefined. i am unsure on how to appropriately fix the issue, and i will paste a segment of the code here for review.
while 4 < 5:
while 5 > 6:
setval = input("What Do you do?")
if setval == 8:
COURSEGET = 1
print("This room is full of star charts and maps")
print("With all of these, you can path your way home!")
print("You return to the main room.")
if setval == 7:
if COURSEGET == 1:
print("You punch in the code for home, and are saved from dying alone in space.")
COURSESET = "true"
else:
print("The Console is awaiting a flight course. You return to the main room")
if setval == 9:
if COURSESET == "true":
print("The Engine room is warm, and humming with energy.")
print("The start button on the engine is glowing red, but you haven't set a course yet.")
print("Better not press it. You return to the main room")
else:
print("You Press the start button on the engines, and the ship Rockets off.")
print("You safely arrive back in federal space, and are welcomed home.")
print("This'll make a helluva story for the kids.")
MAINVAL = "Extra"
if MAINVAL == "Extra":
print("Thank you for playing, please share this little adventure game of mine!")
break
