Advertisement
_Jacques

pistonDoor

May 31st, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. arg = {...}
  2. assert(#arg == 2,'usage: pistonDoor <2 pistons signal> <4 pistons signal>')
  3.  
  4. --Send a signal to open the hidden door
  5. function open()
  6.     rs.setOutput(arg[1],false)
  7.     os.sleep(0.3)
  8.     rs.setOutput(arg[2],false)
  9. end
  10. --Send a signal to close it
  11. function close()
  12.     rs.setOutput(arg[2],true)
  13.     os.sleep(0.3)
  14.     rs.setOutput(arg[1],true)
  15. end
  16.  
  17. --Waits for a change in redstone signal, once detected it will send signal to open, wait 4 seconds then close. Defaults to staying closed.
  18.  
  19. close()
  20. while true do
  21.     event = os.pullEvent('redstone')
  22.     open()
  23.     os.sleep(4)
  24.     close()
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement