csmit195

ComputerCraft Insane Crapload of Monitors

Jun 18th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. local wrappedMonitors = {}
  2. local temp = {}
  3. temp.modem = peripheral.wrap('back')
  4. temp.order, temp.maxW, temp.maxH, temp.blitString, temp.colorString, temp.backgroundString = false, 0, 0, '', '', ''
  5.  
  6. function initiate()
  7.     for i, rawMonitor in ipairs(temp.modem.getNamesRemote()) do
  8.         if ( peripheral.getType(rawMonitor) == 'monitor' ) then
  9.             wrappedMonitors[i] = peripheral.wrap(rawMonitor)
  10.             wrappedMonitors[i].setTextScale(0.5)
  11.             local sizeW, sizeH = wrappedMonitors[i].getSize()
  12.             temp.maxW, temp.maxH = math.max(temp.maxW, sizeW), math.max(temp.maxH, sizeH)
  13.         end
  14.     end
  15.     for i=0, temp.maxW*2 do
  16.         temp.blitString, temp.colorString, temp.backgroundString = temp.blitString .. (temp.order and math.random(1, 9) or math.random(1, 9)), temp.colorString .. (temp.order and math.random(1, 9) or math.random(1, 9)), temp.backgroundString .. math.random(1, 9)
  17.         temp.order = not temp.order
  18.     end
  19.     loop(temp.blitString, temp.colorString, temp.backgroundString, temp.maxH, false)
  20. end
  21.  
  22. function loop(blitString, colorString, backgroundString, maxH)
  23.     temp = nil
  24.     local order
  25.     while ( true ) do
  26.         for i, m in ipairs(wrappedMonitors) do
  27.             for i=0, maxH do
  28.                 m.setCursorPos(0-math.random(i,#colorString), i)
  29.                 m.blit(blitString, (order and colorString or backgroundString), (order and backgroundString or colorString))
  30.             end
  31.             sleep(0.05)
  32.         end
  33.         order = not order
  34.         sleep(0.3)
  35.     end
  36. end
  37.  
  38. initiate()
Advertisement
Add Comment
Please, Sign In to add comment