Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can't turn off the Particle effect

ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
12-30-2007 09:43
Okay, This is something I'm doing for a friend. She wants to be able to cycle thru the textures on the particle "screen" that Debbie posted. I can get it to cycle the textures, but I can't turn the damn thing off! I have no idea why, either. I've tried it with llDialog, which the turning off/on works fine, but then it won't cycle thru the textures. I've tried everything I can think of..Here's the bit of script, I know it's sloppy lol. Any help turning this thing off while STILL cycling thru the textures would be appreciated..


key texture = "";
integer txtnum = 0;
float Size = 3;
integer i = 0;

ParticleStart()

{
//core code by Moriash Moreau. Adapted to suit by Debbie Trilling
llParticleSystem([
PSYS_PART_FLAGS, 0,
PSYS_SRC_PATTERN, 4,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.50,
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
PSYS_PART_MAX_AGE, 1.20,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.00,
PSYS_SRC_BURST_PART_COUNT, 8,
PSYS_SRC_BURST_RADIUS, Height,
PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_BURST_SPEED_MAX, 0.00,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, texture]);
}

default
{
on_rez(integer start)
{
llResetScript();
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
}
}
touch_start(integer txtnum)
{
i = 0;
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
while(i <= txtnum)
{
texture = llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE,i));
ParticleStart();
llSleep(6);
++i;
if(i > txtnum)
{
i = 0;
}
}
}

}
Blinky Lane
Registered User
Join date: 30 Apr 2007
Posts: 80
12-30-2007 11:00
The command you need is....

llParticleSystem([]);

This will turn your particles off.
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
12-30-2007 11:02
From: Blinky Lane
The command you need is....

llParticleSystem([]);

This will turn your particles off.


lol...yeah I know..but it doesn't work. or, it works, but when the particle system is running, it won't cycle thru the textures.
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
12-30-2007 11:13
The while loop in the touch start event is never exited, so touch start never completes. All other events will simply be qued.
Blinky Lane
Registered User
Join date: 30 Apr 2007
Posts: 80
12-30-2007 11:15
akk sorry, got up early and didnt have my coffee yet.
I'll shut up now go make the coffee, I am sure someone else will help.
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
12-30-2007 14:02
Try this im not very sure because im not chek it inworld.

CODE

key texture = "";
integer txtnum = 0;
float Size = 3;
integer i = 0;
float Height=0.1;
ParticleStart()

{
//core code by Moriash Moreau. Adapted to suit by Debbie Trilling
llParticleSystem([
PSYS_PART_FLAGS, 0,
PSYS_SRC_PATTERN, 4,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.50,
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
PSYS_PART_MAX_AGE, 1.20,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.00,
PSYS_SRC_BURST_PART_COUNT, 8,
PSYS_SRC_BURST_RADIUS, Height,
PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_BURST_SPEED_MAX, 0.00,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, texture]);
}

default
{
on_rez(integer start)
{
llResetScript();
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
}
}
touch_start(integer txtnum)
{
i = 0;
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
while(i <= txtnum)
{
llParticleSystem([]);//stop the particles
texture = llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE,i));//get the next texture

llSleep(2);//sleep 2 sec just in case
ParticleStart();//start the new particles
llSleep(6);
++i;
if(i > txtnum)
{
i = 0;
}
}
}

}
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
Lol
12-30-2007 15:42
From: Blinky Lane
akk sorry, got up early and didnt have my coffee yet.
I'll shut up now go make the coffee, I am sure someone else will help.


hey it's not your fault..I messed with it for hours before coming here because that was the answer and it was so "easy" lol
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
thanks, though
12-30-2007 15:59
Thanks, papa, I thot that might work! Cycles the textures fine, but it still won't stop the particles..I'm at a complete loss here lol..I know it's something I've done wrong, I just don't see what it is.
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
12-30-2007 16:59
ok tested....did not work
try this one.

CODE


integer txtnum;
float Size = 3;
integer i = 0;
float Height=0.1;
string txtcurrent;
string texture;
key owner;


ParticleStart()

{
//core code by Moriash Moreau. Adapted to suit by Debbie Trilling
llParticleSystem([
PSYS_PART_FLAGS, 0,
PSYS_SRC_PATTERN, 4,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.50,
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
PSYS_PART_MAX_AGE, 1.20,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.00,
PSYS_SRC_BURST_PART_COUNT, 8,
PSYS_SRC_BURST_RADIUS, Height,
PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_BURST_SPEED_MAX, 0.00,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, txtcurrent]);
}






default
{

state_entry()
{

owner = llGetOwner();
llParticleSystem([]);

llSetTimerEvent(10);
// wille_loop();
llListen(7, "", llGetOwner(), "");


}

on_rez(integer start)
{
llResetScript();
}


changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}

listen(integer channel, string name, key owner, string message)
{
if (message == "off")
{
llParticleSystem([]);
llSetTimerEvent(0);

} else if (message == "on")

{ llSetTimerEvent(10);

ParticleStart();
}
}

timer()
{
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
float rand = llFrand(txtnum);
integer choice = (integer)rand;
texture = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (texture != "")
txtcurrent=texture;

llParticleSystem([]);//necessary to take the new texture

ParticleStart();
}

}

ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
geez..
12-30-2007 17:16
Thanks a lot papa! Chat command works! OMG I thot I was gonna have an aneurism on this one..
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
Any ideas why guys?
12-30-2007 17:20
So..does anybody have any ideas why the chat command works and the touch events and menus and everything else didn't? That really baffled me, I'd love to know why..
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
12-30-2007 17:37
I think the problems is on your set textures code.
try this one with touch event.

CODE

integer txtnum;
float Size = 3;
integer i = 0;
float Height=0.1;
string txtcurrent;
string texture;
key owner;
string power="off";

ParticleStart()

{
//core code by Moriash Moreau. Adapted to suit by Debbie Trilling
llParticleSystem([
PSYS_PART_FLAGS, 0,
PSYS_SRC_PATTERN, 4,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.50,
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
PSYS_PART_MAX_AGE, 1.20,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.00,
PSYS_SRC_BURST_PART_COUNT, 8,
PSYS_SRC_BURST_RADIUS, Height,
PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_BURST_SPEED_MAX, 0.00,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, txtcurrent]);
}






default
{

state_entry()
{

owner = llGetOwner();
llParticleSystem([]);
llSetTimerEvent(10);


}

on_rez(integer start)
{
llResetScript();
}


changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}

touch_start(integer something)
{if(owner=llDetectedKey(0))
{
if (power == "off")
{
ParticleStart();
llSetTimerEvent(10);
power="on";

} else if (power == "on")

{
llParticleSystem([]);
llSetTimerEvent(0);
power="off";
}
}else {
llSay(0,"Sorry you are not allowed to use me");
}
}
timer()
{
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
float rand = llFrand(txtnum);
integer choice = (integer)rand;
texture = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (texture != "")
txtcurrent=texture;

llParticleSystem([]);//necessary to take the new texture

ParticleStart();
}

}
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
Awesome
12-30-2007 17:45
lol I'm checkin it out right now, but I'm amazed it's working! Thanks a lot papa, I'm gonna be studying this..
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
12-30-2007 17:53
first you need slect the texture name in a variable, then stop the particle system, then start again the particles, because if you dont stop them first you dont get the new particles in world.


Im glad to help you ;)
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
12-31-2007 00:00
this with a menu on touch.
CODE

integer txtnum;
float Size = 3;
integer i = 0;
float Height=0.1;
string txtcurrent;
string texture;
key owner;
list menu =["On","Off"];
integer power=0;
integer channel;
integer handle;
ParticleStart()

{
//core code by Moriash Moreau. Adapted to suit by Debbie Trilling
llParticleSystem([
PSYS_PART_FLAGS, 0,
PSYS_SRC_PATTERN, 4,
PSYS_PART_START_ALPHA, 0.50,
PSYS_PART_END_ALPHA, 0.50,
PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
PSYS_PART_MAX_AGE, 1.20,
PSYS_SRC_MAX_AGE, 0.00,
PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
PSYS_SRC_ANGLE_BEGIN, 0.00,
PSYS_SRC_ANGLE_END, 0.00,
PSYS_SRC_BURST_PART_COUNT, 8,
PSYS_SRC_BURST_RADIUS, Height,
PSYS_SRC_BURST_RATE, 0.10,
PSYS_SRC_BURST_SPEED_MIN, 0.00,
PSYS_SRC_BURST_SPEED_MAX, 0.00,
PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
PSYS_SRC_TEXTURE, txtcurrent]);
}

default
{

state_entry()
{

owner = llGetOwner();
llParticleSystem([]);

llSetTimerEvent(0);

//llListen(channel, "", llGetOwner(), "");


}

on_rez(integer start)
{
llResetScript();
}


changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}

touch_start(integer something)
{
if(owner=llDetectedKey(0))
{
channel = llRound(llFrand(1000000) - 10000000);
handle= llListen(channel, "", "", "");
llDialog(owner, "choose an action", menu, channel);
}else {
llSay(0,"Sorry you are not allowed to use me");
}

}
listen(integer channel, string name, key id, string msg)
{
if (msg == "On")
{if (power == 0)

{
ParticleStart();
llSetTimerEvent(10);
power=1;


}


}

if (msg == "Off")
{if(power == 1)
{llParticleSystem([]);
llSetTimerEvent(0);
power=0;
}


}
llListenRemove(handle);
}

timer()
{
txtnum = llGetInventoryNumber(INVENTORY_TEXTURE);
float rand = llFrand(txtnum);
integer choice = (integer)rand;
texture = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (texture != "")
txtcurrent=texture;

llParticleSystem([]);//necessary to take the new texture

ParticleStart();
}
}

Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
06-06-2008 13:31
this looks great, i'll probably use it when i go in world later on. i saw that previously it wasn't clearing the last particle when turned off. i kinda want it to work like the profile picture projector where it displays the default picture when turned off. would i just need to put a particle system into the "off" state of the working code?

ie:

llParticleSystem([]); would be changed to

llParticleSystem([
Particle system settings blah blah blah;
PSYS_SRC_TEXTURE, "uuid of default picture",]);
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
06-06-2008 13:39
From: Ruthven Willenov


llParticleSystem([]); would be changed to

llParticleSystem([
Particle system settings blah blah blah;
PSYS_SRC_TEXTURE, "uuid of default picture",]);


Yep. thats it :)
_____________________
http://wiki.secondlife.com/wiki/User:debbie_Trilling