scriding

Rainbow Illumintator

Jan 20th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. r = 255              --Starts at pure RED
  2. g = 0
  3. b = 0
  4. c = peripheral.wrap("top")
  5.  
  6. t = 1
  7.  
  8. while t == 1 do
  9.  
  10. repeat  --this loop goes 0-255 in Green
  11.  
  12.         form = string.format("%02x%02x%02x", r, g, b)
  13.         sub = string.gsub(form, ", ", "")
  14.         dec = tonumber(sub, 16)
  15.         c.setColor(dec)
  16.  
  17.         g = g + 15
  18.  
  19.         sleep(.05)
  20. until g == 255
  21.  
  22.  
  23.  
  24.  
  25. repeat  --this loop goes from 255-0 in Red
  26.  
  27.         form = string.format("%02x%02x%02x", r, g, b)
  28.         sub = string.gsub(form, ", ", "")
  29.         dec = tonumber(sub, 16)
  30.         c.setColor(dec)
  31.  
  32.         r = r - 15
  33.  
  34.         sleep(.05)
  35. until r == 0
  36.  
  37.  
  38.  
  39.  
  40. repeat  --this loop goes from 0-255 in Blue
  41.  
  42.         form = string.format("%02x%02x%02x", r, g, b)
  43.         sub = string.gsub(form, ", ", "")
  44.         dec = tonumber(sub, 16)
  45.         c.setColor(dec)
  46.  
  47.         b = b + 15
  48.  
  49.         sleep(.05)
  50. until b == 255
  51.  
  52.  
  53.  
  54.  
  55. repeat  --this loop goes from 255-0 in Green
  56.  
  57.         form = string.format("%02x%02x%02x", r, g, b)
  58.         sub = string.gsub(form, ", ", "")
  59.         dec = tonumber(sub, 16)
  60.         c.setColor(dec)
  61.  
  62.         g = g - 15
  63.  
  64.         sleep(.05)
  65. until g == 0
  66.  
  67.  
  68.  
  69.  
  70. repeat  --this loop goes from 0-255 in Red
  71.  
  72.         form = string.format("%02x%02x%02x", r, g, b)
  73.         sub = string.gsub(form, ", ", "")
  74.         dec = tonumber(sub, 16)
  75.         c.setColor(dec)
  76.  
  77.         r = r + 15
  78.  
  79.     sleep(.05)
  80. until r == 255
  81.  
  82.  
  83.  
  84.  
  85. repeat  --this loop goes from 255-0 in Blue
  86.  
  87.         form = string.format("%02x%02x%02x", r, g, b)
  88.         sub = string.gsub(form, ", ", "")
  89.         dec = tonumber(sub, 16)
  90.         c.setColor(dec)
  91.  
  92.         b = b - 15
  93.  
  94.         sleep(.05)
  95. until b == 0
  96.  
  97. end
  98.  
  99.  
  100.  
  101.  
Advertisement
Add Comment
Please, Sign In to add comment