legg0028

mob_farm_receive

Nov 13th, 2022 (edited)
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local modem = peripheral.wrap("back")
  2. modem.open(00005)
  3.  
  4. redstone.setOutput("right",true)
  5.  
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. print("Waiting on message.")
  9.  
  10. while true do
  11.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  12.  
  13.     term.clear()
  14.     term.setCursorPos(1,1)
  15.     print("Message received: "..message)
  16.     print("Channel: "..senderChannel)
  17.  
  18.     if senderChannel == 5 and message == "off" then
  19.         redstone.setOutput("right",false)
  20.     elseif senderChannel == 5 and message == "on" then
  21.         redstone.setOutput("right",true)
  22.     end
  23.     sleep(0.1)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment