Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Light Control Script..

Perre Anatine
reflect..repent..reboot
Join date: 6 Jun 2007
Posts: 714
01-17-2008 20:45
Does anyone know where I can get a script to control (on and off) a simple light. Now before everyone starts banging away at their keyboards to tell me they're available in practically every freebie bulk box of scirpts in SL..please let me expand.

When you check the 'light' feature in the 'Features' tab in the 'Build' facility..the object illuminates..also everything in the immediate vicinity becomes lit up too. When you apply a basic light switch script to the object, you are able to switch the illumination of the object on and off, however when 'off' the immediate vicinity remains lit up as if the light were still on.

So the script I'm looking for needs to effectively 'uncheck' the 'light' feature and so switch off all the light both object and surrounding vicinity.

I've tried several scripts which I guess are all pretty much the same but they all leave the surroundings lit up. Anyone seen or know where I might get something to get round this..?


Thanks..Perre..:)
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
01-17-2008 21:22
Unless these scripts are just broken, they do the exact same thing one does in the editor when changing a prim's light feature. Possibly the script could be posted to see what it's doing. But I'm guessing the observation is actually just the effect of too many light sources in the scene: only the 6 nearest light sources are effective, so if there are lots of them around, turning one off can "reveal" another that hadn't been effective before. The same thing happens in the Editor, but maybe location and cam angles disguised the effect?
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
01-17-2008 22:05
It's really not hard..and ambient light has an effect as well, as stated above. Still, you want to be looking at

llSetColor(<1,1,1>,ALL_SIDES); so that the lightbulb "turns on" as well as

llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,<1,1,1>,1,15,1]); to use real light..to turn it off is simply the opposite, PRIM_POINT_LIGHT,FALSE,<0,0,0>,1,15,1


Look into the wiki for llSetPrimitiveParams and you'll find a whole lot of useful stuff to help!

Remember, tho, unless you are in windlight, you will need to have your Graphics Detail preferences set to "Nearby Local Lights" in order to see light.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-17-2008 23:02
Full bright and the new (Windlight) glow feature are also good ones. Unfortunately you'll have to wait for the latter (https://jira.secondlife.com/browse/VWR-3114), but it looks worth it!
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
01-18-2008 04:16
From: Hewee Zetkin
Full bright and the new (Windlight) glow feature are also good ones. Unfortunately you'll have to wait for the latter (https://jira.secondlife.com/browse/VWR-3114), but it looks worth it!


I'm not positive the glow feature is going to be all we hope, though. If you don't have your video card settings to the best quality, you don't even see it. And as most residents don't have the newest video cards..
Perre Anatine
reflect..repent..reboot
Join date: 6 Jun 2007
Posts: 714
01-18-2008 05:11
Thanks for the replies..

From: Qie Niangao
Unless these scripts are just broken, they do the exact same thing one does in the editor when changing a prim's light feature. Possibly the script could be posted to see what it's doing. But I'm guessing the observation is actually just the effect of too many light sources in the scene: only the 6 nearest light sources are effective, so if there are lots of them around, turning one off can "reveal" another that hadn't been effective before. The same thing happens in the Editor, but maybe location and cam angles disguised the effect?

I think the scripts are all operating properly..they basically change the colour of the object being used as a light source from bright to dark and back again. However when the light feature in 'build' is noted it remains checked throughout. I did a check for other sources..midnight..no other light sources..v/dark. I repeated the test and the immediate area to the now dark light source remained lit up.



From: ElQ Homewood
It's really not hard..and ambient light has an effect as well, as stated above. Still, you want to be looking at

llSetColor(<1,1,1>,ALL_SIDES); so that the lightbulb "turns on" as well as

llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,<1,1,1>,1,15,1]); to use real light..to turn it off is simply the opposite, PRIM_POINT_LIGHT,FALSE,<0,0,0>,1,15,1


Look into the wiki for llSetPrimitiveParams and you'll find a whole lot of useful stuff to help!

Remember, tho, unless you are in windlight, you will need to have your Graphics Detail preferences set to "Nearby Local Lights" in order to see light.

This, I suspect is where my problem lies..in all the scripts I have used none have made any mention of the 'Primitive Params'. So in effect the 'light' scripts are not really a light 'on/off' switch but merely a script for changing the object colour, and hence will have no effect on surrounding object lighting effects/responses. I'll go have a look in the wiki for some info and have a look around for a script with a bit more detail.

Thanks again..Perre..:)
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
01-18-2008 05:32
integer gLightLevel;


default
{
state_entry()
{
gLightLevel = 0;
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1.0, 1.0, 1.0>, 0.0, 0.0, 0.00]);

}

on_rez(integer startup_param)
{
llResetScript();
}

touch_start(integer num)
{
if (gLightLevel == 0) { //low
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1.0, 1.0, 0.6>, 0.4, 10.0, 0.75]);
gLightLevel = 1;
}
else if (gLightLevel == 1) { // high
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1.0, 1.0, 0.6>, 0.75, 10.0, 0.75]);
gLightLevel = 2;
}
else if (gLightLevel == 2) { // off
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1.0, 1.0, 1.0>, 0.0, 0.0, 0.00]);
gLightLevel = 0;
}
} //end touchstart

}
_____________________
.
:) To contact forum folks, join the inworld group "The Forum Cartel". New residents with questions about SL more than welcome! We has parties!

:) To contact forum scripters, join the inworld group "Scriptoratti" (thanks Void!). New scripter questions welcome!
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-18-2008 09:26
From: ElQ Homewood
I'm not positive the glow feature is going to be all we hope, though. If you don't have your video card settings to the best quality, you don't even see it. And as most residents don't have the newest video cards..

Ah. Okay. When I first saw it I was pretty impressed. Then my friend told me he couldn't see anything. We messed around with graphics options. He couldn't get his to draw the glow, and I couldn't get mine to NOT draw it. So that kinda makes sense. Too bad.
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
01-18-2008 17:53
From: Hewee Zetkin
Ah. Okay. When I first saw it I was pretty impressed. Then my friend told me he couldn't see anything. We messed around with graphics options. He couldn't get his to draw the glow, and I couldn't get mine to NOT draw it. So that kinda makes sense. Too bad.


Yes, when I saw that it was coming, I got kind of excited myself. I do a lot of work in light. Then, I started in windlight, and couldn't see it. After some messing with it, and talking with friends, I realized those with certain newer video cards could see it, but I couldn't. So I probably won't be using that feature at all, since I want as many people as possible to be able to view the effects of my work.