Jump to content

Click on object to create light+glow of object's tint?


jjws888
 Share

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

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

Recommended Posts

So Im making this lightbulb that, when clicked on, turns on a light and glows, simple enough with this script I got from the SL Wiki:

// Touch the object to light it up.
// Lighting is configurable.
 
integer light_s    = TRUE;
vector  lightcolor = <1.0, 0.75, 0.5>;
float   intensity  = 1.0;             // 0.0 <= intensity <= 1.0
float   radius     = 10.0;            // 0.1 <= radius <= 20.0
float   falloff    = 0.01;            // 0.01 <= falloff <= 2.0
float   glow       = 0.05;
 
toggle()
{
    float thisglow = 0.0;
    light_s = !light_s;
 
    if (light_s)
        thisglow = glow;
 
    llSetPrimitiveParams([
        PRIM_POINT_LIGHT, light_s, lightcolor, intensity, radius, falloff,
        PRIM_FULLBRIGHT, ALL_SIDES, light_s,
        PRIM_GLOW,       ALL_SIDES, thisglow
    ]);
      llSetColor(lightcolor, ALL_SIDES);
}
 
default
{
    state_entry()
    {
        llSetText("Touch for light", <1.0, 1.0, 1.0>, 1.0);
        toggle();
    }
 
    touch_start(integer total_number)
    {
        toggle();
    }
}

Now I don't know anything about coding, heck, I only got a C++ in Visual Basic class! (ba-dum-tsst)

My problem is I want the user to be able to change the base object's color in the default tint picker and then have the object glow and produce light of that color. From what I understand, this script calls on "vector lightcolor" which sets the color based on the values of "<1.0, 1.0, 1.0>".

If I were to sell an object with this script inside of it, the buyer would have to change these values manually in order to change the color and I don't want to have to make them do that.

What can I change about this script so that it produces light and glows just like it has been, but instead of the color being chosen by "<1.0, 1.0, 1.0>" values, it chooses based on the color the base object's been tinted at?

Many thanks!

Link to comment
Share on other sites


Nova Convair wrote:

LSL has no built in color picker!

The only easy way is to let the user type in numbers for RGB or open a menu with a selection of assorted colours.

For a real color picker you need to build an object or HUD like this example here: 

 

Yes, but I would repeat, for the sake of  clarity (since the OP is not an experienced scripter), that it's trivially simple to change the object's colour using the viewer's colour picker and then have a script in the object read that new colour using llGetColor.

 

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...