Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Client sided XMAS lights

White Platini
DNA Fusion
Join date: 12 Jan 2005
Posts: 51
12-14-2005 18:08
Since long ago I wanted to contibute to this place with somethins so here it is:
CODE

// Random XMAS Light script:
//
// This script picks a random color from a list then uses a specialtexture and the
// animation command to make it blink, this metod reduces the load of the server
// since the animations are done client sided.
//
// By White Platini

float time; //blink of the light, must be betwen 1.0 - 2.0
vector light_color; //color of the light.
list colors = [<1,1,1>, <0.16,0.16,0.16>, <1,0,0>, <0,1,0>, <0,0,1>, <114.000000, 178.000000, 66.000000>, <0.917647, 0.917647, 0.000000>, <1.000000, 0.501961, 0.000000>, <0.541176, 0.070588, 0.952941>, <1.000000, 0.576471, 1.000000>, <0.000000, 0.501961, 1.000000>];

default
{
state_entry()
{
//Get a color from the list
light_color = (vector)llList2String(colors, (integer)llFrand(llGetListLength(colors)));

//Get random time
time = (llFrand(10) * 0.10) + 1; //time of the light, must be betwen 1.0 - 2.0

//Set the color on the prim
llSetColor(light_color, ALL_SIDES);

//Sets the special texture
llSetTexture("52a9d11c-b0ce-e5f2-2d5b-475ac2400537", ALL_SIDES);

//Engages the blinking animation
llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES,2,1,0,0,1);
}
on_rez(integer blah)
{
llResetScript();
}
}


Hope it can be useful for everyone.
_____________________
-Kaze to issho ni, Mew-
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
12-19-2005 20:08
/54/f8/78424/1.html
_____________________
i've got nothing. ;)