Posted 25 March 2012 - 09:24 AM
ok i got a simple door lock code that i upgraded to use pcall to prevent ctrl t from bypassing the lock, but now it will not unlock for the correct password. Also in some cases the ctrl t will terminate the programm. i'm a noob at lua and computercraft programming so do explain if you help.
local pass = "pass"
local side = "left"
while true do
term.clear()
term.setCursorPos(1,1)
term.write("Password: ")
local imput = pcall(read, "x")
if imput == pass then
print("unlocked")
redstone.setOutput(side,true)
pcall(sleep, 5)
redstone.setOutput(side,false)
else
if imput == ("TERMINATED") then
term.clear()
term.setCursorPos(1,1)
print("access denied")
pcall(sleep, 10)
end
print("Incorrect")
pcall(sleep, 5)
end
end