Jump to content
Sign in to follow this  
Subody

Light On with Color

You are about to reply to a thread that has been inactive for 761 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
         ]);
        }
    }
}

Share this post


Link to post
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

Share this post


Link to post
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
         ]);
        }
    }
}
 

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 761 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...