Posted 26 July 2012 - 01:56 PM
So i have been trying to make a hotel, and i want a computer at each lvl to open the correct door, here is the code for first floor with rooms. But i get the error stated in the title. So i would like some help as this is my first "big" programming, my highest before this was 15. I'm sorry i forgot line jumps inbetween each part of code. Program is called context, beacuse this is my first time using this program to code.
It would be nice if you could spot any other error for me to :)/>/>
It would be nice if you could spot any other error for me to :)/>/>
os.pullEvent = os.pullEventRaw
print("Loadning")
sleep(2)
print("----------------------")
print("Done loading")
print("Press E to continue")
local event, param = os.pullEvent("char")
param = "e"
if true then
print("Choose a number between 1-5")
write("Insert number: ")
input = read()
end
door1 = "1"
door2 = "2"
door3 = "3"
door4 = "4"
door5 = "5"
yes = "yes"
no = "no"
if input == door1 then
print("1 is chosen")
print("Door is opening")
rs.setBundledOutput ("back", colors.red)
sleep(5)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
end
elseif input == door2 then
print("2 is chosen")
print("Door is opening")
rs.setBundledOutput ("back", colors.yellow)
sleep(5)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
end
elseif input == door3 then
print("3 is chosen")
print("Door is opening")
rs.setBundledOutput ("back", colors.blue)
sleep(5)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
end
elseif input == door4 then
print("4 is chosen")
print("Door is opening")
rs.setBundledOutput ("back", colors.lime)
sleep(5)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
end
elseif input == door5 then
print("5 is chosen")
print("Door is opening")
rs.setBundledOutput ("back", colors.black)
sleep(5)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
end
else
print("Wrong door number, no door is opening!")
sleep(3)
print("Is this understood")
write("yes or no: ")
input = read()
if input == yes then
print("Remember to use correct room number next time")
sleep(3)
print("Door selector is restarting! This will take a few seconds")
sleep(2)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
elseif input == no then
print("I'll take it as a yes")
sleep(3)
print("Door selector is restarting! This will take a few seconds")
sleep(2)
term.clear()
term.setCursorPos(1,1)
shell.run(context)
end