Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

PrimitiveParamaters

Mimo Vacano
Registered User
Join date: 27 Dec 2006
Posts: 54
01-05-2007 07:38
Newbie to SL and LSL but a long-time programmer. I'm working on some, seemingly, very basic stuff as a learning tool for myself. right now I'm trying to do a simple light switch. My thought was to use llGetPrimitiveParams, toggle the boolean Light parameter and then llSetPrimitiveParams. This would at least be slightly elegant and reusable by changing only the parameter I want to change and preserving the rest in any light fixture. I can turn the light on and off just fine with a constant list of parameters, but displaying the results of llGetPrimitiveParams - I'm SO confused.

The light starts on.

The First llGet looks exactly like the Build Panel for the object, as expected. The light is red with a radius of 1.
list lt = llGetPrimitiveParams([PRIM_POINT_LIGHT]);
Lamp: 1, <1.000000, 0.000000, 0.000000>, 1.000000, 1.000000, 0.750000

the First llSet works exactly as expected and shuts the light off. I can tell that the parameters are all still correct by the features panel in build. Here's the list that gets passed (23 = PRIM_POINT_LIGHT)
Lamp: 23, 0, <1.000000, 0.000000, 0.000000>, 1.000000, 1.000000, 0.750000

The results of the second llGet, however are simply incorrect. It returns a white light with a radius of 10 - regardless of the fact that this is NOT it's current state.
Lamp: 0, <1.000000, 1.000000, 1.000000>, 1.000000, 10.000000, 0.750000

Of course, then, the llSet does turn the light back on, but with these now incorrect parameters as reflected both visually and in the build panel.

Have I hit a bug or am I doing something wrong?

Thanks
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
01-05-2007 08:43
I wonder if a light property of zero (false) negates the other parameters when doing llGetPrimitiveParams. I suggest this because the values you are seeing are the default values when you first check the Light check-box in the features panel.

I think there's a simple workaround. When you detect the light is off and then want to set it on... pass the list you derived from llGetPrimitiveParams when the light was on.

But it does sound like a bug. It means you can't store the light properties in the prim when the light property is set to zero.
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
01-05-2007 08:52
Like Pale, I'm also thinking that setting the point light param to false has negated all the light parameters. Bug? Feature?

I built a light not too long ago and I didn't run into this characteristic because when I turned my light off I just changed the intensity to 0.0 rather than set the point light parameter to false. (I also toggled fullbright on and off depending on the state of the light.)

Thinking in normal terms, the difference might be saying 'this is a light but it's not emitting' rather than saying 'this is no longer a light'.

-Atashi
Mimo Vacano
Registered User
Join date: 27 Dec 2006
Posts: 54
01-05-2007 08:58
Makes perfect sense - I'll bet that's it. Thanks for the insightful analysis!

I don't mind working around these 'features', but I can't stand it when I don't understand why!!