Why won't my code run?
MarleyMoyo (0)

import time

print("Welcome to Marley's Escape Game")
time.sleep(1)
health = 100
print("Your health is ", health)

cloth = False
gasoline = False
stick = False

def room_2():
print("You leave the room you're in and enter room 2, in which there is a table with a flask of strong smelling liquid and a lighter next to it. If alcohol this could warm you or you could pour it on the stick, light it and make a torch.")

choice = input("What do you wish to do? n\ 1) Drink the liquid\n 2) Make a fire\n 3) Pick up lighter and the liquid, then leave\n Choice:")
if choice == "1":
print("You drink the liquid and it warms you up, health + 10 ")
print("Your health is", health + 10)
elif choice == "2":
print("You successfully light a fire but burn your hands badly and you need to run them under cold water, health - 10")
print("Your health is", health - 10)
elif choice =="3":
print("You have chosen to take the liquid and lighter and keep moving")
else:
print("You must choose either 1, 2, or 3")
intro()

def intro(health,cloth,gasoline,stick) :
print("You wake up from a deep sleep and find yourself in a dark room in what seems to be an abandoned factory of sorts. All you can see is a piece of cloth on the floor, a large stick, some gasoline and a pile of rocks. There is a faint dripping sound off in the distance and it is very cold. You need to escape but you cannot see, what are you going to do?")

choice = input("What do you wish to do? \n 1)Pick up the cloth\n 2)Grab the gasoline\n 3)Pick up the stick\n Choice:")
if choice == "1":
print("You grab the cloth but a rat runs out and attacks you, health - 5")
cloth = True
print ("Your health is", health -5)
print(cloth)
if stick == True and gasoline == True and cloth == True:
print("You have all objects")
room_2()
else:
print("You need more! Go back and collect them")
intro(health,cloth,gasoline,stick)
elif choice == "2":
print('You pick up the gasoline but spill it over yourself, health - 10')

You are viewing a single comment. View All
eankeen (605)

hey!

have you tried calling the function intro or room_2 outside any function bodies? it seems the room_2 has a change of executing only if the function intro is executed. And, conversely, it seems that the intro function has a chance of executing only if the room_2 function is executed. basically, you are not calling the room_2 or intro functions at all. maybe calling one of the functions at the end will fix the problem. if that is not the problem, please provide more detail :)

hope i could help