Posted 28 January 2013 - 01:13 PM
I cant get this to work as soon as the first incorrect pass is typed it says the right text but then the program ends so if you can please help me
here it is
os.shutdown = os.shutdown
rednet.open("back")
os.pullEvent = os.pullEventRaw
local mon = peripheral.wrap("top")
i = 0
local alarm = false
local door = false
mon.clear()
mon.setTextScale(1)
mon.setCursorPos(1,1)
mon.write("Welcome to TyCo's")
mon.setCursorPos(1,3)
mon.write("CC store")
while door == false do
term.clear()
term.setCursorPos(14,1)
print("Welcome to Temporary Tyco")
term.setCursorPos(1,3)
term.write("Please Enter Password:")
pass = read("*")
if pass == "inside" then
term.setCursorPos(16,7)
print("Password Authorized")
redstone.setOutput("right", true)
sleep(5)
redstone.setOutput("right", false)
else
if pass == "computers" then
print("Welcome Admin")
door = true
else
if pass == "leave" then
redstone.setOutput("right", true)
sleep(5)
redstone.setOutput("right", false)
else
i = i + 1
while alarm == false do
if (i == 1) then
print("Incorrect 2 more trys")
alarm = true
end
if (i == 2) then
print("Incorrect 1 more try")
alarm = true
end
if (i == 3) then
print("Alarm Activated")
print("Administrator is being advised")
rednet.send(id, "alarm")
alarm = true
end
end
end
end
end
end
here it is
os.shutdown = os.shutdown
rednet.open("back")
os.pullEvent = os.pullEventRaw
local mon = peripheral.wrap("top")
i = 0
local alarm = false
local door = false
mon.clear()
mon.setTextScale(1)
mon.setCursorPos(1,1)
mon.write("Welcome to TyCo's")
mon.setCursorPos(1,3)
mon.write("CC store")
while door == false do
term.clear()
term.setCursorPos(14,1)
print("Welcome to Temporary Tyco")
term.setCursorPos(1,3)
term.write("Please Enter Password:")
pass = read("*")
if pass == "inside" then
term.setCursorPos(16,7)
print("Password Authorized")
redstone.setOutput("right", true)
sleep(5)
redstone.setOutput("right", false)
else
if pass == "computers" then
print("Welcome Admin")
door = true
else
if pass == "leave" then
redstone.setOutput("right", true)
sleep(5)
redstone.setOutput("right", false)
else
i = i + 1
while alarm == false do
if (i == 1) then
print("Incorrect 2 more trys")
alarm = true
end
if (i == 2) then
print("Incorrect 1 more try")
alarm = true
end
if (i == 3) then
print("Alarm Activated")
print("Administrator is being advised")
rednet.send(id, "alarm")
alarm = true
end
end
end
end
end
end