Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

CHANGED_COLOR not working??

Dina Vanalten
Registered User
Join date: 24 Dec 2006
Posts: 268
10-10-2007 20:02
I'm trying to do something I think should be simple. Pick up the colour of the prim light after its changed using the Edit/More/Features/Light/Color. However the CHANGED_COLOR doesn't seem to do anything after I close Edit. I know the scipt is working as the CHANGED_INVENTORY works just fine.

Am I missing something? Thanks - D

// -----------------------------------

get_prim_settings()
{

list prim_settings = llGetPrimitiveParams([PRIM_POINT_LIGHT]);

llOwnerSay((string)prim_settings);

Light_Colour = (vector)llList2String(prim_settings, 1); // Light colour
Light_Intensity = (float)llList2String(prim_settings, 2); // Light intensity
Light_Range = (float)llList2String(prim_settings, 3); // Light range
Light_Falloff = (float)llList2String(prim_settings, 4); // Light falloff
}

// -----------------------------------

default
{

changed(integer change)
{
// Check for inventory change re options card.
if (change & CHANGED_INVENTORY) // Test for a changed inventory
{
read_optionscard(); // Read options note card
}

// Check for colour change.
else
if (change & CHANGED_COLOR) // Test for a colour change
{
if ( Use_Prim_Settings ) // Do we need to get the Prim's light settings?
{
get_prim_settings();
}
}

}

}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-10-2007 20:21
If in doubt, simplify!:

CODE


default
{
changed(integer change)
{
if (change & CHANGED_COLOR) // Test for a colour change
{
llOwnerSay("changed color");
}
}
}


Works just fine.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Dina Vanalten
Registered User
Join date: 24 Dec 2006
Posts: 268
10-10-2007 21:06
From: Jesse Barnett
If in doubt, simplify!:

CODE


default
{
changed(integer change)
{
if (change & CHANGED_COLOR) // Test for a colour change
{
llOwnerSay("changed color");
}
}
}


Works just fine.



Hi.

The changed() condition works fine if I change the colour under the textures tab or shape under the objects tab. The problem is that I need to detect a change to light colour under the features tab. And that doesn't seem to work.

I could work with just knowing that Edit was used but haven't found a way to do that either.
Katryna Jie
Registered User
Join date: 24 Jun 2007
Posts: 187
10-10-2007 21:52
could that be because the changed_color checks texture colour, not light colour?

I hope this can help you:::

http://wiki.secondlife.com/wiki/PRIM_POINT_LIGHT
Dina Vanalten
Registered User
Join date: 24 Dec 2006
Posts: 268
10-10-2007 22:05
From: Katryna Jie
could that be because the changed_color checks texture colour, not light colour?

I hope this can help you:::

http://wiki.secondlife.com/wiki/PRIM_POINT_LIGHT


Yes, that seems to be it. grrr

However, I found a clutzy workaround by testing if the light is on before reading the values. That seems to work.