portablejim

waterTop

Sep 24th, 2015
108
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 piston = "back"
  5. local towerid = "pjwater2"
  6.  
  7. print("Listening on " .. towerid)
  8.  
  9. redstone.setOutput(piston, true)
  10.  
  11. while true do
  12.     event, senderId, message, protocol = os.pullEvent("rednet_message")
  13.     if protocol == towerid then
  14.         if message == "stopWater" then
  15.             print("Stopping water")
  16.             redstone.setOutput(piston, true)
  17.         elseif message == "startWater" then
  18.             print("Starting water")
  19.             redstone.setOutput(piston, false)
  20.         end
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment