Posted 18 February 2015 - 10:04 PM
Hello, I'm having some trouble with this test program I was writing. I don't really know much about CC so I would appreciate some help :)/>
Whenever I try to run it it works a little bit. It runs the first if statement then if I write enter it runs the "if input == "enter"" code and then ends the whole program. If I type leave it just ends the program without any text. Help is appreciated thank you in advance.
Whenever I try to run it it works a little bit. It runs the first if statement then if I write enter it runs the "if input == "enter"" code and then ends the whole program. If I type leave it just ends the program without any text. Help is appreciated thank you in advance.
term.clear()
term.setCursorPos(1,1)
print("You have found yourself in the middle of the woods. There is a small house in front of you. What will you do?")
print("Enter or leave")
input = io.read()
if input == "enter" then
print("You come closer to the old shack and enter the door, inside you see a chair. What will you do?")
print("Sit in the chair or leave")
if input == "sit" then
print("You have sat down in the chair. You feel comfortable until you start noticing that once you try to get out of the chair, YOU CAN'T!")
print("What will you do now? Scream or try and escape?")
if input == "scream" then
print("You try to scream but nobody hears you")
if input == "escape" then
print("You wiggle and waggle and after minutes of shuffling about you are unstuck from the chair! You can see that the door is still open. What will you do?")
print("Leave or stay in the shack?")
if input == "stay" then
print("You stay in the shack but soon die of starvation. The end. (Ending 2 of 2)")
if input == "stay" then
if input == leave then
print("You have left the house and will die in the woods alone")
print("(Ending 1 of 2)")
end