Advertisement
AlexOfKing

ComputerWirelessBios.lua

May 3rd, 2020
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. local function proxy(componentType)
  2.     local address = component.list(componentType)()
  3.     return address and component.proxy(address) or error("No component " .. componentType)
  4. end
  5. local modem, gpu = proxy("modem"), proxy("gpu")
  6. local x, y = 1, 1
  7.  
  8. local function sleep(timeout)
  9.     local deadline = computer.uptime() + timeout
  10.     repeat
  11.         computer.pullSignal(deadline - computer.uptime())
  12.     until computer.uptime() >= deadline
  13. end
  14.  
  15. function start()
  16.   modem.open(2807)
  17.   modem.open(6791)
  18.   modem.open(7000)
  19.   modem.setWakeMessage('')
  20.   modem.setStrength(50000)
  21. end
  22.  
  23. function wakeup()
  24.   modem.broadcast(2807, '')
  25.   modem.broadcast(6791, '')
  26. end
  27.  
  28. function clear()
  29.  gpu.fill(1,1, 160, 50, ' ')
  30. end
  31.  
  32. start()
  33. clear()
  34. while true do
  35. wakeup()
  36. e, _, _, port, _, msg = computer.pullSignal("modem_message")
  37.     if msg ~= '' and port == 7000 then
  38.         if y == 50 then
  39.         clear()
  40.         y = 1
  41.         gpu.set(x, y, msg)
  42.         else
  43.         gpu.set(x, y, msg)
  44.         y = y+1
  45.         end
  46.     end
  47. sleep(.5)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement