Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Turn on/off glow script

Antena Eourres
Registered User
Join date: 8 Nov 2009
Posts: 15
12-05-2009 21:17
Hello,

I am looking for a script that will turn on and off the glow, you know... the one below brightness that is either on or off ;)

Am looking to control this fromm a switch if anyone can help.

Thnaks
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
12-06-2009 04:13
This basic script will toggle the object's glow when it's clicked:

CODE
float glow_intensity = 0.25;
integer glowing = FALSE;

default
{
touch_start (integer count)
{
llSetPrimitiveParams ([PRIM_GLOW, ALL_SIDES, glow_intensity * (glowing = !glowing)]);
}
}


How this would need to be changed to work from a switch will depend on the relationship between the switch and the object. You may also want to restrict who can operate the switch, which would be a trivial additon in the case of the owner only, and a bit more involved otherwise.
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
12-06-2009 04:31
This basic script toggles the "Full Bright" setting (which is what I think you're referring to) when the object is clicked:

CODE

integer full_bright = FALSE;

default
{
touch_start (integer count)
{
llSetPrimitiveParams ([PRIM_FULLBRIGHT, ALL_SIDES, full_bright = !full_bright]);
}
}


In case it is the actual "Glow" you mean, use this:

CODE

float glow_intensity = 0.25;
integer glowing = FALSE;

default
{
touch_start (integer count)
{
llSetPrimitiveParams ([PRIM_GLOW, ALL_SIDES, glow_intensity * (glowing = !glowing)]);
}
}


Or if you want both:

CODE

float glow_intensity = 0.25;
integer glowing = FALSE;

default
{
touch_start (integer count)
{
llSetPrimitiveParams ([PRIM_GLOW, ALL_SIDES, glow_intensity * (glowing = !glowing), PRIM_FULLBRIGHT, ALL_SIDES, glowing]);
}
}


How this would need to be changed to work with a switch depends on the relationship between the switch and the object that glows. If you are making a lamp, you will also need to turn the prim's light source properties on and off. You may also want to consider whether to restrict who is allowed to operate the switch.