Advertisement
osmarks

Door External Terminal

Jan 31st, 2020
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local channel = 22907
  2. local modem = peripheral.find "modem"
  3.  
  4. modem.open(channel)
  5.  
  6. while true do
  7.     term.clear()
  8.     term.setCursorPos(1, 1)
  9.     print "GTech RDS-V2 Door Lock System Terminal"
  10.     write "Passcode: "
  11.     local input = read "*"
  12.     modem.transmit(channel, channel, input)
  13.     parallel.waitForAny(
  14.         function()
  15.             local _, _, channel, reply_channel, message, distance = os.pullEvent "modem_message"
  16.             if distance < 10 then
  17.                 print(message)
  18.                 sleep(5)
  19.             end
  20.         end,
  21.         function()
  22.             sleep(5)
  23.             printError "Connection timed out. Press the Any key to continue."
  24.             os.pullEvent "char"
  25.         end)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement