Advertisement
QarthO

CC: Botania Dandelifeon Reciever

May 10th, 2022 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local channel = 69
  2.  
  3. local Peripherals = {
  4.     MODEM = "top",
  5.     DANDELIFEON = "bottom"
  6. }
  7.  
  8. modem = peripheral.wrap(Peripherals.MODEM)
  9.  
  10. local e, side, ch, replyCh, msg, dist
  11.  
  12. local function listen()
  13.     modem.open(channel)
  14.     e, side, ch, replyCh, msg, dist = os.pullEvent("modem_message")
  15.     if ch == channel then
  16.         return true
  17.     end
  18.     return false
  19. end
  20.  
  21. local function main()
  22.     if listen() then
  23.         if msg == "on" then
  24.             redstone.setOutput("bottom", true)
  25.         elseif msg == "off" then
  26.             redstone.setOutput("bottom", false)
  27.         end
  28.     end
  29. end
  30.  
  31. while true do
  32.     main()
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement