|
Grizzly Ogg
Registered User
Join date: 10 May 2006
Posts: 39
|
06-05-2006 05:55
Hi how can i make a object blink like red-back red-black
like power on and power off and if you click on the object it will stop and clicking on it again it will start plz someono help me
|
|
Geuis Dassin
Filming Path creator
Join date: 3 May 2006
Posts: 565
|
06-05-2006 06:21
One way to do it, which 'ol Bebop Vox showed me, is to use 2 textures. //From the script library //Writen by Strife Onizuka //http://secondlife.com/badgeo/wakka.php?wakka=LibraryTextureSwitcher
float time = 5; //give me a value if you want time based shifting otherwise set to zero
integer total; integer counter;
next() { string name = llGetInventoryName(INVENTORY_TEXTURE,counter); if(name == "") { total = llGetInventoryNumber(INVENTORY_TEXTURE); counter = 0; if(total < 1) return; else name = llGetInventoryName(INVENTORY_TEXTURE,counter); } else if(counter + 1 >= total) total = llGetInventoryNumber(INVENTORY_TEXTURE); llSetTexture(name ,ALL_SIDES); if(total) counter = (counter + 1) % total; }
default { state_entry() { total = llGetInventoryNumber(INVENTORY_TEXTURE); next(); llSetTimerEvent(time); }
timer() { next(); } }
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
06-05-2006 06:36
The other way uses one texture and most likely llOffsetTexture. You make your texture half red, half black, work out the offsets etc. for them, and then loop between them, probably with a timer. Touching the object then stops the timer on one or the other offsets.
You could, for a really friendly system (to the sim anyway) use a texture anim for the blinking, and use the touch to offset and stop the anim, again using that half black, half red texture.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
06-05-2006 06:40
Well, you don't need to use textures just to change colour, you could just use llSetColor. vector gColour = ZERO_VECTOR; vector BLACK = ZERO_VECTOR; // black vector RED = <1.0, 0.0, 0.0>; // red
default { state_entry() { // blinking state llSetTimerEvent(1.0); }
timer() { if (gColour == BLACK) gColour = RED; else gColour = BLACK; llSetColor(gColour, ALL_SIDES); }
touch_start(integer n) { state off; } }
state off { state_entry() { // switched off llSetTimerEvent(0.0); }
touch_start(integer n) { // switch back on when touched state default; } }
|
|
Grizzly Ogg
Registered User
Join date: 10 May 2006
Posts: 39
|
06-05-2006 06:57
LOL noting about the two works
|
|
Artemis Cain
Take it or Leave it
Join date: 11 Apr 2005
Posts: 116
|
06-05-2006 08:45
This is what you might want to try default { state_entry() { llSetTimerEvent(1.0); // generate a timer event every 1 second } timer() { llSetColor(<(0.0), (0.0), (0.0)>,ALL_SIDES); state red; } }
state red { state_entry() { llSetTimerEvent(1.0); // generate a timer event every 1 second } timer() { llSetColor(<(1.0), (0.0), (0.0)>,ALL_SIDES); state default; } }
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
06-05-2006 09:56
From: Grizzly Ogg LOL noting about the two works Can you be a little more specific?
|
|
Grizzly Ogg
Registered User
Join date: 10 May 2006
Posts: 39
|
06-05-2006 15:55
Cool Yes its work thx Man you best 
|