Hello there,
I started working on a little script that displays a static particle for a fixed duration. For that, I use a function to which I pass the name of an image in the inventory of the prim:
play_particle(string Filename)
{
llParticleSystem([
PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,
PSYS_PART_START_ALPHA, 1,
PSYS_PART_END_ALPHA, 1,
PSYS_PART_START_COLOR, <1,1,1>,
PSYS_PART_END_COLOR, <1,1,1>,
PSYS_PART_START_SCALE, <0.2,0.2,0.0>,
PSYS_PART_END_SCALE, <0.2,0.2,0.0>,
PSYS_PART_MAX_AGE, 20,
PSYS_SRC_MAX_AGE, 20,
PSYS_SRC_ACCEL, <0,0,0>,
PSYS_SRC_ANGLE_BEGIN, 0,
PSYS_SRC_ANGLE_END, 0,
PSYS_SRC_BURST_PART_COUNT, 1,
PSYS_SRC_BURST_RADIUS, 0,
PSYS_SRC_BURST_RATE, 14,
PSYS_SRC_BURST_SPEED_MIN, 0,
PSYS_SRC_BURST_SPEED_MAX, 0,
PSYS_SRC_OMEGA, <0,0,0>,
PSYS_SRC_TEXTURE, Filename
]);
}
It all works as expected, but then there's this weird effect when I detach the object and reattach it, it displays the last displayed particle again for the programmed duration.
My state_entry and on_rez events don't call that function in any way, so I figured there must be some SL gotcha I'm not aware of at play here. Since I'm rather new to scripting, I thought maybe someone here could explain to me what causes this behaviour and if there's a way to work around it. I considered having the function call a transparent particle on detach, seems a little odd to me but if that's the way to go...
Anyway, any ideas?