Advertisement
Lanzr

shaftElevatorTop

Oct 31st, 2023 (edited)
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local modem = peripheral.find("modem")
  2. if (modem == nil) then
  3.     print("no modem link")
  4.     return
  5. end
  6. modem.open(0)
  7.  
  8. local upState = false
  9. local function switch()
  10.     redstone.setOutput("top",upState)
  11.     upState = ~upState
  12. end
  13.  
  14. local function redstoneCheck()
  15. while true do
  16.     os.pullEvent("redstone")
  17.     printf("redstone")
  18.     switch()
  19. end
  20. end
  21.  
  22. local function modemcheck()
  23. while true do
  24.     local event, modemSide, senderChannel,
  25.         replyChannel, message, senderDistance = os.pullEvent("modem_message")
  26.     switch()
  27.     printf("modem")
  28. end
  29. end
  30.  
  31. parallel.waitForAny(redstoneCheck,modemcheck)
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement