Advertisement
Poppamunz

DB Lock ComputerCraft

Aug 24th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local side = "right"
  2. local riddle = "What is life's greatest illusion?"
  3. local password = "Innocence, my brother."
  4. local opentime = 3
  5. local pullEvent = os.pullEvent
  6. os.pullEvent = os.pullEventRaw
  7. while true do
  8.  term.clear()
  9.  term.setCursorPos(1,1)
  10.  write(riddle)
  11.  term.setCursorPos(1,2)
  12.  write("Answer: ")
  13.  local input = read("*")
  14.  if rs.getInput("front") == true then
  15.   term.clear()
  16.   term.setCursorPos(1,1)
  17.   print("Override successful. Welcome.")
  18.   rs.setOutput(side,true)
  19.   os.pullEvent = pullEvent
  20.   sleep(opentime) -- Wait the amount of seconds you specifed, then..
  21.   os.pullEvent = os.pullEventRaw
  22.   rs.setOutput(side,false)
  23.  elseif input == password then
  24.   term.clear()
  25.   term.setCursorPos(1,1)
  26.   print("Welcome.")
  27.   rs.setOutput(side,true)
  28.   sleep(opentime) -- Wait the amount of seconds you specifed, then..
  29.   rs.setOutput(side,false)
  30.  else
  31.   print("Incorrect. Leave at once!")
  32.   sleep(2) -- Waits 2 seconds
  33.  end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement