Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can Someone Tell Me Why This Script Doesn't Work?

Patti Frye
Registered User
Join date: 25 Aug 2006
Posts: 60
08-15-2007 16:20
This is supposed to turn on/off particle flow using chat.
I can't seem to get it to work.

Anyone have an answer...please.


integer listenHandle;

Start() //Start Function.
{
llParticleSystem([
PSYS_PART_MAX_AGE, 1.500000,
PSYS_PART_FLAGS, 291,
PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>,
PSYS_PART_END_COLOR, <1.00000, 1.00000, 0.00000>,
PSYS_PART_START_SCALE, <1.0000, 1.00000, 0.00000>,
PSYS_PART_END_SCALE, <0.60000, 0.60000, 0.00000>,
PSYS_SRC_PATTERN, 8,
PSYS_SRC_BURST_RATE,0.001000,
PSYS_SRC_ACCEL,<0.00000, 0.00000, 0.00000>,
PSYS_SRC_BURST_PART_COUNT,1,
PSYS_SRC_BURST_RADIUS,0.000000,
PSYS_SRC_BURST_SPEED_MIN,0.900000,
PSYS_SRC_BURST_SPEED_MAX,3.300000,
PSYS_SRC_INNERANGLE,0.000000,
PSYS_SRC_OUTERANGLE,0.000000,
PSYS_SRC_OMEGA,<0.00000, 0.00000, 0.00000>,
PSYS_SRC_MAX_AGE,0.000000,
PSYS_PART_START_ALPHA,0.000000,
PSYS_PART_END_ALPHA,1.000000,
PSYS_SRC_TEXTURE, "",
PSYS_SRC_TARGET_KEY,(key)"" ]);
}


default
{
state_entry()
{
Start();
listenHandle = llListen(20,"","","off";); //Listens for the off command
}

listen( integer chan, string name, key id, string msg ) //Turn particles off.
{
llListenRemove( listenHandle );
Start();
}
}


state off
{
state_entry()
{
llParticleSystem([]); //Stop making particles
listenHandle = llListen(20,"","","on";); //Listen for the on command
}

listen( integer chan, string name, key id, string msg ) //Turn particles back on
{
llListenRemove( listenHandle );
state default; //Switch back on
}
}
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
08-15-2007 16:31
Maybe this:

From: someone

listen( integer chan, string name, key id, string msg ) //Turn particles off.
{
llListenRemove( listenHandle );
Start();
}
}


Should be:

From: someone

listen( integer chan, string name, key id, string msg ) //Turn particles off.
{
llListenRemove( listenHandle );
state off;
}
}
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
08-15-2007 17:30
The state change btw will automatically release your listens for you.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
2k Suisei
Registered User
Join date: 9 Nov 2006
Posts: 2,150
08-15-2007 18:17
Hi there!,


You've not called 'state off' after calling Start();


So it should look like this:

listen( integer chan, string name, key id, string msg ) //Turn particles off.
{
llListenRemove( listenHandle );
Start();
state off; // RED ALERT! RED ALERT!! RED ALERT!!
}
}
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
08-15-2007 18:28
From: Strife Onizuka
The state change btw will automatically release your listens for you.


Was this always the case? I read that elsewhere but I do not think it was like that before.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
08-15-2007 18:41
From: Shadow Subagja
Was this always the case? I read that elsewhere but I do not think it was like that before.


The change happened about 3 years ago. If they changed it now it would break alot of scripts.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey