Posted 16 January 2015 - 08:19 PM
Password Redstone Control
This can be used for a locking door with a password.
And many other things.
Code:
term.clear()
term.setCursorPos(1, 1)
os.pullEvent = os.pullEventRaw
local cPrint = function(text)
local x2,y2 = term.getCursorPos()
local x,y = term.getSize()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
cPrint ("Hello please enter your password!")
pass = io.read()
if pass == "Change_This_With_The_Password_You_Want" then
redstone.setOutput ("back", true )
textutils.slowPrint ("The password is correct.")
textutils.slowPrint ("The door opens.")
sleep(5)
redstone.setOutput ("back", false )
else
textutils.slowPrint ("The password is incorrect.")
textutils.slowPrint ("The door will not open.")
sleep(2)
end
shell.run("door")