Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llFrand with glow

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
04-12-2008 12:33
i dont know to much about llFrand but im trying to make a type of flashing light with glow i wont to make it do random flashes from .1 to .01 seconds here is what i have, not sure if it is working right

CODE

default
{
state_entry()
{
llSetTimerEvent(0);
llSetPrimitiveParams([25,ALL_SIDES,0]);
}

touch_start(integer total_number)
{
llSetTimerEvent(.01);
}
timer()
{
llSetPrimitiveParams([25,ALL_SIDES,.1]);
llSetPrimitiveParams([25,ALL_SIDES,.2]);
llSetPrimitiveParams([25,ALL_SIDES,.3]);
llSetPrimitiveParams([25,ALL_SIDES,.2]);
llSetPrimitiveParams([25,ALL_SIDES,.1]);
llSetTimerEvent(llFrand(.01-.1));
}
}
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
04-12-2008 12:46
Considering that there is a 0.2 second delay per llSetPrimitiveParams call, a timer interval of 0.01 is a little silly.
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
04-12-2008 12:47
serprimitiveparams has a timeout of 0.2seconds. you use it 5 times, that makes your 5-step-glow take 1 second.

then you set a timer to wait for 0.01 to 0.1 seconds.

go figure, the timing is pathetic.
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
04-12-2008 13:20
From: Talarus Luan
Considering that there is a 0.2 second delay per llSetPrimitiveParams call, a timer interval of 0.01 is a little silly.


opinion noted >.>


but... that still dosent help me in any way am i doing the llFrand right? ..........
Beezle Warburton
=o.O=
Join date: 10 Nov 2006
Posts: 1,169
04-12-2008 13:31
From: Mrc Homewood
opinion noted >.>


but... that still dosent help me in any way am i doing the llFrand right? ..........


You have it in the right place, but the time frames you have for llfrand won't work. With five calls to llSetPrimitiveParams at 0.2s a piece, it'll take 1s to process. At best you'll end up with an un-noticable delay between each round of setting glow.
_____________________
Though this be madness, yet there is method in't.
-- William Shakespeare

Warburton's Whimsies:
In SL
Apez.biz
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
A straight answer.
04-12-2008 23:51
llFrand generates a random number between 0.0 and the number you give it. In your script you've passed it -0.09 (Which is 0.01-0.1, that's a minus sign).

What you want to do is: llSetTimerEvent(llFrand(0.09) + 0.01);
That will generate a number between 0.0 and 0.09, and adding 0.01 to it makes the range 0.01 to 0.1.

Ad explained by those above, this is pointless for two reasons:
1) llSetPrimitiveParams sleeps the script for 0.2 seconds, and
2) You can't call a timer event faster than 10 times a second anyway.

To make your glow really "dance", you'll want to make a texture with varying shades of grey and animate it with llSetTextureAnim.
http://wiki.secondlife.com/wiki/LlSetTextureAnim
This will all be client-side and thus low lag.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-13-2008 12:07
From: Jillian Callahan
To make your glow really "dance", you'll want to make a texture with varying shades of grey and animate it with llSetTextureAnim. This will all be client-side and thus low lag.

Yeah. Animating the texture, rotating (llTargetOmega()) a textured object or prim when appropraite for the application, and emitting particles can all interact in very interesting ways with glow. For example, if you have an all/mostly black sphere with glow and emit particles just far enough out to be visible above the surface, the effect can be pretty awesome.