Savage_Me55iah

SWITCHER PUBLIC

Jul 13th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. --AREA OF ADJUSTMENTS
  2.  
  3. monitor = 1000
  4. sorter = 1001
  5.  
  6. switch = "right"
  7. signal_out = "front"
  8. wireless = "top"
  9.  
  10. reverse = "n"
  11.  
  12. rednet.open(wireless)
  13.  
  14. --DETERMINING WEITHER ITS ALREADY ON--
  15.  
  16. if redstone.getInput(switch) == true and reverse == "n" then
  17.   status = "activated"
  18. else
  19.   status = "deactivated"
  20. end
  21.  
  22. while true do
  23.  
  24.   print("receiving... currently " .. status)
  25.  
  26.   event, id, text = os.pullEvent()
  27.  
  28.   if event == "rednet_message" then
  29.     print("received " .. text)
  30.  
  31.     if text == "switch" and id == monitor then
  32.       redstone.setOutput(signal_out, true)
  33.       sleep(0.2)
  34.       redstone.setOutput(signal_out, false)
  35.       sleep(0.5)
  36.     end
  37.  
  38.     if redstone.getInput(switch) == true and reverse == "n" then
  39.       status = "activated"
  40.     else
  41.       status = "deactivated"
  42.     end    
  43.  
  44.     print(status)
  45.  
  46.     if text == "status update" and id == monitor then
  47.       print(status)
  48.       rednet.send(monitor, status)
  49.     end
  50.   end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment