Sayomie550

Untitled

Jan 17th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local doorSide = "left"
  2. local alarmSide = "top"
  3. local password = "open"
  4. local alarmCode = "stop"
  5. local opentime = 5
  6. local alarm = false
  7.  
  8. while true do
  9.  term.clear()
  10.  term.setCursorPos(1,1)
  11.  write("Password: ")
  12.  local input = read("*")
  13.  if input == password then
  14.   term.clear()
  15.   term.setCursorPos(1,1)
  16.   print("Password correct!")
  17.   rs.setOutput(doorSide,true)
  18.   sleep(opentime)
  19.   rs.setOutput(doorSide,false)
  20.  else
  21.   print("Password incorrect!")
  22.   rs.setOutput(alarmSide,true)
  23.   alarm = true
  24.   sleep(2)
  25.   while alarm == true do
  26.     term.clear()
  27.     term.setCursorPos(1,1)
  28.     write("Alarm Reset Code: ")
  29.     local alarmInput = read("*")
  30.     if alarmInput == alarmCode then
  31.         rs.setOutput(alarmSide,false)
  32.         alarm = false
  33.         print("Alarm Reset")
  34.         sleep(2)
  35.     end
  36.   end
  37.  end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment