Jump to content

Getting a particle prim to listen to a HUD


Cid Huckleberry
 Share

You are about to reply to a thread that has been inactive for 3004 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to get a prim to release particles on a worn object when a button on the HUD is pressed. I've googled for tips, searched the archives of the forum, but found nothing that works.

I have the particles emitting on the worn object, but I just can't seem to get the emitter to turn them on/off through the HUD. Adding a lListen  command keeps giving me syntax errors, even though the same method appears to work for other people

Another problem I have is the particles aren't emitting in the right direction; I have rotated the texture in photoshop three times and it refuses to make the particles face the direction I want them to. This is a minor problem and I don't require an immidiate fix for it, unlike the HUD toggle. (Can you tell I hate working with particles?)

This is the particle script I am using

string Texture;
integer Interpolate_Scale;
vector Start_Scale;
vector End_Scale;
integer Interpolate_Colour;
vector Start_Colour;
vector End_Colour;
float Start_Alpha;
float End_Alpha;
integer Emissive;
float Age;
float Rate;
integer Count;
float Life;
integer Pattern;
float Radius;
float Begin_Angle;
float End_Angle;
vector Omega;
integer Follow_Source;
integer Follow_Velocity;
integer Wind;
integer Bounce;
float Minimum_Speed;
float Maximum_Speed;
vector Acceleration;
integer Target;
key Target_Key;

Particle_System ()
{
list Parameters =
[
PSYS_PART_FLAGS,
(
(Emissive * PSYS_PART_EMISSIVE_MASK) |
(Bounce * PSYS_PART_BOUNCE_MASK) |
(Interpolate_Colour * PSYS_PART_INTERP_COLOR_MASK) |
(Interpolate_Scale * PSYS_PART_INTERP_SCALE_MASK) |
(Wind * PSYS_PART_WIND_MASK) |
(Follow_Source * PSYS_PART_FOLLOW_SRC_MASK) |
(Follow_Velocity * PSYS_PART_FOLLOW_VELOCITY_MASK) |
(Target * PSYS_PART_TARGET_POS_MASK)
),
PSYS_PART_START_COLOR, Start_Colour,
PSYS_PART_END_COLOR, End_Colour,
PSYS_PART_START_ALPHA, Start_Alpha,
PSYS_PART_END_ALPHA, End_Alpha,
PSYS_PART_START_SCALE, Start_Scale,
PSYS_PART_END_SCALE, End_Scale,
PSYS_SRC_PATTERN, Pattern,
PSYS_SRC_BURST_PART_COUNT, Count,
PSYS_SRC_BURST_RATE, Rate,
PSYS_PART_MAX_AGE, Age,
PSYS_SRC_ACCEL, Acceleration,
PSYS_SRC_BURST_RADIUS, Radius,
PSYS_SRC_BURST_SPEED_MIN, Minimum_Speed,
PSYS_SRC_BURST_SPEED_MAX, Maximum_Speed,
PSYS_SRC_TARGET_KEY, Target_Key,
PSYS_SRC_ANGLE_BEGIN, Begin_Angle,
PSYS_SRC_ANGLE_END, End_Angle,
PSYS_SRC_OMEGA, Omega,
PSYS_SRC_MAX_AGE, Life,
PSYS_SRC_TEXTURE, Texture
];
llParticleSystem (Parameters);
}

pee (){
Texture = "b1b5356d-9c40-e3a7-70ec-c32066f531f6";
Interpolate_Scale = TRUE;
Start_Scale = <0.04,0.04, 0>;
End_Scale = <0.04,0.04, 0>;
Interpolate_Colour = FALSE;
Start_Colour = < 1, 1, 0 >;
End_Colour = < 1, 1, 0 >;
Start_Alpha = 0.8;
End_Alpha =0.5;
Emissive = FALSE;
Age = 0.9;
Rate = 0.010;
Count = 20;
Life = 0;
Pattern = PSYS_SRC_PATTERN_ANGLE_CONE;
Radius = 0;
Begin_Angle = 0.025;
End_Angle = 0.025;
Omega = < 0, 0, 0 >;
Follow_Source = FALSE;
Follow_Velocity = TRUE;
Wind = FALSE;
Bounce = FALSE;
Minimum_Speed = 1.0;
Maximum_Speed = 1.2;
Acceleration = < 0.0, 0.0, -4.0 >;
Target = FALSE;
Target_Key = NULL_KEY;

Particle_System ();
}

default
{

state_entry ()
{
pee ();
}

touch_start (integer i){
llParticleSystem ([]); // Stop the particles
}

}

I tried making my own script from scratch but it never did what I wanted it to, so I mixed it with a generated one. The particles behave exactly how they need to. The HUD is set up and ready to go. I just need to know where in this script to insert the lListen command. I tried tweaking the bottom by replacing touch_start but that didn't work either.

Link to comment
Share on other sites

If you want to toggle anything, not just particles, all you need is a global integer that you can flip from TRUE to FALSE each time you encounter it.  It's just a light switch:

integer gON;default{touch_start(integer num){    gON = !gON:  // Flip the switch    if (gON)    {        // Do ON stuff    }    else    {        //Do OFF stuff    }}

And there is no way to change the direction that particles flow out of an emitter (although you can apply an acceleration to them and change their trajectory afterwards).  What you have to do is rotate the emitter so that  its +Z axis points in a different direction.

 

  • Like 1
Link to comment
Share on other sites

I think the intent was to have a separate HUD that controls the other, particle-emitting object. That's easy too, made easier by the ability to chat with all attachments by sending it to the owner. So, just to illustrate, we'd use something very like Rolig's script in the HUD, perhaps something like this:

integer PARTICLE_CHANNEL = -12276125;   // some big negative numberinteger on; // simple toggle switchlist sayTexts = ["STOP", "PEE"];default{    touch_start(integer total_number)    {        on = !on;   // simple toggle        llRegionSayTo(llGetOwner(), PARTICLE_CHANNEL, llList2String(sayTexts, on));    }}

and then in the particle-emitting attachment, something very like the original script (but without all the cruft you get with generated scripts), such as this:

integer PARTICLE_CHANNEL = -12276125;   // some big negative number, used in HUDpee (){    llParticleSystem([        PSYS_PART_FLAGS,            PSYS_PART_INTERP_COLOR_MASK |            PSYS_PART_INTERP_SCALE_MASK |            PSYS_PART_FOLLOW_VELOCITY_MASK,        PSYS_PART_START_COLOR, <1.0, 1.0, 0.0>,        PSYS_PART_END_COLOR, <1.0, 1.0, 0.0>,        PSYS_PART_START_ALPHA, 0.8,        PSYS_PART_END_ALPHA, 0.5,        PSYS_PART_START_SCALE, <0.04, 0.04, 0.0>,        PSYS_PART_END_SCALE, <0.04, 0.04, 0.0>,        PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,        PSYS_SRC_BURST_PART_COUNT, 20,        PSYS_SRC_BURST_RATE, 0.010,        PSYS_PART_MAX_AGE, 0.9,        PSYS_SRC_ACCEL, < 0.0, 0.0, -4.0 >,        PSYS_SRC_BURST_SPEED_MIN, 1.0,        PSYS_SRC_BURST_SPEED_MAX, 1.2,        PSYS_SRC_ANGLE_BEGIN, 0.025,        PSYS_SRC_ANGLE_END, 0.025,        PSYS_SRC_TEXTURE,  "b1b5356d-9c40-e3a7-70ec-c32066f531f6"        ]);}default{    state_entry ()    {        llParticleSystem([]);        llListen(PARTICLE_CHANNEL, "", NULL_KEY, "");    }    attach(key av)    {        if (NULL_KEY != av)            llResetScript();    }    listen(integer channel, string name, key id, string text)    {        if ("PEE" == text)            pee ();        else        if ("STOP" == text)            llParticleSystem([]);    }}
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3004 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...