|
Count Acronym
Registered User
Join date: 15 Jan 2007
Posts: 8
|
12-19-2008 06:28
I wrote a particle script that emits 1 particle at random intervals (between 1 and 2 seconds). To accomplish this, I'm generating a random float every time the script is reset. After generating my particle, I reset the script. Is this a bad way to accomplish this, the resetting of the script every time? I'm concerned about creating too much lag.
Thanks for any help!
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
12-19-2008 06:33
It's probably not enough to be significant at that rate, but I'm sure it's more efficient to simply call a function on timeout rather than reset the script.
If you plan to rez hordes of them, efficiency becomes more important.
It's a trivial script change, though, so why not do it right?
|
|
Count Acronym
Registered User
Join date: 15 Jan 2007
Posts: 8
|
12-19-2008 06:47
Being a neophyte LSL scripter, I am not sure how to check for "timeout" of a script. Would it be something along the lines of the following?:
//pseudo-code on_timeout(int parm) { getNewTimeValue(); }
|
|
Myhrrhleine Wingtips
Registered User
Join date: 10 Mar 2008
Posts: 29
|
12-19-2008 07:02
Try this.. float timeout = 2.0; default { state_entry() { llSetTimerEvent(timeout); } timer() { //INSERT PARTICLE STUFF HERE } }
|
|
Count Acronym
Registered User
Join date: 15 Jan 2007
Posts: 8
|
12-19-2008 07:06
Thanks! Now I see what Lear Cale was talking about. I'll make the necessary changes to my code now. Thanks, again, to you both!
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
12-19-2008 12:26
Since you want the interval to be random, you'd generate a new random number from 1..2 and pass that to llSetTimerEvent() in the timer() handler.
|