scriding

IlluminatorSetColorRGB

Feb 1st, 2021 (edited)
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --This program asks for RGB values and sets a Glowstone Illuminator, that placed on top of the computer, to the color entered.  It keeps setting the color every 1.5 seconds until terminated.  This way you don't have to keep entering values and can change the color of a bunch at once.
  2.  
  3. r = 0        
  4. g = 0
  5. b = 0
  6. c = peripheral.wrap("top")
  7.  
  8.  
  9. term.clear()
  10. term.setCursorPos(1,1)
  11.    
  12. print("Enter RED value (0-255): ")
  13. r = tonumber(read())
  14.    
  15. print("Enter GREEN value (0-255): ")
  16. g = tonumber(read())
  17.    
  18. print("Enter BLUE value (0-255): ")
  19. b = tonumber(read())
  20.    
  21.    
  22.         form = string.format("%02x%02x%02x", r, g, b)
  23.         sub = string.gsub(form, ", ", "")
  24.         dec = tonumber(sub, 16)
  25.        
  26. while true do
  27.         c.setColor(dec)
  28.         sleep(1.5)
  29. end
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
Add Comment
Please, Sign In to add comment