Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Light Script - Can't find :(

Cunundrum Alcott
A Sardonic Pessimist
Join date: 15 Jan 2007
Posts: 773
02-22-2008 04:24
I've been looking for a full perm script to change the light color. I have scripts to change the prim color and scripts to turn the light on/off but nothing to change the light color.
_____________________
Broccoli Curry
I am my alt's alt's alt.
Join date: 13 Jun 2006
Posts: 1,660
02-22-2008 05:20
Isn't the lsl

llSetPrimitiveParams ([PRIM_POINT_LIGHT, TRUE, <0,1,0>, 1.0, 15.0, 0.25]);

The syntax is PRIM_POINT LIGHT on/off, color (RGB values), intensity, radius, and falloff.

Any help?
_____________________
~ This space has been abandoned as I can no longer afford it.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
02-22-2008 06:37
Right. If a script turns on and off a light, it sets the color of that light, too. It may not be setting it to the color you want, but it's setting it. (It's often useful to llGetColor of one or all faces of the light-emitting object and make the light be that color.)
Cunundrum Alcott
A Sardonic Pessimist
Join date: 15 Jan 2007
Posts: 773
02-22-2008 06:39
You guys are talking way over my head
_____________________
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
02-22-2008 06:56
ok I could have just posted the link but I'm showing off:

Light with Touch On/Off and changeable color via chat commands
I have learned a lot from the scripting forums, so here is my first public script.

I am often asked about light scripts - lighting a prim is easy, the contols around it can be tricky.

This script has some nice control features and is low lag too.

NOTE: This is the most up-to-date version of the script

Features:

*Anyone can touch to turn On/Off
*Listens to owner and allows the color of the light to be changed on channel /5555
*Low lag - listens to owner on touch only and cancels the listen after 30 seconds
* Detaled comments to help new scripters

The command to change the colors are:
/5555 white
/5555 red
/5555 green
/5555 blue

Enjoy

CODE

// Sample touch lighting LSL script with color change capability - 07/07/2006 - 2fast4u Nabob
//
// * Permission granted to modify and create derivative works.
// * If you sell this script, include attribution to 2fast4u Nabob, the author of
// this script in your product's documentation and primary script.
//
// Provided "as is"
//
// Features:
//
// *Touch On/Off
// *Listens to owner and allows the color of the light to be changed
// *Low lag - listens to owner on touch only and cancels the listen after 30 seconds
//
// Instructions:
//
// 1.Place this script into a prim that you want to light-up when touched
// 2. Thank 2fast4u Nabob for helping you
//

// channel_num is the channel that the light listens on. Type /5555 ... to talk to the light
integer channel_num=5555;
// colorWords lists the colors that the light supports - add here and in colorVectors
list colorWords=["white" , "red" , "green" , "blue"];
// colorVectors represent the color values that the light supports
list colorVectors = [<1.0 , 1.0 , 1.0> , <1.0 , 0.0 , 0.0> , <0.0 , 1.0 , 0.0> , <0.0 , 0.0 , 1.0>];

// Don't edit anything below this line

integer isOn = FALSE;
vector light_color;

integer listenHandle = 0;

// This makes it easier to change the light's parameters in one place
setLightParameters()
{
llSetPrimitiveParams ([PRIM_POINT_LIGHT , isOn , light_color , 1.0 , 10.0 , 0.75]);
}

default
{
on_rez(integer start_param)
{
llResetScript(); //Reset in case owner changed
}

state_entry()
{
light_color = llList2Vector(colorVectors , 0); //Set the initial color to white
}
touch_start(integer num_detected)
{
// If not already listening , start listening to the owner
if(listenHandle == 0)
{
listenHandle = llListen(channel_num , "" , llGetOwner() , "");
llSetTimerEvent(30.0);
}
// Toggle the light on/off
isOn = !isOn;
// Set the light's parameters
setLightParameters();
}

timer()
{
// If the script is listening , stop listening and stop the timer to reduce lag
if(listenHandle != 0)
{
llListenRemove(listenHandle);
llSetTimerEvent(0.0);
}
}

listen(integer channel , string name , key id , string message)
{
// The following IF statement is for the paranoid Not really necessary to check the
// id against the owner , but no harm in doing it anyway
if(channel != channel_num || id != llGetOwner())
return;
// Look for what the user says in the list....
integer listLocation;
listLocation = llListFindList(colorWords , [message]);
// Did not find what the user said in the list? Stop here
if(listLocation == -1)
return;
// found what the user said in the list , set the corresponding vector
light_color = llList2Vector(colorVectors , listLocation);
// set the light's parameters - does not change On/Off setting
setLightParameters();
}
}
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
02-22-2008 06:58
Here's the link just in case, there is another script there too.

/15/5f/119036/1.html

Oh my bad must post the author's name : 2fast4u Nabob
Cunundrum Alcott
A Sardonic Pessimist
Join date: 15 Jan 2007
Posts: 773
02-22-2008 07:01
Wow awsum, I'm doing some tutorials on scripting but I'm so analytical thinking that I force myself to understand each symbol....if a symbol is not defined I can not accept that I understand what is going on ;)
_____________________