Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Turn light efex on and off

Jennyfer Voom
Registered User
Join date: 18 Apr 2007
Posts: 8
06-06-2007 14:26
this may be a very basic question ... but i haven been able to find the answer ... so i hope someone can help me

I have a small lamp that i can turn on and off ... the prim with the light change as i shud (changing tektures) ... but the light efect stay ..so it glows even when off

How do i set/chage the light (intensity,radius,falloff) so it will when the lamp is on and of ??
Jake Trenchard
Registered User
Join date: 31 May 2007
Posts: 104
06-06-2007 14:32
With llPrimitiveParams and PRIM_POINT_LIGHT
Jeff Kelley
Registered User
Join date: 8 Nov 2006
Posts: 223
06-06-2007 14:36
Changing texture and changing light are two different things.
Textures are used to simulate a light bulb or beam, but it doen's emit light per se. You have to turn both on and off (llSetTexture + llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE/FALSE, vector color, float intensity, float radius, float falloff])
Jennyfer Voom
Registered User
Join date: 18 Apr 2007
Posts: 8
06-06-2007 14:48
Thanks ...

So if i understand right


if(message=="light off";)
{
llSetTexture("clear_texture",ALL_SIDES);
llSetPrimitiveParams(PRIM_POINT_LIGHT, FALSE, 0 , 0 , 0 , 0 )
// Set lamp off
}
else if(message == "light on";)
{
llSetTexture("light_texture",ALL_SIDES);
llSetPrimitiveParams(PRIM_POINT_LIGHT, TRUE, 1 , 1 , 1 , 1 )
// Set lamp off
}


shud do it ??

Ill ive it a try
Jake Trenchard
Registered User
Join date: 31 May 2007
Posts: 104
06-06-2007 15:14
No, you have to match the argument types.
PRIM_POINT_LIGHT, TRUE/FALSE, vector color, float intensity, float radius, float falloff
And you need to send it as a list to llSetPrimitiveParams.

So you need,
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1,1,1>, 1.0, 1.0, 1.0]);

The square brackets are needed there, and maybe the compiler just hates me, but I have to
specify '1.0' to get a float in certain cases involving list passing like this. Otherwise it throws
errors at me.