Advertisement
goldfiction

glassrednet

Aug 10th, 2023 (edited)
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function findAndWrap(devType)
  2.   local devices = peripheral.getNames()
  3.   for id, devName in pairs(devices) do
  4.     if peripheral.getType(devName) == devType then
  5.       return peripheral.wrap(devName)
  6.     end
  7.   end
  8. end
  9.  
  10. glass = findAndWrap("openperipheral_bridge")
  11. rednet.open("right")
  12.  
  13. function addBox()
  14.  
  15.   glass.addBox(1,1,200,100,0xFFFFFF,0.2)
  16.  
  17. end
  18.  
  19. function timeDis(message)
  20.  
  21.   time = textutils.formatTime(os.time(), false)
  22.  
  23.   glass.addText(5,2, message, 0xFF0000)
  24.  
  25. end
  26.  
  27. function start()
  28.  print("watching rednet messages")
  29.  
  30.  while true do
  31.  
  32.     local senderId, message, protocal = rednet.receive()
  33.  
  34.     glass.clear()
  35.  
  36.     addBox()
  37.  
  38.     timeDis(message)
  39.  
  40.     glass.sync()
  41.  
  42.     sleep(0.1)
  43.  
  44.   end
  45.  
  46. end
  47.  
  48. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement