Jump to content

Light On with Color


Subody
 Share

You are about to reply to a thread that has been inactive for 2271 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'd like to change the light's color when it's on, so it's not white, but I can't figure out where nor what lines to add in here.

 

default
{
    state_entry()
    {
        llListen(6969, "", "", "");
    }
    
    on_rez( integer start_param )
    {
        llListen(6969, "", "", "");
    }    
    
    touch_start(integer total_number)
    {
        llListen(6969, "", "", "");
    }
    
    listen( integer channel, string name, key id, string message )
    {
        if (message == "On")
        {
            llSetPrimitiveParams([PRIM_POINT_LIGHT,1, <1.000000, 1.000000, 1.000000>, 1.000000, 10.000000, 0.750000,
        PRIM_FULLBRIGHT, ALL_SIDES,1,
        PRIM_GLOW,       ALL_SIDES,0.05
         ]);
        }
        else if (message == "Off")
        {
            llSetPrimitiveParams([PRIM_POINT_LIGHT,0, <1.000000, 1.000000, 1.000000>, 1.000000, 10.000000, 0.750000,
        PRIM_FULLBRIGHT, ALL_SIDES,0,
        PRIM_GLOW,       ALL_SIDES,0
         ]);
        }
    }
}

Link to comment
Share on other sites

Colours in lsl scripts are usually stored as vectors in "Kodak Color" format, that is, where each channel (red/blue/green) is represented bu a float value in the range 0-1.

< 1, 1, 1 > = White

< 0, 0, 0 > = Black

And so on...

check your llSetPrimitiveParams entries and edit the colour vectors to whatever colour you want.
 

  • Thanks 1
Link to comment
Share on other sites

Thank you for the help. I was able to figure out how to give the lights some color.

default
{
    state_entry()
    {
        llListen(6969, "", "", "");
    }
    
    on_rez( integer start_param )
    {
        llListen(6969, "", "", "");
    }    
    
    touch_start(integer total_number)
    {
        llListen(6969, "", "", "");
    }
    
    listen( integer channel, string name, key id, string message )
    {
        if (message == "On")
        {
            vector COLOR_ORANGE  = <1.000, 0.522, 0.106>;
 
            llSetPrimitiveParams([
                PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
                PRIM_GLOW,       ALL_SIDES,.1,
                PRIM_POINT_LIGHT, TRUE, COLOR_ORANGE, 1.0, 10.0, 0.75
                ]);
        }
        else if (message == "Off")
        {
            llSetPrimitiveParams([
        PRIM_POINT_LIGHT,0, <1.000000, 1.000000, 1.000000>, 1.000000, 10.000000, 0.750000,
        PRIM_FULLBRIGHT, ALL_SIDES,0,
        PRIM_GLOW,       ALL_SIDES,0
         ]);
        }
    }
}
 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2271 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...