Bonus Scripting lecture… Read on!
Script 1:
// 5/13 Script 1 // chat "/99 ON" or "/99 OFF" turnOn() { llParticleSystem([ PSYS_PART_FLAGS, PSYS_PART_BOUNCE_MASK | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_INTERP_COLOR_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_START_ALPHA, 0.5, PSYS_PART_END_ALPHA, 0.01, PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>, PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>, PSYS_PART_START_SCALE, <0.5, 0.5, 0>, PSYS_PART_END_SCALE, <2, 2, 0>, PSYS_PART_MAX_AGE, 10.000000, PSYS_SRC_MAX_AGE, -0.500000, PSYS_SRC_ACCEL, <0,0,0.1>, PSYS_SRC_ANGLE_BEGIN, 0, PSYS_SRC_ANGLE_END, PI/2, PSYS_SRC_BURST_PART_COUNT, 18, PSYS_SRC_BURST_RATE, 0.000000, PSYS_SRC_BURST_RADIUS, 0.000000, PSYS_SRC_BURST_SPEED_MIN, 0.002, PSYS_SRC_OMEGA, <0.00000, 0.00000, 0.00000>, PSYS_SRC_TARGET_KEY, llGetKey(), PSYS_SRC_TEXTURE, ""]); } turnOff() { llParticleSystem([]); } default { on_rez(integer p) { turnOff(); llResetScript(); } state_entry() { llListen(99, "", llGetOwner(), ""); } listen(integer ch, string name, key k, string m) { if (m == "ON") { turnOn(); llSetAlpha(0.0, ALL_SIDES); } else if (m == "OFF") { turnOff(); llSetAlpha(1.0, ALL_SIDES); } } }
Script 2.1:
// 5/13 Script 2.1 integer CHANNEL = 99; integer toggle = 0; default { state_entry() { toggle = 0; } touch_end(integer count) { ++toggle; if (toggle>1) { toggle = 0;} if (toggle == 0) { llShout(CHANNEL, "OFF"); } else if (toggle == 1) { llShout(CHANNEL, "ON"); } } }
Script 2.2:
// 5/13 Script 2.2 integer CHANNEL = 99; changeEffect(string effect) { if (effect == "OFF") { llSetAlpha(1.0, ALL_SIDES); // unhide the prim llParticleSystem([]); // turn off the particles } else if (effect == "ON") { llSetAlpha(0.0, ALL_SIDES); // hide the prim // turn on particles! llParticleSystem([ PSYS_PART_FLAGS, PSYS_PART_BOUNCE_MASK | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_INTERP_COLOR_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_PART_START_ALPHA, 0.5, PSYS_PART_END_ALPHA, 0.01, PSYS_PART_START_COLOR, <1.00000, 1.00000, 1.00000>, PSYS_PART_END_COLOR, <1.00000, 1.00000, 1.00000>, PSYS_PART_START_SCALE, <0.5, 0.5, 0>, PSYS_PART_END_SCALE, <2, 2, 0>, PSYS_PART_MAX_AGE, 10.000000, PSYS_SRC_MAX_AGE, -0.500000, PSYS_SRC_ACCEL, <0,0,0.1>, PSYS_SRC_ANGLE_BEGIN, 0, PSYS_SRC_ANGLE_END, PI/2, PSYS_SRC_BURST_PART_COUNT, 18, PSYS_SRC_BURST_RATE, 0.000000, PSYS_SRC_BURST_RADIUS, 0.000000, PSYS_SRC_BURST_SPEED_MIN, 0.002, PSYS_SRC_OMEGA, <0.00000, 0.00000, 0.00000>, PSYS_SRC_TARGET_KEY, llGetKey(), PSYS_SRC_TEXTURE, ""]); } else { // error: unknown effect! } } default { on_rez(integer p) { changeEffect("OFF"); llResetScript(); } state_entry() { llListen(CHANNEL, "", NULL_KEY, ""); } listen(integer ch, string name, key k, string m) { if (k == llGetOwner() || llGetOwnerKey(k) == llGetOwner()) { changeEffect(m); } } }