Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

random intermittent particle generation

Marmottina Taurog
Registered User
Join date: 14 Aug 2007
Posts: 21
02-20-2009 03:17
I'm a tinkerer, I can't write scripts from scratch only adapt, one thing I'd really like to do is generate particles that come on at random intermittent intervals. Can anyone give me any help ?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-20-2009 03:35
integer MAX = 10;
integer MIN = 5;
particles()
{
// whatever you want here
}
default
{
state_entry() { llSetTimerEvent(0.1); } // prime the pump
timer() { particles(); llSetTimerEvent(llFrand(MAX-MIN)+MIN); }
}
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
02-20-2009 07:35
From: someone
integer MAX = 10;
integer MIN = 5;
particles()
{
// whatever you want here
}
default
{
state_entry() { llSetTimerEvent(0.1); } // prime the pump
timer() { particles(); llSetTimerEvent(llFrand(MAX-MIN)+MIN); }
}


This would not "generate particles that come on at random intermittent intervals" but would instead only make a new particle emission every time the timer() is called.

This is because the previous emission would persist right up until the moment the next call is made. That is, at no point are the particles turned off.

If the llParticleSystem() call does not have any randomity/changes in its parameters with each call, then for all intents and purposes, it would create a continuous particle emission.

This code could be made to work if PSYS_SRC_MAX_AGE is set to a non-zero value and that value is always less than variable MIN. But, in this case, it would introduce other complications due to the long standing bug with PSYS_SRC_MAX_AGE and non-zero values described in caveat 1 http://wiki.secondlife.com/wiki/LlParticleSystem

To make the particle "come on" implies a need to have them turned off at some point during the timed sequence. There are numerous ways to do this, with the following example being one of the more straightforward ways with the introduction of a boolean ON/OFF switch within the timer():

CODE


integer MAX = 10;
integer MIN = 5;
integer Switch = TRUE;

particles()
{

llParticleSystem([
// your particle call here
]);
}


default
{
state_entry()
{
// prime the pump
llSetTimerEvent(0.1);
}

timer()
{
if (Switch)
{
particles();
}
else
{
llParticleSystem([]);
}
Switch = !Switch;
llSetTimerEvent(llFrand(MAX-MIN)+MIN);
}
}

_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-20-2009 08:07
From: Debbie Trilling
This code could be made to work if PSYS_SRC_MAX_AGE is set to a non-zero value and that value is always less than variable MIN.
Of course.
From: someone
But, in this case, it would introduce other complications due to the long standing bug with PSYS_SRC_MAX_AGE and non-zero values described in caveat 1 http://wiki.secondlife.com/wiki/LlParticleSystem
Not relevant in this case because an additional burst of particles when the prim comes into range would not be noticed from a prim that is emitting random bursts of particles anyway, unless the period is exceptionally long. Turning the particles off explicitly would double the script overhead and network traffic from the script.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Marmottina Taurog
Registered User
Join date: 14 Aug 2007
Posts: 21
thx !!!
02-21-2009 14:04
Many thanx for your replies I will attempt to implement !!!