Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Fun with timers!

Nuala Shippe
Registered User
Join date: 19 Jun 2008
Posts: 8
08-06-2009 16:52
Basically, I have a poofer that I want to incorporate chat control of the colors, since it matches something tintable.

I can't get the vector color changes to take. :( Any ideas?

I appreciate any help you can give!

key owner;
integer h_listen;

//ginormous and irrelevant particle script stuff

default
{

state_entry ()
{
owner = llGetOwner();
h_listen = llListen(3,"",owner,"";);
llSetTimerEvent(0.0);
llParticleSystem ([]);
}

listen(integer channel, string name, key id, string msg)
{
if(channel==3 && llToLower(msg)=="trigger";)
{
llSetTimerEvent(1.0);
}else
if(channel==3 && llToLower(msg)=="black";)
{
Start_Colour = < 0.0, 0.0, 0.0 >;
End_Colour = < 0.0, 0.0, 0.0 >;
llOwnerSay("Seed color set to black.";);
}
}

timer()
{
myparticle ();
llSetTimerEvent(0.0);

}



}
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
08-07-2009 02:04
After you change the start and end color you have to restart the particles.
I've changed a little pooferscript I had in inventory to something to show this.

CODE

integer t;
vector color;

integer rate = 4;
float base = 0.8;
integer index = 0;
integer iters = 0;
integer gPartCount = 5;
float gBurstRate = .2;


poof()
{
llSetAlpha(0.0, ALL_SIDES);
llParticleSystem([PSYS_PART_FLAGS,
PSYS_PART_INTERP_SCALE_MASK|PSYS_PART_EMISSIVE_MASK|PSYS_PART_INTERP_COLOR_MASK|
PSYS_PART_FOLLOW_SRC_MASK|PSYS_PART_FOLLOW_VELOCITY_MASK,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
PSYS_SRC_ANGLE_BEGIN, PI/3,
PSYS_SRC_ANGLE_END, PI*2/3,
PSYS_PART_START_SCALE, < base, base, base>,
PSYS_PART_END_SCALE, < base, base, base>,
PSYS_SRC_MAX_AGE, 0.,
PSYS_PART_MAX_AGE, 4.,
PSYS_SRC_BURST_PART_COUNT, gPartCount,
PSYS_SRC_BURST_RATE, gBurstRate,

PSYS_SRC_ACCEL, < 0, 0, 0.2>,
PSYS_SRC_BURST_SPEED_MIN, 0.1,
PSYS_SRC_BURST_SPEED_MAX, 0.2,
PSYS_PART_START_ALPHA, 1.0,
PSYS_PART_END_ALPHA, 1.0,
PSYS_PART_START_COLOR, color,
PSYS_PART_END_COLOR, color
]);
}

poof_off()
{
llSetAlpha(1.0, ALL_SIDES);
llParticleSystem([]);
}

default
{
state_entry()
{
poof_off();
}

touch_start(integer n)
{
++t;
float c = (float)t/5;
color = < c,c,c>;
poof();
if (t > 5) {
poof_off();
t=0;
}
}
}
CODE


Put it in a prim. Then every time you touch the prim, the particles become a little lighter.