need script fix please

Creating scripts
Post Reply
User avatar
Gregg Legendary
Posts: 123
Joined: Sun Jun 22, 2014 10:22 am
Has thanked: 214 times
Been thanked: 213 times

need script fix please

Post by Gregg Legendary »

this runs but wont turn on and off



// Jopsy's No-Frills Particle Script v2
// All settings below are 'defaults
integer mode;
default
{
state_entry() {
llParticleSystem( [
// Appearance Settings
PSYS_PART_START_SCALE,(vector) <0.1,0.8,0>,// Start Size, (minimum .04, max 10.0?)
PSYS_PART_END_SCALE,(vector) <0.2,0.3,0>, // End Size, requires *_INTERP_SCALE_MASK
PSYS_PART_START_COLOR,(vector) <.6,.7,1>, // Start Color, (RGB, 0 to 1)
PSYS_PART_END_COLOR,(vector) <.4,.6,.8>, // EndC olor, requires *_INTERP_COLOR_MASK
PSYS_PART_START_ALPHA,(float) 1., // startAlpha (0 to 1),
PSYS_PART_END_ALPHA,(float) 1.1, // endAlpha (0 to 1)
PSYS_SRC_TEXTURE,(string) "", // name of a 'texture' in emitters inventory
// Flow Settings, keep (age/rate)*count well below 4096 !!!
PSYS_SRC_BURST_PART_COUNT,(integer) 40, // # of particles per burst
PSYS_SRC_BURST_RATE,(float) 0.1, // delay between bursts
PSYS_PART_MAX_AGE,(float) 2.0, // how long particles live
PSYS_SRC_MAX_AGE,(float) 0,//15.0*60.0, // turns emitter off after 15 minutes. (0.0 = never)
// Placement Settings
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
// _PATTERN can be: *_EXPLODE, *_DROP, *_ANGLE, *ANGLE_CONE or *_ANGLE_CONE_EMPTY
PSYS_SRC_BURST_RADIUS,(float) .5, // How far from emitter new particles start,
PSYS_SRC_INNERANGLE,(float) PI/20, // aka 'spread' (0 to 2*PI),
PSYS_SRC_OUTERANGLE,(float) 0.0, // aka 'tilt' (0(up), PI(down) to 2*PI),
PSYS_SRC_OMEGA,(vector) <0,0,2 * PI>, // how much to rotate around x,y,z per burst,
// Movement Settings
PSYS_SRC_ACCEL,(vector) <0,0,-3>, // aka gravity or push, ie <0,0,-1.0> = down
PSYS_SRC_BURST_SPEED_MIN,(float) 2.5, // Minimum velocity for new particles
PSYS_SRC_BURST_SPEED_MAX,(float) 3.5, // Maximum velocity for new particles
//PSYS_SRC_TARGET_KEY,(key) llGetOwner(), // key of a target, requires *_TARGET_POS_MASK
// for *_TARGET try llGetKey(), or llGetOwner(), or llDetectedKey(0) even. :)

PSYS_PART_FLAGS, // Remove the leading // from the options you want enabled:
//PSYS_PART_EMISSIVE_MASK | // particles glow
PSYS_PART_BOUNCE_MASK | // particles bounce up from emitter's 'Z' altitude
//PSYS_PART_WIND_MASK | // particles get blown around by wind
//PSYS_PART_FOLLOW_VELOCITY_MASK | // particles rotate towards where they're going
//PSYS_PART_FOLLOW_SRC_MASK | // particles move as the emitter moves
PSYS_PART_INTERP_COLOR_MASK | // particles change color depending on *_END_COLOR
PSYS_PART_INTERP_SCALE_MASK | // particles change size using *_END_SCALE
//PSYS_PART_TARGET_POS_MASK | // particles home on *_TARGET key
0 // Unless you understand binary arithmetic, leave this 0 here. :)
] );
//sound
llLoopSound("water.wav",1.0);
}

touch_start(integer num) {
if (mode++) llResetScript(); // 2nd time touched? start over
else llParticleSystem([ ]); // 1st time touched? Turn particles off.
}
}




I don't know why it doesn't work here. I'll be honest since my kidney failure and month in a coma last may I am not the sharp mind i once was...
These users thanked the author Gregg Legendary for the post (total 3):
Ilan TochnerChristine NynChris Namaste
User avatar
Christine Nyn
Posts: 75
Joined: Sat Mar 07, 2020 10:20 pm
Has thanked: 245 times
Been thanked: 143 times

Re: need script fix please

Post by Christine Nyn »

I ran this inworld and the particles seem to turn on and off as they should.
There's no provision to turn the sound off though so I've added that.
I've also slightly modified the logic so it's perhaps a little clearer what happens at each click.
I've passed you the script inworld.

Code: Select all

// Jopsy's No-Frills Particle Script v2b
// All settings below are 'defaults

integer mode;

default
{
	state_entry()
	{
		mode = -1;
		llParticleSystem( [
						// Appearance Settings
						PSYS_PART_START_SCALE,(vector) <0.1,0.8,0>,// Start Size, (minimum .04, max 10.0?)
						PSYS_PART_END_SCALE,(vector) <0.2,0.3,0>, // End Size, requires *_INTERP_SCALE_MASK
						PSYS_PART_START_COLOR,(vector) <.6,.7,1>, // Start Color, (RGB, 0 to 1)
						PSYS_PART_END_COLOR,(vector) <.4,.6,.8>, // EndC olor, requires *_INTERP_COLOR_MASK
						PSYS_PART_START_ALPHA,(float) 1., // startAlpha (0 to 1),
						PSYS_PART_END_ALPHA,(float) 1.1, // endAlpha (0 to 1)
						PSYS_SRC_TEXTURE,(string) "", // name of a 'texture' in emitters inventory
						// Flow Settings, keep (age/rate)*count well below 4096 !!!
						PSYS_SRC_BURST_PART_COUNT,(integer) 40, // # of particles per burst
						PSYS_SRC_BURST_RATE,(float) 0.1, // delay between bursts
						PSYS_PART_MAX_AGE,(float) 2.0, // how long particles live
						PSYS_SRC_MAX_AGE,(float) 0,//15.0*60.0, // turns emitter off after 15 minutes. (0.0 = never)
						// Placement Settings
						PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
						// _PATTERN can be: *_EXPLODE, *_DROP, *_ANGLE, *ANGLE_CONE or *_ANGLE_CONE_EMPTY
						PSYS_SRC_BURST_RADIUS,(float) .5, // How far from emitter new particles start,
						PSYS_SRC_INNERANGLE,(float) PI/20, // aka 'spread' (0 to 2*PI),
						PSYS_SRC_OUTERANGLE,(float) 0.0, // aka 'tilt' (0(up), PI(down) to 2*PI),
						PSYS_SRC_OMEGA,(vector) <0,0,2 * PI>, // how much to rotate around x,y,z per burst,
						// Movement Settings
						PSYS_SRC_ACCEL,(vector) <0,0,-3>, // aka gravity or push, ie <0,0,-1.0> = down
						PSYS_SRC_BURST_SPEED_MIN,(float) 2.5, // Minimum velocity for new particles
						PSYS_SRC_BURST_SPEED_MAX,(float) 3.5, // Maximum velocity for new particles
						//PSYS_SRC_TARGET_KEY,(key) llGetOwner(), // key of a target, requires *_TARGET_POS_MASK
						// for *_TARGET try llGetKey(), or llGetOwner(), or llDetectedKey(0) even. :)

						PSYS_PART_FLAGS, // Remove the leading // from the options you want enabled:
						//PSYS_PART_EMISSIVE_MASK | // particles glow
						PSYS_PART_BOUNCE_MASK | // particles bounce up from emitter's 'Z' altitude
						//PSYS_PART_WIND_MASK | // particles get blown around by wind
						//PSYS_PART_FOLLOW_VELOCITY_MASK | // particles rotate towards where they're going
						//PSYS_PART_FOLLOW_SRC_MASK | // particles move as the emitter moves
						PSYS_PART_INTERP_COLOR_MASK | // particles change color depending on *_END_COLOR
						PSYS_PART_INTERP_SCALE_MASK | // particles change size using *_END_SCALE
						//PSYS_PART_TARGET_POS_MASK | // particles home on *_TARGET key
						0 // Unless you understand binary arithmetic, leave this 0 here. :)
						] );
		//sound
		llLoopSound("water.wav", 1.0);
	}

	touch_start(integer num)
	{
		mode++;
		if(mode) llResetScript(); // 2nd time touched? start over
		else
		{
			llParticleSystem([ ]); // 1st time touched? Turn particles off.
			llStopSound();
		}
	}
}
These users thanked the author Christine Nyn for the post (total 3):
Chris NamasteIlan TochnerKimm Starr
Post Reply