Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vector red = <1,0,0>;
  2. vector green = <0,1,0>;
  3. vector blue = <0,0,1>;
  4.  
  5. float rate = 0.05;
  6. float speed = 0.2;
  7. integer switch1 = 1;
  8. integer switch2 = 2;
  9. integer switch3 = 3;
  10. integer switch4 = 4;
  11. integer switch5 = 5;
  12. integer switch6 = 6;
  13. integer switch = -1;
  14. integer currentFade = 1;
  15.  
  16. vector ColorCube(vector currColor)
  17. {
  18.     if (currColor.x < 0)
  19.         currColor.x = 0;
  20.     if (currColor.y < 0)
  21.         currColor.y = 0;
  22.     if (currColor.z < 0)
  23.         currColor.z = 0;
  24.    
  25.     // From red to yellow
  26.     if ( currentFade == switch1 && currColor.y < 1.0 )
  27.         return (currColor + <0,rate,0>);
  28.     else if( currentFade == switch1 && currColor.y >= 1.0 )
  29.         currentFade = switch2;
  30.        
  31.     // From yellow to green
  32.     if ( currentFade == switch2 && currColor.x > 0.0 )
  33.         return (currColor - <rate, 0, 0>);
  34.     else if( currentFade == switch2 && currColor.x <= 0.0 )
  35.         currentFade = switch3;
  36.    
  37.     // From green to blue/green
  38.     if ( currentFade == switch3 && currColor.z < 1.0 )
  39.         return (currColor + <0, 0, rate>);
  40.     else if( currentFade == switch3 && currColor.z >= 1.0 )
  41.         currentFade = switch4;
  42.    
  43.     // From blue/green to blue
  44.     if ( currentFade == switch4 && currColor.y > 0.0 )
  45.         return (currColor - <0, rate, 0>);
  46.     else if( currentFade == switch4 && currColor.y <= 0.0 )
  47.     {
  48.         currentFade = switch5;
  49.     }
  50.    
  51.     // From blue to purple
  52.     if ( currentFade == switch5 && currColor.x < 1.0 )
  53.         return (currColor + <rate, 0, 0>);
  54.     else if( currentFade == switch5 && currColor.x >= 1.0)
  55.         currentFade = switch6;
  56.    
  57.     // From purple to red    
  58.     if ( currentFade == switch6 && currColor.z > 0.0 )
  59.         return (currColor - <0, 0, rate>);
  60.     else if( currentFade == switch6 && currColor.z <= 0.0 )
  61.         currentFade = switch1;
  62.  
  63.     return currColor;
  64. }
  65.  
  66. default
  67. {
  68.     state_entry()
  69.     {
  70.        
  71.     }
  72.     on_rez( integer param )
  73.     {
  74.         switch = 1;
  75.         llSetColor( <1,0,0> , ALL_SIDES );
  76.         llSetTimerEvent( speed );
  77.     }
  78.    
  79.  
  80.    
  81.     timer()
  82.     {
  83.         vector color = ColorCube(llGetColor(ALL_SIDES));
  84.         llSetColor(color, ALL_SIDES);
  85.         llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POINT_LIGHT, TRUE, color, 1.0, 10.0, 0.5]);        
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement