Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Light Switch with glow

Nisa Maverick
Registered User
Join date: 3 Jun 2007
Posts: 224
06-10-2009 08:53
I have altered a light switch script to include the glow as well as the light when the object is clicked. I have put the script inside the rout prim.

Problem is when I have more than one of the lights up they all do not work, the flow comes on but the Light does not, and when you walk up to the object the light comes on??

here is the script can anyone tell me what is wrong


//Title: Light Switch
//9-01-07

//Simple light switch. Click object with script turns light on and off.

integer light_switch;
vector light_color=<1,1,1>;
float light_intensity=1.0;
float light_radius=04.0;
float light_falloff=1;


init ()
{

//Set light to off initially
light_switch=0;
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0.0,PRIM_POINT_LIGHT, FALSE, light_color, light_intensity, light_radius, light_falloff]);
llOwnerSay("Set to midnight and click to toggle light!";);

}

default
{
state_entry()
{

init();

}

on_rez(integer start_param)
{
init();
}

touch_start(integer total_number)
{
if(light_switch==1)
{
//Light is on, turn off
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0.0,PRIM_POINT_LIGHT, FALSE, light_color, light_intensity, light_radius, light_falloff]);
light_switch=0;
llOwnerSay("Light turned off.";);
}

else
{
//Light is off, turn on
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0.3,PRIM_POINT_LIGHT, TRUE, light_color, light_intensity, light_radius, light_falloff]);
light_switch=1;
llOwnerSay("Light turned on.";);
}

}

}
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
06-10-2009 08:59
You are limited to a certain number of local light sources. Can't remember the hard limit, 6 maybe?
_____________________
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
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
06-10-2009 09:00
From: Nisa Maverick
Problem is when I have more than one of the lights up they all do not work, the flow comes on but the Light does not, and when you walk up to the object the light comes on??


There are only 6 (or even as few as 2) available prim light sources, depending on your SL version and video card. Only the closest ones will show as lit. Face lamps, and other local lights in the area, will eat away from what is available for use in your object.

Eventually high end cards will have no limit (that comes alongside the work LL has been doing on shadow support), but it will be a while before that becomes an official feature, longer before we can depend on many people being able to see things that way.

So, you may want to make do with alternatives like the glow, full bright, maybe a bit of particle stuff, to fill in for what local lights can't really do just yet.
Nisa Maverick
Registered User
Join date: 3 Jun 2007
Posts: 224
06-10-2009 10:16
That explains a lot thank you very much, and I thought the script was wrong. Thanks all.