Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parameters of lights

Karolina Heslop
Registered User
Join date: 28 May 2008
Posts: 8
08-11-2008 05:27
Hello :)
I want to make lights. And next change their parameters, but not all. I want to change only colour or intensity for example. But when i will use llSetPrimitiveParams([PRIM_POINT_LIGHT.......]) i will change all parameters (if i'm right). Can i to change only colour or only intensity ?

Sorry for my english :)
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
08-11-2008 06:24
From: Karolina Heslop
Hello :)
I want to make lights. And next change their parameters, but not all. I want to change only colour or intensity for example. But when i will use llSetPrimitiveParams([PRIM_POINT_LIGHT.......]) i will change all parameters (if i'm right). Can i to change only colour or only intensity ?


You'll either have to have your script decide what the un-changed values should be or you'll have to retrieve those values using llGetPrimitiveParams. Retrieve color, intensity, radius and falloff, change the intensity, then set them all.
Karolina Heslop
Registered User
Join date: 28 May 2008
Posts: 8
08-11-2008 10:10
From: Anya Ristow
You'll either have to have your script decide what the un-changed values should be or you'll have to retrieve those values using llGetPrimitiveParams. Retrieve color, intensity, radius and falloff, change the intensity, then set them all.


I know this. I don't know how to. How can i to get only float intensity or only radius using llGetPrimitiveParams([PRIM_POINT_LIGHT.......]) and how to change only intensity or radius using llSetPrimitiveParams([PRIM_POINT_LIGHT.......]).
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
08-11-2008 11:49
retrieve light parameters:

list params = llGetPrimitiveParams( [PRIM_POINT_LIGHT]);

This gives you a list of the parameters, but PRIM_POINT_LIGHT is not in that list. The intensity parameter is 2 (0 is the on/off boolean, 1 is color, 2 is intensity, 3 is radius, 4 is falloff). The following statement gives you the intensity:

float intensity = llList2Float( params, 2);

Change intensity to anything you like, and then replace the intensity parameter in your parameter list:

intensity = 0.79;
params = llListReplaceList( params, [intensity], 2, 2);

Now set the parameters:

llSetPrimitiveParams( [PRIM_POINT_LIGHT] + params);

You've replaced the intensity parameter without affecting the other parameters.
Karolina Heslop
Registered User
Join date: 28 May 2008
Posts: 8
08-11-2008 12:29
From: Anya Ristow
retrieve light parameters:

list params = llGetPrimitiveParams( [PRIM_POINT_LIGHT]);

This gives you a list of the parameters, but PRIM_POINT_LIGHT is not in that list. The intensity parameter is 2 (0 is the on/off boolean, 1 is color, 2 is intensity, 3 is radius, 4 is falloff). The following statement gives you the intensity:

float intensity = llList2Float( params, 2);

Change intensity to anything you like, and then replace the intensity parameter in your parameter list:

intensity = 0.79;
params = llListReplaceList( params, [intensity], 2, 2);

Now set the parameters:

llSetPrimitiveParams( [PRIM_POINT_LIGHT] + params);

You've replaced the intensity parameter without affecting the other parameters.


Thank you :)
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
08-11-2008 12:47
On a possibly unrelated side-note. I just recently completed my own light script. What I did was set the parameters at the start of the script to what the default settings would be if you set a prim to be a light and kept track of them with variables. If you control the starting parameters and the user input you've got it made. I've not once used the method above to get a list of parameters, but I can see where it would be useful.
Karolina Heslop
Registered User
Join date: 28 May 2008
Posts: 8
08-12-2008 00:38
From: Anya Ristow
retrieve light parameters:

list params = llGetPrimitiveParams( [PRIM_POINT_LIGHT]);

This gives you a list of the parameters, but PRIM_POINT_LIGHT is not in that list. The intensity parameter is 2 (0 is the on/off boolean, 1 is color, 2 is intensity, 3 is radius, 4 is falloff). The following statement gives you the intensity:

float intensity = llList2Float( params, 2);

Change intensity to anything you like, and then replace the intensity parameter in your parameter list:

intensity = 0.79;
params = llListReplaceList( params, [intensity], 2, 2);

Now set the parameters:

llSetPrimitiveParams( [PRIM_POINT_LIGHT] + params);

You've replaced the intensity parameter without affecting the other parameters.


Sorry for this question but how to set new colour parameters ? I mean about line "colour =....;" I know that if i want to set colour to Red new parameters should be <1,0,0> but i can't to write this in this line. I have "ERROR: Type mismatch" then.
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-12-2008 01:13
The color is of type VECTOR.

float x = <1,0,0>; WILL give you an error because the variable type is wrong.

vector x = <1,0,0>; will work just fine.
Karolina Heslop
Registered User
Join date: 28 May 2008
Posts: 8
08-12-2008 01:30
From: Squirrel Wood
The color is of type VECTOR.

float x = <1,0,0>; WILL give you an error because the variable type is wrong.

vector x = <1,0,0>; will work just fine.


Thank you :)