Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Cycles continuously through a sequence of colors.
- //
- // Written by Boes Spectre
- //
- // = = = = = = = USER VARIABLES = = = = = = = = = =
- // color vectors for your color sequence go here
- // you can use either range, 0.0 to1 1.0 or 0 to1 255
- // You can also mix them of you wish --
- // if any colors are over 1.0 then that color is converted
- list colors =
- [
- <17, 18, 88>,
- <76, 21, 89>,
- <177, 35, 94>,
- <240, 133, 95>,
- <248, 196, 138>,
- <248, 244, 169>
- ];
- // num1ber of steps1 to1 take between colors
- // the more steps1, the more gradual (and slower) the change
- integer steps1 = 15;
- integer steps2 = 30;
- integer steps3 = 45;
- integer steps4 = 60;
- integer steps5 = 25;
- integer steps6 = 50;
- integer steps7 = 75;
- // rate1 at which to1 step
- // (think of this as how long each color step lasts, in seconds)
- // the smaller the num1ber, the faster it goes
- float rate = 0.1;
- // list of face num1bers or ALL_SIDES
- // examples:
- // list faces1 = [ 0, 1, 2, 3, 4, 5 ];
- // list faces1 = [ ALL_SIDES ];
- list faces1 = [ 0 ];
- list faces2 = [ 1 ];
- list faces3 = [ 2 ];
- list faces4 = [ 3 ];
- list faces5 = [ 4 ];
- list faces6 = [ 5 ];
- list faces7 = [ 6 ];
- // = = = = = = = INTERNAL VARIABLES = = = = = = = = = =
- integer index1 = 0;
- integer index2 = 0;
- integer index3 = 0;
- integer index4 = 0;
- integer index5 = 0;
- integer index6 = 0;
- integer index7 = 0;
- integer colornum11 = 0;
- integer colornum12 = 0;
- integer colornum13 = 0;
- integer colornum14 = 0;
- integer colornum15 = 0;
- integer colornum16 = 0;
- integer colornum17 = 0;
- integer colorold1 = 0;
- integer colorold2 = 0;
- integer colorold3 = 0;
- integer colorold4 = 0;
- integer colorold5 = 0;
- integer colorold6 = 0;
- integer colorold7 = 0;
- default
- {
- state_entry ()
- {
- // analyze the colors and normalize (convert 0 - 255 to1 0-1) if needed
- integer i = 0;
- integer length = llGetListLength(colors);
- for (i = 0; i < length; i = i + 1)
- {
- vector color = llList2Vector(colors, i);
- // if any colors are over 1.0, then convert
- if ((color.x > 1.0) || (color.y > 1.0) || (color.z > 1.0))
- {
- colors = llListReplaceList(colors, [color / 255.0], i, i);
- }
- }
- llRegionSay(-3,"colors");
- // start the clock ticking
- llSetTimerEvent (rate);
- llListen(-2,"",NULL_KEY,"");
- }
- listen(integer chan,string name,key id,string msg)
- {
- if(llGetOwner() == llGetOwnerKey(id))
- {
- colors = llCSV2List(msg);
- }
- llOwnerSay("Colors = "+llList2CSV(colors));
- }
- timer ()
- {
- // calc how far along in the sequence
- float percent1 = (float)index1 / steps1;
- float percent2 = (float)index2 / steps2;
- float percent3 = (float)index3 / steps3;
- float percent4 = (float)index4 / steps4;
- float percent5 = (float)index5 / steps5;
- float percent6 = (float)index6 / steps6;
- float percent7 = (float)index7 / steps7;
- // how much of previous color
- vector from1 = llList2Vector (colors, colorold1) * (1.0 - percent1);
- vector from2 = llList2Vector (colors, colorold2) * (1.0 - percent2);
- vector from3 = llList2Vector (colors, colorold3) * (1.0 - percent3);
- vector from4 = llList2Vector (colors, colorold4) * (1.0 - percent4);
- vector from5 = llList2Vector (colors, colorold5) * (1.0 - percent5);
- vector from6 = llList2Vector (colors, colorold6) * (1.0 - percent6);
- vector from7 = llList2Vector (colors, colorold7) * (1.0 - percent7);
- vector to1 = llList2Vector (colors, colornum11) * percent1;
- vector to2 = llList2Vector (colors, colornum12) * percent2;
- vector to3 = llList2Vector (colors, colornum13) * percent3;
- vector to4 = llList2Vector (colors, colornum14) * percent4;
- vector to5 = llList2Vector (colors, colornum15) * percent5;
- vector to6 = llList2Vector (colors, colornum16) * percent6;
- vector to7 = llList2Vector (colors, colornum17) * percent7;
- integer num1 = llGetListLength (faces1);
- integer num2 = llGetListLength (faces2);
- integer num3 = llGetListLength (faces3);
- integer num4 = llGetListLength (faces4);
- integer num5 = llGetListLength (faces5);
- integer num6 = llGetListLength (faces6);
- integer num7 = llGetListLength (faces7);
- integer i1 = 0;
- integer i2 = 0;
- integer i3 = 0;
- integer i4 = 0;
- integer i5 = 0;
- integer i6 = 0;
- integer i7 = 0;
- llSetLinkColor (LINK_THIS,from1 + to1, llList2Integer (faces1, i1));
- llSetLinkColor (LINK_THIS,from2 + to2, llList2Integer (faces2, i2));
- llSetLinkColor (LINK_THIS,from3 + to3, llList2Integer (faces3, i3));
- llSetLinkColor (LINK_THIS,from4 + to4, llList2Integer (faces4, i4));
- llSetLinkColor (LINK_THIS,from5 + to5, llList2Integer (faces5, i5));
- llSetLinkColor (LINK_THIS,from6 + to6, llList2Integer (faces6, i6));
- llSetLinkColor (LINK_THIS,from7 + to7, llList2Integer (faces7, i7));
- llSetLinkColor (2,from1 + to1, llList2Integer (faces3, i1));
- llSetLinkColor (2,from2 + to2, llList2Integer (faces1, i2));
- llSetLinkColor (2,from3 + to3, llList2Integer (faces2, i3));
- llSetLinkColor (2,from4 + to4, llList2Integer (faces4, i4));
- // prepare for next step
- index1 = index1 + 1;
- index2 = index2 + 1;
- index3 = index3 + 1;
- index4 = index4 + 1;
- index5 = index5 + 1;
- index6 = index6 + 1;
- index7 = index7 + 1;
- if (index1 >= steps1) {
- index1 = 0; colorold1=colornum11; colornum11 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- if (index2 >= steps2) {
- index2 = 0; colorold2=colornum12; colornum12 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- if (index3 >= steps3) {
- index3 = 0; colorold3=colornum13; colornum13 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- if (index4 >= steps4) {
- index4 = 0; colorold4=colornum14; colornum14 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- if (index5 >= steps5) {
- index5 = 0; colorold5=colornum15; colornum15 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- if (index6 >= steps6) {
- index6 = 0; colorold6=colornum16; colornum16 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- if (index7 >= steps7) {
- index7 = 0; colorold7=colornum17; colornum17 = llRound(llFrand(llGetListLength(colors)-1.));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement