Advertisement
RemiCraft

Remote Door Client

Jun 28th, 2021 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. --------------------
  3. local doorLocation = "left"
  4. local doorTime = 2
  5. local channel = 20
  6. local modem = peripheral.wrap("back")
  7. --------------------
  8. modem.open(channel)
  9. while true do
  10.  term.clear()
  11.  term.setCursorPos(1, 1)
  12.  print("Enter Password:")
  13.  input = read("*")
  14.  modem.transmit(channel, channel, input)
  15.  local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  16.  if message == "accepted" then
  17.   redstone.setOutput(doorLocation, true)
  18.   sleep(doorTime)
  19.   redstone.setOutput(doorLocation, false)
  20.  end
  21.  
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement