|
Sky Eclipse
Registered User
Join date: 30 Oct 2006
Posts: 123
|
09-09-2008 14:40
I have a script which turns a light off in a prim by voice command.... however it only works for the owner... how do i get it to work for everyone, im sure i have to take something out but what? heres the script.... thankyou for your time  integer running = FALSE; integer user; default { state_entry() { llListenRemove(user); llListen(channel, "", llGetOwner(), ""  ; llSay(0, ""  ; llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, COLOUR, INTENSE, RANGE, FALLOFF]); } listen(integer channel, string name, key id, string message) { if (message == lightson) { llSay(0, ""  ; llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, COLOUR, INTENSE, RANGE, FALLOFF]); } else if(message == lightsoff) { llSay(0, ""  ; llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, COLOUR, INTENSE, RANGE, FALLOFF]); } } } Thankyou so much!
|
|
Rig Thor
Registered User
Join date: 6 Aug 2008
Posts: 1
|
Listen to everyone
09-09-2008 16:15
Don't use llListen(channel, "", llGetOwner(), ""  ; Use llListen(channel, "", NULL_KEY, "lightson"  ; llListen(channel, "", NULL_KEY, "lightsoff"  ; The llGetOwner() only listened to the owner. NULL_KEY listens to everyone. That creates an undesirable sim load. Adding specific commands to listen for ought to reduce sim load. Experienced scripters may correct and enlighten me.
|
|
Galena Qi
Registered User
Join date: 9 Sep 2006
Posts: 249
|
09-09-2008 16:22
Replacing llGetOwner() with NULL_KEY will make it respond to anyone, but there are other problems with this script - like it sets a variable "Running" to False, but doesn't use that variable. Also, llSay(0, ""  won't say anything - "" is a null string - is that what you want? The LSL wiki is a good place to start at figuring out how to make the script do what you want. http://www.lslwiki.net/lslwiki/wakka.php?wakka=HomePage
|
|
Jodie Suisei
Lost In LSL Code
Join date: 6 Oct 2006
Posts: 66
|
09-10-2008 02:20
As the others have posted there is a few problems with the script one of then is the script wont compile in SL as it seems you have missed a few bits out but here is how i would handle the whole script hehe  // Are comment Lines but this will now Compile In SL and will additionally be listening on channel 999 which you can change. Anyway here is the cleaned up and corrected script 
integer handle; //Our Handle For The Listen Channel
integer channel = 999; //Change This To Your Desired Channel
default { state_entry() { handle = llListen(channel, "", "", ""); // The Listen Channel NULL_KEY or "" Will Do The Same Job } listen(integer channel, string name, key id, string message) { if (message == "lightson") //Corrected Your Missed The " " { llSay(0, "Turning Lights On"); llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, //Enables The Prim Lighting <1,1,1>, // Your Colour Which Is Now Corrected To Vector 1.0, //Intenisty Value 0.0 - 1.0 10.0, //Range Or Radius in Meters 0.1 - 20.0 0.1]); //Fall Off 0.1 - 2.0 } else if(message == "lightsoff") //Corrected This Also You Missed The " " { llSay(0, "Turning Lights Off"); llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, //Disables The Prim Light <1,1,1>, //Vector As Described Above 0.0, //Intensity As Above 10.0, //Radius Above 0.1]); //Fall Off As Above } } }
// Since False Is Turning The Light Off The Values For Them Dont Really Matter :)
There is around here some place a list with all the vector colours in with this example however i used basic white which is <1,1,1> hehe
|