Posted 22 January 2013 - 07:24 AM
This is a simple door lock program that I wrote that displays "Password Correct/Incorrect" on the monitor after typing the password and then opens the door. All feedback and comments are welcome.
Also you may insert this at the top of the code to disable the ability for the program to be terminated with CTRL - T. This is most useful in SMP.
and finally here is the program
http://pastebin.com/57Qqy1K0
RUN THE COMMAND:
pastebin get 57Qqy1K0 (chosen filename)
TO INSTALL THE PROGRAM TO A COMPUTER IN MINECRAFT WHILE PLAYING MINECRAFT!!!
Also you may insert this at the top of the code to disable the ability for the program to be terminated with CTRL - T. This is most useful in SMP.
local.pullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
then you can run os. pullEvent = pullEvent
to re-enable terminating of the programand finally here is the program
http://pastebin.com/57Qqy1K0
RUN THE COMMAND:
pastebin get 57Qqy1K0 (chosen filename)
TO INSTALL THE PROGRAM TO A COMPUTER IN MINECRAFT WHILE PLAYING MINECRAFT!!!
local side = "left"
local password = "password"
local opentime = 3
while true do
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
local monitor = peripheral.wrap("right")
term.redirect( monitor)
print("Password Correct!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
term.restore()
rs.setOutput(side,true)
sleep(opentime)
rs.setOutput(side,false)
term.clear()
term.setCursorPos(1,1)
else
local monitor = peripheral.wrap("right")
term.redirect( monitor)
print("Password Incorrect!")
sleep(2)
term.clear()
term.setCursorPos(1,1)
term.restore()
sleep(2)
term.clear()
term.setCursorPos(1,1)
end
end