Savage_Me55iah

Switcher public

Jul 17th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   if redstone.getInput(switch) == true then
  18.     status = "activated"
  19.   else
  20.     status = "deactivated"
  21.   end
  22.   else
  23.   if redstone.getInput(switch) == false then
  24.     status = "activated"
  25.   else
  26.     status = "deactivated"
  27.   end
  28. end
  29.  
  30. while true do
  31.  
  32.   print("receiving... currently " .. status)
  33.  
  34.   event, id, text = os.pullEvent()
  35.  
  36.   if event == "rednet_message" then
  37.     print("received " .. text)
  38.  
  39.     if text == "switch" and id == monitor then
  40.       redstone.setOutput(signal_out, true)
  41.       sleep(0.2)
  42.       redstone.setOutput(signal_out, false)
  43.       sleep(0.5)
  44.     end
  45.  
  46.  
  47. if redstone.getInput(switch) == true and reverse == "n" then
  48.   if redstone.getInput(switch) == true then
  49.     status = "activated"
  50.   else
  51.     status = "deactivated"
  52.   end
  53.   else
  54.   if redstone.getInput(switch) == false then
  55.     status = "activated"
  56.   else
  57.     status = "deactivated"
  58.   end
  59. end  
  60.  
  61.     print(status)
  62.  
  63.     if text == "status update" and id == monitor then
  64.       print(status)
  65.       rednet.send(monitor, status)
  66.     end
  67.   end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment