Advertisement
Guest User

Untitled

a guest
May 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local modem = peripheral.wrap("top")
  2. rednet.open("top")
  3.  
  4. local monitorID = 15
  5. local isOn = false
  6.  
  7. function WaitAndRelay()
  8.     while true do
  9.         local sender, message = rednet.receive()
  10.        
  11.         if string.find(message, "<on>") and isOn == false then
  12.             redstone.setOutput("front", true)
  13.             print("Received On call")
  14.             isOn = true
  15.         elseif string.find(message, "<off>") and isOn == true then
  16.             redstone.setOutput("front", false)
  17.             print("Received Off call")
  18.             isOn = false
  19.         else   
  20.             print(message)
  21.             rednet.send(monitorID, message)
  22.         end
  23.     end
  24. end
  25.  
  26. WaitAndRelay()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement