Advertisement
buzzbumble

MC DoorSwitch

Dec 13th, 2020 (edited)
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. rednet.open("top")
  2.  
  3. front = rs.getInput("Front")
  4. left = rs.getInput("Left")
  5.  
  6. function XORSwitches(a, b)
  7. if (a and b) then
  8. return false
  9. elseif (a or b) then
  10. return true
  11. else
  12. return false
  13. end
  14. end
  15.  
  16. while (true) do
  17. os.pullEvent("redstone")
  18. front = rs.getInput("Front")
  19. left = rs.getInput("Left")
  20. state = XORSwitches(front, left)
  21. if (state) then
  22. rednet.broadcast("closeDoor")
  23. else
  24. rednet.broadcast("openDoor")
  25. end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement