Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Glow script question ?

Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
06-29-2008 22:33
Hey I was wondering if possible to make a scrit that make a glow slowly lower the intensity and then rise up again. for make a effect of pulse any1 know if that possible and can help me with that plz Thx for any help ^^
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-29-2008 22:54
Of course it is. If you aren't on 1.20.x you'll need to define the constant:

CODE

// If the next line generates an error, comment it out. You are on a viewer with PRIM_GLOW pre-defined.
integer PRIM_GLOW = 25;


Then you can set the prim's glow (or that of a single face by replacing ALL_SiDES with the face number) using:

CODE

llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, intensity ]);


where 'intensity' is a floating point number between 0.0 and 1.0. See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams
Shaden Sura
Registered User
Join date: 10 Oct 2006
Posts: 68
06-29-2008 23:24
T-T I cant make it work can you gime a example script for it
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-29-2008 23:41
Okay. If this doesn't work for you, you'll have to figure out what kind of fading to implement yourself, but here's one that should be pretty gradual.

(NOTE: Hasn't yet been compiled; may need a a couple minor syntax fixes.)
CODE

// If the next line errors, comment it out; your viewer has PRIM_GLOW pre-defined
integer PRIM_GLOW = 25;

float FADE_PERIOD = 6.0;
float TIMER_PERIOD = 0.25;

float MIN_GLOW = 0.0;
float MAX_GLOW = 1.0;

float glowAtTime(float t)
{
float midPoint = 0.5*(MAX_GLOW+MIN_GLOW);
float amplitude = 0.5*(MAX_GLOW-MIN_GLOW);

return midPoint+amplitude*llSin(TWO_PI*t/FADE_PERIOD);
}

default
{
state_entry()
{
llSetTimerEvent(TIMER_PERIOD);
}

timer()
{
float glow = glowAtTime(llGetTime());
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, glow ]);
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-29-2008 23:44
Note that you could probably also do this using an animated texture that fades from black to the desired color and back. You could set the glow, set the animated texture, then the script wouldn't be needed. This approach would be a lot more friendly on the sim, too. The downside is that any transparent particles or surfaces in front of the prim will cause a glow.