This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Demonic Wolf's profile picture

lock code

Started by Demonic Wolf, 15 September 2012 - 12:10 PM
Demonic Wolf #1
Posted 15 September 2012 - 02:10 PM
Hello all, Demonic Wolf here and i love cc but i suck at codeing i was wonder if some one could help me, and wright me a code fot a lock that when the wrong PW in entered 3 time it sends out a diffrent redstone signal then the one for the door.

here the code im useing now


os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(1, 1)
print("Please Enter Password:")
input = read("*")
if input == "password" then
  redstone.setOutput("back", true)
  sleep(2)
  redstone.setOutput("back", false)
end
end

sjele #2
Posted 15 September 2012 - 04:32 PM
os.pullEvent = os.pullEventRawpassword = "You're pw" --Passwordtry = 3  --Number of tryesattemps = truewhile attemps dowrite("Password: ")temp = read()if temp == password thenrs.setOutput("back", true) --Side of doorsleep(3)rs.setOutput("back", true) --Side of doorelsetry = try -1if try == 0 thenattemps = falsers.setOutput("left", true) --Side for other outputsleep(3)rs.setOutput("left", false) --Side for other outputendendendos.shutdown()
Thsi should work. Not tested