legg0028

secret_door_open

Aug 3rd, 2021
784
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local modem = peripheral.wrap("back")
  2. modem.open(00005)
  3.  
  4. redstone.setOutput("top",false)
  5. redstone.setOutput("bottom",false)
  6.  
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print("Waiting on message")
  10.  
  11. while true do
  12.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  13.  
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.     print("Message received: "..message)
  17.     print("Channel: "..senderChannel)
  18.  
  19.     if senderChannel == 5 and message == "open" then
  20.         redstone.setOutput("bottom",true)
  21.         redstone.setOutput("top",true)
  22.         sleep(10)
  23.         redstone.setOutput("bottom",false)
  24.         redstone.setOutput("top",false)
  25.     end
  26.     sleep(0.1)
  27. end
RAW Paste Data