SHOW:
|
|
- or go back to the newest paste.
| 1 | send = function() | |
| 2 | while not redstone.getInput("top") do
| |
| 3 | os.queueEvent("randomEvent")
| |
| 4 | os.pullEvent() | |
| 5 | end | |
| 6 | - | print("yes")
|
| 6 | + | |
| 7 | - | redstone.setOutput("left", true)
|
| 7 | + | |
| 8 | - | os.sleep(1) |
| 8 | + | recieve = function() |
| 9 | - | redstone.setOutput("left", false)
|
| 9 | + | while not redstone.getInput("right") do
|
| 10 | - | if redstone.getInput("left") then
|
| 10 | + | |
| 11 | os.pullEvent() | |
| 12 | - | os.sleep(10) |
| 12 | + | |
| 13 | end | |
| 14 | ||
| 15 | - | os.sleep(10) |
| 15 | + | |
| 16 | sleep = function() | |
| 17 | os.sleep(7) | |
| 18 | end | |
| 19 | ||
| 20 | signal = function() | |
| 21 | while not redstone.getInput("top") do
| |
| 22 | os.queueEvent("randomEvent")
| |
| 23 | os.pullEvent() | |
| 24 | end | |
| 25 | end | |
| 26 | ||
| 27 | ||
| 28 | while true do | |
| 29 | ||
| 30 | yes = parallel.waitForAny(send, recieve) | |
| 31 | redstone.setOutput("right", false)
| |
| 32 | ||
| 33 | if yes == 1 then | |
| 34 | redstone.setOutput("right", true)
| |
| 35 | os.sleep(1) | |
| 36 | redstone.setOutput("right", false)
| |
| 37 | while yes == 1 do | |
| 38 | yes = parallel.waitForAny(signal, sleep) | |
| 39 | end | |
| 40 | else | |
| 41 | redstone.setOutput("left", true)
| |
| 42 | os.sleep(3) | |
| 43 | yes = 1 | |
| 44 | while yes == 1 do | |
| 45 | yes = parallel.waitForAny(signal, sleep) | |
| 46 | end | |
| 47 | redstone.setOutput("left", false)
| |
| 48 | end | |
| 49 | ||
| 50 | end |