Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Remote particle system

Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
11-26-2007 17:20
Hi all,

I'm trying to get parts of a particle system controlled from a hud. BUt it isnt working. This is what i'm trying to do at the moment (change the color):


vector kleur;

default
{
state_entry()
{
llListen(1040, "", NULL_KEY, "" );
}

on_rez(integer num)
{
llParticleSystem( [
//Here are all my other particles but need to change the folowing:
PSYS_PART_START_COLOR,(vector) kleur
PSYS_PART_END_COLOR,(vector) kleur
] );

llResetScript();
}


listen(integer number, string name, key id, string message)
{

if(message=="red";)
{
kleur = <1,0,0>;
}
if(message=="green";)
{
kleur = <0,1,0>;
}
}
}


Hope someone can help :)

thanx,
asj
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
11-26-2007 17:40
Just assigning the variables new values in your listen() event isn't enough to make your particles change; you need to call llParticleSystem() again at the bottom of the listen() event, after you have the new values.
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
11-26-2007 23:05
The way you have currently set it out, the llParticleSystem call will only be made when the object is rezzed. There is not other opportunity to change the colour after rezzing. You'd be better of settiing out your script as exampled in the following pseudo-code:

From: someone

vector kleur = <1.0,0.0,0.0>;
integer ListenChannel;

ParticleStart()
{

llParticleSystem( [
//Here are all my other particles but need to change the folowing:
PSYS_PART_START_COLOR,(vector) kleur
PSYS_PART_END_COLOR,(vector) kleur
] );

}

default
{

on_rez
{
ParticleStart();
llResetScript();
}

state_entry()
{

}


touch_start(integer Touches)
{
//open listen channel when the HUD is touched
ListenChannel = llListen(1040, "", "", "";);

//open dialog box
llDialog(etc etc);

}


listen(integer number, string name, key id, string message)
{
if (message=="red";)
{
kleur = <1.0,0.0,0.0>;
}
else if (message=="green";)
{
kleur = <0.0,1.0,0.0>;
}
else if <other options, including ability to switch particles off>
{
}
//refresh particle system
ParticleStart();

/close the listen as it is no longer needed
llListenRemove(CommChannel);

//listen end
}


//default end
}
Asjbak Vandeverre
Registered User
Join date: 25 Dec 2006
Posts: 14
11-30-2007 06:09
Hi Debbie,

This is exactly what i needed :)
many thanx

asj