Blinking light.
|
|
VooDoo Bamboo
www.voodoodesignsllc.com
Join date: 4 Oct 2006
Posts: 911
|
02-25-2007 05:00
I am in need of something that will create a blinking light for me. For example, lets say I make a construction sign like you would see on the side of the road with a orange flashing light. Would a particle generator do this for me and if so which one would be good to get?
Thank you!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-25-2007 05:13
From: VooDoo Bamboo I am in need of something that will create a blinking light for me. For example, lets say I make a construction sign like you would see on the side of the road with a orange flashing light. Would a particle generator do this for me and if so which one would be good to get?
Thank you! You would be beter of using a light prim.
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
02-26-2007 16:51
The simplest solution is to use a texture to animate the light on and off.
In your paint program, make a 256x128 sized image. Paint the left half white, the right half about 20% gray. Save and import into SL. Use a script with this function to animate the texture:
llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 2, 1, 0, 0, 1.0);
Change the prim color to change the color of the light.
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
02-26-2007 17:03
I use this script with textures 32X32 as they are just solid colors. Works well for me. integer amIOn = FALSE; // Default to OFF
default { state_entry() { // Set the "off" texture if the script is reset, because the state resets llSetTexture("blue,lt", ALL_SIDES); }
touch_start(integer num) { if (amIOn == FALSE) { // We were off and someone touched us, so turn on amIOn = TRUE;
// Set the "on" texture llSetTexture("blue,drk", ALL_SIDES);
} else { // We were on and someone touched us, so turn off amIOn = FALSE;
llSetTexture("blue,lt", ALL_SIDES);
} } }
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
02-26-2007 17:09
This works well for me. I use it on small flashing lights on some of my electronic equipment. This one flashes Red and Green. vector COLOR_1 = <1.0,0.0,0.0>; // Pure red vector COLOR_2 = <0.0,1.0,0.0>; // Pure green
integer USE_COLOR_1;
default { state_entry() { USE_COLOR_1 = FALSE; llSetTimerEvent( 1.0 ); }
timer() { if (USE_COLOR_1) llSetColor( COLOR_1, ALL_SIDES ); else llSetColor( COLOR_2, ALL_SIDES );
USE_COLOR_1 = !USE_COLOR_1; } }
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
02-26-2007 17:27
Max, that script would indeed work, but it is not very efficient for a simple flash. Everytime your script calls llSetColor, it requires an update on the SL server to be sent to everyone's SL client within viewing distance of that prim.... in your case, that is one update per second to a lot of avatars -- not optimal when there's a better method.
With llSetTextureAnim, the update is sent to an avatar only once (when the object first rezzes for that person). The client handles the rest -- very optimal like fire and forget. Especially in a situation where a prim is only going to toggle between two colors or light and dark forever.
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
02-26-2007 17:47
Great info, thanks  Went to my amphitheater and removed 5 blinking lights...lol, hope that takes care of some lag. Your help works like a charm and acheives the exact effect, thanks
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
02-26-2007 18:19
A particle effect can also be used, also a nicely lagless, no-update "fire and forget" style effect: default { state_entry() { llParticleSystem( [ PSYS_PART_START_COLOR, < 1.0, 0.5, 0.01 >, PSYS_PART_END_COLOR, < .8, 0.4, 0.01 >, PSYS_PART_START_ALPHA, 0.5, PSYS_PART_END_ALPHA, 0.0, PSYS_PART_MAX_AGE, 2.0, PSYS_SRC_BURST_RATE, 4.0, PSYS_SRC_BURST_PART_COUNT, 5, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP, PSYS_PART_FLAGS, ( PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_FOLLOW_SRC_MASK ) ] ); } } // light stays on for 2 seconds, and comes on every 4 seconds. // warning... this code is fresh and untested, some trivial // debugging might be required. -- Jopsy Pendragon
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|
|
Shipper Sodwind
Registered User
Join date: 25 Nov 2006
Posts: 132
|
Fantastic
07-21-2007 12:55
Just what i was trying to do.
Posters like you really make a differance to us wanna be scripters.
Thanks
|
|
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
|
flashing light ideas wanted.. 
09-17-2007 10:29
SO.. the best way to make this TRUE.. or FALSE once a second or faster.. like less than a second is? llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE, <1.0,1.0,1.0>, // light color vector range: 0.0-1.0 *3 1.0, // intensity (0.0-1.0) 10.0, // radius (.1-10.0) 0.01 ]); // falloff (.01-1.0) i need to use the actual light feature in the prim.. not just a visual indicator.. the prim is transparent.. llSetTimerEvent is the only method ive considered.. but i cant see an easy way to make it cycle.. i guess i would eventually, but i thought someone..( hopes..  ) must have used the PRIM_POINT_LIGHT feature in a repeating time cycle before. any idea?
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
09-17-2007 10:53
Kinda suspected that it was PRIM_POINT_LIGHT that was desired, not the flashing of the prim surface itself. Yes, llSetTimerEvent is the right approach, but instead of "TRUE" you'll just reference a global variable that you toggle back and forth in the timer event handler... something like "myLightState = (! myLightState);" I suppose. By the way, I think the radius can go up to 20.0 and the falloff down to 0.0. Also, with only the six nearest light sources shown in the client, having one flash on and off can make other parts of the scene "flash" in unexpected ways as other light sources come in and out of that "nearest" set.
|
|
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
|
09-17-2007 11:31
Yes, thank you for that Qie, ive considered a variable..i wasnt aware that i could take the timer event down below one second, though i realise lag and server updates probably mean it cant work really fast ,the cycle time looking for is about 16 or 17 milliseconds, which is the anim cycle time i am using.
Essentialy i want the prim feature light on 17ms times the frame totals or frame count
can i use the variable here that i set the anim time for?
im looking for a time of about 16 x 17- 272 milliseconds or in multiplies of the frame totals, - 80 times 17... 40 times 17.. etc.
integer randNumber; integer max_nr; integer cur_nr; integer mstimeset; integer time = 1; //write here your time
init() { max_nr = llGetInventoryNumber(INVENTORY_TEXTURE); cur_nr = 0; mstimeset = 17;
llSetTimerEvent(time);
//llSetTextureAnim( ANIM_ON | LOOP , ALL_SIDES, 4, 4, 0, 16, mstimeset); }
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
09-17-2007 11:51
Here's how I'd do it. The benefit of using states instead of status variables is it's one 'thing to do' each time the script wakes up. Obviously the saved processing is slight, but if you have several of these lights going all the time even slight savings add up.  default { state_entry() { llSetTimerEvent( 1.0 ); llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE, <1.0,1.0,1.0>, 1.0, 10.0, 0.01 ]); // color, intensity, radius, fall-off } timer() { state blink_off; } } state blink_off { state_entry() { llSetTimerEvent( 1.0 ); llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1.0,1.0,1.0>, 1.0, 10.0, 0.01 ]); // color, intensity, radius, fall-off } timer() { state default; } }
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources. Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas. - Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
|
|
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
|
09-17-2007 12:03
Excellent Jopsy.. thank you.. i shall try that.. some info... i want to use the set light point feature to illuminate prim sections in association with the anim, using the set light feature enables one to illuminate sections of the animated prim in liason with the action the prim anim has.. and therefore as the anim changes.. i want to set the time the illumination changed too. The illuminating prim is transparent .. so invisible.. its the external light i want.. in a particular point of the prim its illumination hits. I know that sounds backwards.. why not illuminate the animated prim from itself.. well you cant illuminate sections of one prim face.. from that one prim.. the only way i can see is to illuminate it from an external source.. and switch on or off the lights i want .. hmm.. i know that sounds confusing.. but its the truth.. 
|
|
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
|
09-17-2007 12:25
and adds.. yes i know one could illuminate the anim using a paint program.. but its fixed...once illuminated its always going to be like that.. but with an external light source that can be moved.. (using its script) and cycled at a rate i can change.. the illumination of the anims can be changed easily.. without having to make a new anim.., in fact one could introduce random sequencing, which gives the whole thing more adaptability.
|
|
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
|
09-17-2007 13:37
Jopsy.. the script works fine.. i can use it as a basis for development.. thats certainly saved me some time.. just having forums like this makes one appreciate what great folks there are using SL. heres an avi of the first attempt.: http://www.incony.org/webpics/lights.avi
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
09-17-2007 15:37
Sounds like you might be better off using full-bright instead of a seperate light source....  (I'd have to look up how to turn that on/off via script I forget off the top of my head.)
|
|
Incony Hathaway
Registered User
Join date: 18 Feb 2007
Posts: 235
|
09-17-2007 16:18
Jopsy, Full bright isnt what i want, well.. rather its something i might use but having the ability to set the radius and intensity etc is far more usefull. the avi was just to show the script works.. The key really is to be subtle.. if a wanted drama i would use particles...  If anything that avi is overdone.. i was just playing. one can use colour mixing to create moving shadows for example.. i will try and make an avi when i have more time... but like anything, the recorders i have are not saving the quality i see on my pc.. even though i tried.. everything takes time to set up.. and time is not what i have an unlimited supply of. it was the easy route to the sequencing i wanted.. i understand the light.
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
09-17-2007 18:25
Now that I've seen the vid, I understand (couldn't access it earlier).
Cool effect! Good luck with it!
|