jesusthekiller

Rainbooows

Aug 13th, 2013
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. -- Rainbooows! v2 by Jesusthekiller
  2. -- Do whatever you want, credit is appreciated
  3. local ot = term.write
  4. local oc = term.clear
  5.  
  6. local rainbow = {
  7.     colors.red,
  8.     colors.orange,
  9.     colors.yellow,
  10.     colors.lime,
  11.     colors.green,
  12.     colors.cyan,
  13.     colors.blue,
  14.     colors.purple,
  15. }
  16.  
  17. local pointer = 1
  18.  
  19. local repl = function(text)
  20.     for i = 1, #text do
  21.         local c = text:sub(i,i)
  22.        
  23.         if c == ' ' then
  24.             ot(c)
  25.         else
  26.             term.setTextColor(rainbow[pointer])
  27.             ot(c)
  28.             pointer = pointer >= #rainbow and 1 or pointer + 1
  29.         end
  30.     end
  31. end
  32.  
  33. local crepl = function()
  34.     oc()
  35.     local p = 1
  36.     local x, y = term.getSize()
  37.    
  38.     for i = 1, x + y + 8 do
  39.         paintutils.drawLine(i, 1, 1, i, rainbow[p])
  40.         paintutils.drawLine(i - 8, 1, 1, i - 8, colors.black)
  41.        
  42.         p = p >= #rainbow and 1 or p + 1
  43.        
  44.         if p % 2 == 0 then
  45.             sleep(0.05)
  46.         end
  47.     end
  48.     term.setBackgroundColor(colors.black)
  49.     oc()
  50. end
  51.  
  52. term.write = repl
  53. term.clear = crepl
  54.  
  55. term.setCursorPos(1, 1)
  56. for i = 1, 5*18 do
  57.     write("rainbooows")
  58. end
  59. term.setCursorPos(1, 19)
Advertisement
Add Comment
Please, Sign In to add comment