DrFair

Rednet wireless redstone

Jun 14th, 2013
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. rednet.open("top")
  2. msg = "witherfarm"
  3. side = "bottom"
  4. reversed = true
  5. active = false
  6.  
  7. function update()
  8. if reversed then
  9. rs.setOutput(side,not active)
  10. else
  11. rs.setOutput(side,active)
  12. end
  13. end
  14.  
  15. update()
  16.  
  17. while true do
  18. event,id,message = os.pullEvent()
  19. if event == "rednet_message" then
  20. if message == msg.."on" then
  21. active = true
  22. update()
  23. print("Turned on.")
  24. rednet.broadcast(msg.." on.")
  25. elseif message == msg.."off" then
  26. active = false
  27. update()
  28. print("Turned off.")
  29. rednet.broadcast(msg.." off.")
  30. end
  31. end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment