|
Jhenova Georgette
Registered User
Join date: 3 Apr 2007
Posts: 2
|
04-09-2007 16:15
Let me explain first what I'm trying to do: I have a dance floor at my location. I have created prims which emit random colors and corresponding colored lights to simulate flashing disco lights. I am using a listen script to be able to turn "on" and "off" the lights simultaneously from a text command. This works in part, I can make all my light textures go black to simulate the lights going off.
There are two scripts involved. One is a random color/light changer that runs in an infinite loop changing the color of the textures and lights. The second scripts listens to my commands and if I say "OFF" then it changes the state of the textures to "dark"/black so it looks like they are off. Really, though the colors are still changing but you cant see them anymore. Problem is, I cannot turn off the light effects (reflections on the dark walls etc) by this method.
I tried putting everything in one script and and either flashing the lights while the state was "ON" and turning them off when the state was "OFF" but I cannot work out how to make the loop that controls the flashing lights continue infinitely but still listen for an "OFF" command.
It's easier to show than to explain. If anyone knows how to overcome this, please respond to me or IM me in-world. Thank you. Jhenova Georgette.
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-09-2007 16:25
How about making two different states? In the ON state, it listens for OFF and flashes lights. When it gets an OFF, it goes to the OFF state. In the OFF state, it sets all black, then does nothing but listen for ON. When it hears ON, it goes back to the ON state, and the flashing.
Rj
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-10-2007 02:26
From the sound of it your light script is using a while or do loop in state entry. What you will need to do is switch to using a timer triggered update.
integer Channel = 1; // Which ever channel you want to use
LightsOff() { llSetColor(<0.,0.,0.>,ALL_SIDES); llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, FALSE, <0.,0.,0.>, 0., 0., 1. ]); llSetTimerEvent(0.); }
LightOn() { vector colour = < llFrand(1) , llFrand(1) , llFrand(1) >; llSetColor(colour,ALL_SIDES); llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_POINT_LIGHT, TRUE, colour, 1., 10., 0.75 ]);
llSetTimerEvent( llFrand(5.) ); }
default { state_entry() { lllisten(Channel,"", llGetOwner() ,"");// Owner only control LightsOff(); }
listen(integer channel, string name, key id, string message) { if("ON" == message) LightsOn(); else if("OFF" == message) LightsOff(); }
timer() { LightsOn(); } }
If teh items are all in a linked set then you could have them all controlled by a master script and linked messages.
|
|
Jhenova Georgette
Registered User
Join date: 3 Apr 2007
Posts: 2
|
Problem Solved: You are Awesome 
04-10-2007 19:18
Thank you for taking the time to give me an example script. I was able to use this with some modification and solve my problem. I am very impressed that without seeing my problem in person you basically knew exactly what I wanted to do. Thank you so much. Jhen xx
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
04-10-2007 23:56
From: Jhenova Georgette Thank you for taking the time to give me an example script. I was able to use this with some modification and solve my problem. I am very impressed that without seeing my problem in person you basically knew exactly what I wanted to do. Thank you so much. Jhen xx YW. It was really just a best guess. Your description of the problem had a few clues as to what was probably the case so I went from there. The code I posted isn't optimum but would hopefully give you enough pointers if i wasnt 100% on the mark that you could use the general idea.
|