CobraOs

right

Oct 25th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. send = function()
  2. while not redstone.getInput("top") do
  3.   os.queueEvent("randomEvent")
  4.   os.pullEvent()
  5. end
  6. end
  7.  
  8. recieve = function()
  9. while not redstone.getInput("left") do
  10.   os.queueEvent("randomEvent")
  11.   os.pullEvent()
  12. end
  13. end
  14.  
  15. sleep = function()
  16. os.sleep(7)
  17. end
  18.  
  19. signal = function()
  20. while not redstone.getInput("top") do
  21.   os.queueEvent("randomEvent")
  22.   os.pullEvent()
  23. end
  24. end
  25.  
  26.  
  27. while true do
  28.  
  29. yes = parallel.waitForAny(send, recieve)
  30.  
  31. if yes == 1 then
  32.   redstone.setOutput("left", true)
  33.   os.sleep(1)
  34.   redstone.setOutput("left", false)
  35.   yes = 1
  36.   while yes == 1 do
  37.     yes = parallel.waitForAny(signal, sleep)
  38.   end
  39. else
  40.   redstone.setOutput("right", true)
  41.   os.sleep(3)
  42.   yes = 1
  43.   while yes == 1 do
  44.     yes = parallel.waitForAny(signal, sleep)
  45.   end
  46.   redstone.setOutput("right", false)
  47. end
  48.  
  49. end
Advertisement
Add Comment
Please, Sign In to add comment