akihex

flickeringLights

Aug 28th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local order = {#args>0 and tonumber(args[1]) or 1, #args>1 and tonumber(args[2]) or 2}
  4.  
  5. local mon = {}
  6. for _,dev in pairs(peripheral.getNames()) do
  7.   if peripheral.getType(dev) == "monitor" then
  8.     mon[#mon+1] = peripheral.wrap(dev)
  9.   end
  10. end
  11. --peripheral.find("monitor")
  12.  
  13. print(#mon)
  14.  
  15. local l = 1
  16. local col = {colors.lightGray,colors.cyan}
  17.  
  18. local w,h = mon[order[1]].getSize()
  19.  
  20. for _,m in pairs(mon) do m.setBackgroundColor(col[2]) m.clear() end
  21.  
  22. while true do
  23.   mon[order[1]].setBackgroundColor(col[2])
  24.   mon[order[2]].setBackgroundColor(col[2])
  25.   mon[order[1]].clearLine(l)
  26.   mon[order[2]].clearLine(h-l+1)
  27.   mon[order[1]].setBackgroundColor(col[1])
  28.   mon[order[2]].setBackgroundColor(col[1])
  29.   l=1+(l+1)%h
  30.   mon[order[1]].setCursorPos(1,l)
  31.   mon[order[2]].setCursorPos(1,h-l+1)
  32.   for i=1,w do mon[1].write(" ") mon[2].write(" ") end
  33.   sleep(0.1)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment