Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Light control help needed

Distilled1 Rush
written in the Pixles
Join date: 29 Jul 2006
Posts: 504
09-06-2008 20:02
I have a controller script (light-color and off) that I have edited (or thought to do what I want but it seems I have something messed up). along with a object listener script that again I edited.
if I keep the full scripts un edited to change color or turn the lights with the listener in them it works fine. BUT I don't want color change (or don't mind if I can get full bright.) I would like to just have on and off along with full bright on when the light source is on. issue is I can't get the llSetPrimitiveParams Right

I have this in the original that is touch only, but I am trying to set up a control for all the lights in a certain range (similar to a window tint system.)

llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, color, intensity, radius, falloff]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
g_OpenNow = TRUE;
this and FALSE for off works with the touch script.


but if I edit the listen script down to on and off and use that for on it wont work at all, as well if I change it to have the PRIM FULL BRIGHT in the 1st call for set primparms it doesn't work... is there an easy way to set this up? I can get it to work with out the full bright, but it doesn't look like the light is really on if I do besides the light emiting from the prim.

Thanks all, I have only edited and toyed with scripts and code, and am trying to learn simple (or what should be simple) stuff... if you can point me to a full perm free or sold item that will do this thats fine to :D
_____________________
Dell XPS-700 (this is a fantastic case!)
XP media
Intel Core2Duo 2.38ghz
Nvida 9800GTX+ 512mg
4 G RAM
Dell XPS 1530 Red
Core 2 duo VISTA and I like it!
Nvidia 8600m 512
6 G RAM
Compaq amd 3200 XP home
POS!
Nvidia FX 5200
2 G RAMM
White Box XP pro
P 4
Nvidia Shared 128k some odd old PCI card
1 G RAM
*(STILL RUNS THE 1.21 CLIENT AND LATEST RC! )
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
09-06-2008 20:18
The code might be useful.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Distilled1 Rush
written in the Pixles
Join date: 29 Jul 2006
Posts: 504
09-06-2008 20:27
oops LOL

here is the listener:
///////////////////////////////
vector color = <1,1,1>;
float intensity = 10.000;
float radius = 6.000;
float falloff = 0.400;


default
{
state_entry()
{
llSetStatus(STATUS_PHANTOM, TRUE);
llListen(788, "", NULL_KEY, "" );
}

on_rez(integer num)
{
llResetScript();
}

listen(integer number, string name, key id, string message)
{ //--------------LightEffects----------

if(message=="ON";)
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, color, intensity, radius, falloff]);
}

if(message=="OFF";)
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, PRIM_FULLBRIGHT, ALL_SIDES, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75]);
}


}

}
///////////////////////////////////////
(note this was a try at adding the PRIM_FULLBRIGHT in the params call, I did it as well with a second ||SetPrim... under that one as well to no result, script saved fine. Like this ///// {
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, color, intensity, radius, falloff]);
llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
g_OpenNow = TRUE;//



and the controller
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
integer menu_handler;
integer menu_channel;

menu(key user,string title,list buttons)/
{
menu_channel = (integer)(llFrand(99999.0) * -1);
menu_handler = llListen(menu_channel,"","","";);
llDialog(user,title,buttons,menu_channel);
llSetTimerEvent(5.0);
}

default
{state_entry()
{ llSetTouchText("Remote!";);
}
touch_start(integer t)
{
menu(llDetectedKey(0),"Choose on or off...",["ON","OFF"]);

}
timer() //so the menu timeout and close its listener
{
llSetTimerEvent(0.0);
llListenRemove(menu_handler);
}
listen(integer channel,string name,key id,string message)
{
if (channel == menu_channel) //in case you have others listeners
{
integer c_channel = 788;//----CHANNEL FOR COMMANDS----
if(message == "ON";)
{
llShout(c_channel, "ON";);
}
else if(message == "OFF";)
{
llShout(c_channel, "off";);

}
}
}}
_____________________
Dell XPS-700 (this is a fantastic case!)
XP media
Intel Core2Duo 2.38ghz
Nvida 9800GTX+ 512mg
4 G RAM
Dell XPS 1530 Red
Core 2 duo VISTA and I like it!
Nvidia 8600m 512
6 G RAM
Compaq amd 3200 XP home
POS!
Nvidia FX 5200
2 G RAMM
White Box XP pro
P 4
Nvidia Shared 128k some odd old PCI card
1 G RAM
*(STILL RUNS THE 1.21 CLIENT AND LATEST RC! )
Distilled1 Rush
written in the Pixles
Join date: 29 Jul 2006
Posts: 504
09-06-2008 20:45
I get this right now with the above script
/////////
Object: llSetPrimitiveParams error running rule #1 (PRIM_POINT_LIGHT): arg #2 vector expected but integer given.
/////////////
_____________________
Dell XPS-700 (this is a fantastic case!)
XP media
Intel Core2Duo 2.38ghz
Nvida 9800GTX+ 512mg
4 G RAM
Dell XPS 1530 Red
Core 2 duo VISTA and I like it!
Nvidia 8600m 512
6 G RAM
Compaq amd 3200 XP home
POS!
Nvidia FX 5200
2 G RAMM
White Box XP pro
P 4
Nvidia Shared 128k some odd old PCI card
1 G RAM
*(STILL RUNS THE 1.21 CLIENT AND LATEST RC! )
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
09-07-2008 01:13
Change the listen to:

CODE


listen(integer number, string name, key id, string message)
{ //--------------LightEffects----------

integer OnOff;
if (message=="ON") OnOff = 1;
else OnOff = 0;

llSetPrimitiveParams([
PRIM_POINT_LIGHT,OnOff, color, intensity, radius, falloff,
PRIM_FULLBRIGHT, ALL_SIDES, OnOff
]);
}

Distilled1 Rush
written in the Pixles
Join date: 29 Jul 2006
Posts: 504
09-08-2008 14:37
Thanks so much Ron that looks much better, but I get a syntax error line 30-1 the last }
EDIT >>>>
I have added this in in place of the other code like this
CODE

vector color = <1,1,1>;
float intensity = 10.000;
float radius = 6.000;
float falloff = 0.400;


default
{
state_entry()
{
llSetStatus(STATUS_PHANTOM, TRUE);
llListen(788, "", NULL_KEY, "" );
}

on_rez(integer num)
{
llResetScript();
}

listen(integer number, string name, key id, string message)
{ //--------------LightEffects----------

integer OnOff;
if (message=="ON") OnOff = 1;
else OnOff = 0;

llSetPrimitiveParams([
PRIM_POINT_LIGHT,OnOff, color, intensity, radius, falloff,
PRIM_FULLBRIGHT, ALL_SIDES, OnOff
]);
}

is there something I'm missing here?

Time to spend a few days in the scripting wiki and learn more ;)

And EDIT again it needed one more } at the end and works great! YAY!!!!

Thanks so much for your help :)
_____________________
Dell XPS-700 (this is a fantastic case!)
XP media
Intel Core2Duo 2.38ghz
Nvida 9800GTX+ 512mg
4 G RAM
Dell XPS 1530 Red
Core 2 duo VISTA and I like it!
Nvidia 8600m 512
6 G RAM
Compaq amd 3200 XP home
POS!
Nvidia FX 5200
2 G RAMM
White Box XP pro
P 4
Nvidia Shared 128k some odd old PCI card
1 G RAM
*(STILL RUNS THE 1.21 CLIENT AND LATEST RC! )