jordyvl

Mag card door lock

Aug 16th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local mon = peripheral.wrap("back")
  2. term.redirect(mon)
  3. local status = {"<Enter Card>","<Rejected>","<Granted>"}
  4. local current = 1
  5. local combo = "#1234567890"
  6. local lastTimer
  7. while true do
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. print("Welcome tonIMMIBIS CORP")
  11. print(status[current])
  12. local event,arg1,arg2,arg3 = os.pullEvent()
  13. if event == "timer" and arg1 == lastTimer then
  14.   current = 1
  15.   lastTimer = nil
  16.   rs.setOutput("bottom",false)
  17. elseif event == "mag_swipe" then
  18.   if arg1 == combo then
  19.    lastTimer = os.startTimer(3)
  20.    current = 3
  21.    rs.setOutput("bottom",true)
  22.   else
  23.    lastTimer = os.startTimer(3)
  24.    current = 2
  25.   end
  26. end
  27. end
Add Comment
Please, Sign In to add comment