Jump to content
Sign in to follow this  
ChaosRaine

Link sets

Recommended Posts

I'm composing a script and when the parent prim is touched I want both my child prim to react to the touch. I have gotten this to work with the child prim being touched and the parent reacting, but I can't seem to switch it around. Any ideas?

Parent Prim

string animation;
string  CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.
integer AUTO_START = TRUE;   // Optionally FALSE only if using CONTROLLERS.

list particle_parameters=[]; // stores your custom particle effect, defined below.
list target_parameters=[]; // remembers targets found using TARGET TEMPLATE scripts.
integer told;
integer once_is_too_often;
 
default
{
    state_entry()
    {
        told = FALSE;
    }
    touch_start(integer total_number)
    {
        if(!(llDetectedLinkNumber(0) == llGetLinkNumber()))// We can use a condition like this to filter from which prims touches are triggered.
        {       particle_parameters = [  // start of particle settings
           // Texture Parameters:
           PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0), 
           PSYS_PART_START_SCALE, <0.04, .3, FALSE>, PSYS_PART_END_SCALE, <.12, 0.05, FALSE>, 
           PSYS_PART_START_COLOR, <.6,.6,.6>,    PSYS_PART_END_COLOR, <0.3,0.4,.6>, 
           PSYS_PART_START_ALPHA,  (float)0.75,            PSYS_PART_END_ALPHA, (float)0.50,   
         
           // Production Parameters:
           PSYS_SRC_BURST_PART_COUNT, (integer)5, 
           PSYS_SRC_BURST_RATE, (float) 0.01,  
           PSYS_PART_MAX_AGE, (float)1.0, 
           PSYS_SRC_MAX_AGE,(float) 0.0,  
        
           // Placement Parameters:
           PSYS_SRC_PATTERN, (integer)8, // 1=DROP, 2=EXPLODE, 4=ANGLE, 8=ANGLE_CONE,
           
           // Placement Parameters (for any non-DROP pattern):
           PSYS_SRC_BURST_SPEED_MIN, (float)0.3,   PSYS_SRC_BURST_SPEED_MAX, (float)0.9, 
           PSYS_SRC_BURST_RADIUS, 0.1,
        
           // Placement Parameters (only for ANGLE & CONE patterns):
           PSYS_SRC_ANGLE_BEGIN, (float) 0.08*PI,    PSYS_SRC_ANGLE_END, (float)0.002*PI,  
        // PSYS_SRC_OMEGA, <0,0,0>, 
        
           // After-Effect & Influence Parameters:
           PSYS_SRC_ACCEL, <0.0,0.0, - 2.0 >,  
        // PSYS_SRC_TARGET_KEY,      llGetLinkKey(llGetLinkNumber() + 1),       
              
           PSYS_PART_FLAGS, (integer)( 0         // Texture Options:     
                                | PSYS_PART_INTERP_COLOR_MASK   
                                | PSYS_PART_INTERP_SCALE_MASK   
                                | PSYS_PART_EMISSIVE_MASK   
                                | PSYS_PART_FOLLOW_VELOCITY_MASK
                                                  // After-effect & Influence Options:
                             // | PSYS_PART_WIND_MASK            
                             // | PSYS_PART_BOUNCE_MASK          
                             // | PSYS_PART_FOLLOW_SRC_MASK     
                             // | PSYS_PART_TARGET_POS_MASK     
                             // | PSYS_PART_TARGET_LINEAR_MASK   
                            ) 
            //end of particle settings                     
        ];
        
        if ( AUTO_START ) llParticleSystem( particle_parameters );
           if(!once_is_too_often)
           {
        llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
    }
}
}
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
        animation = llGetInventoryName(INVENTORY_ANIMATION,0);
            llStartAnimation(animation);
            llOwnerSay("animation will end in 5 seconds");
            llSetTimerEvent(5.0);told = TRUE;
        }
        else
        {
            }
    }
    
    
                   timer()
    {
          llParticleSystem([]);
          llStopAnimation(animation);
          llSetTimerEvent(0.0);
    }
}

 Child Prim

 

integer once_is_too_often;
 
default
{


   state_entry()
   {
       llPassTouches(FALSE);// Innocent child doesn't know to say something the first time.
       once_is_too_often = FALSE;
   }
   touch_start(integer total_number)
   {
       if(llDetectedLinkNumber(0) == llGetLinkNumber())// Again we check who is being touched.
       {
           if(!once_is_too_often)
           {
               llPassTouches(TRUE); // But if a second time, it will tell.
               once_is_too_often = TRUE;// And then fall silent.
           }
       }
}
}

 

Share this post


Link to post
Share on other sites

This IF statement is processing touches from your children, but not allowing your root prim to process touches.  Simply remove this IF statement from your script (don't forget the end bracket) and the root should process touches as well.  Your root prim script is what's processing touches, so the IF statement isn't needed.

 

        if(!(llDetectedLinkNumber(0) == llGetLinkNumber()))// We can use a condition like this to filter from which prims touches are triggered.        {

 

Your root script would look like this...

 

string animation;string  CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.integer AUTO_START = TRUE;   // Optionally FALSE only if using CONTROLLERS.list particle_parameters=[]; // stores your custom particle effect, defined below.list target_parameters=[]; // remembers targets found using TARGET TEMPLATE scripts.integer told;integer once_is_too_often; default{    state_entry()    {        told = FALSE;    }        touch_start(integer total_number)    {        particle_parameters = [  // start of particle settings        // Texture Parameters:        PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0),         PSYS_PART_START_SCALE, <0.04, .3, FALSE>, PSYS_PART_END_SCALE, <.12, 0.05, FALSE>,         PSYS_PART_START_COLOR, <.6,.6,.6>,    PSYS_PART_END_COLOR, <0.3,0.4,.6>,         PSYS_PART_START_ALPHA,  (float)0.75,            PSYS_PART_END_ALPHA, (float)0.50,                   // Production Parameters:        PSYS_SRC_BURST_PART_COUNT, (integer)5,         PSYS_SRC_BURST_RATE, (float) 0.01,          PSYS_PART_MAX_AGE, (float)1.0,         PSYS_SRC_MAX_AGE,(float) 0.0,                  // Placement Parameters:        PSYS_SRC_PATTERN, (integer)8, // 1=DROP, 2=EXPLODE, 4=ANGLE, 8=ANGLE_CONE,                // Placement Parameters (for any non-DROP pattern):        PSYS_SRC_BURST_SPEED_MIN, (float)0.3,   PSYS_SRC_BURST_SPEED_MAX, (float)0.9,         PSYS_SRC_BURST_RADIUS, 0.1,                // Placement Parameters (only for ANGLE & CONE patterns):        PSYS_SRC_ANGLE_BEGIN, (float) 0.08*PI,    PSYS_SRC_ANGLE_END, (float)0.002*PI,          // PSYS_SRC_OMEGA, <0,0,0>,                 // After-Effect & Influence Parameters:        PSYS_SRC_ACCEL, <0.0,0.0, - 2.0 >,          // PSYS_SRC_TARGET_KEY,      llGetLinkKey(llGetLinkNumber() + 1),                         PSYS_PART_FLAGS, (integer)( 0         // Texture Options:                                 | PSYS_PART_INTERP_COLOR_MASK                               | PSYS_PART_INTERP_SCALE_MASK                               | PSYS_PART_EMISSIVE_MASK                               | PSYS_PART_FOLLOW_VELOCITY_MASK                                              // After-effect & Influence Options:                         // | PSYS_PART_WIND_MASK                                     // | PSYS_PART_BOUNCE_MASK                                   // | PSYS_PART_FOLLOW_SRC_MASK                              // | PSYS_PART_TARGET_POS_MASK                              // | PSYS_PART_TARGET_LINEAR_MASK           //end of particle settings                             )        ];                if ( AUTO_START ) llParticleSystem( particle_parameters );        if(!once_is_too_often)        {            llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);        }    }    run_time_permissions(integer perm)    {        if (perm & PERMISSION_TRIGGER_ANIMATION)        {            animation = llGetInventoryName(INVENTORY_ANIMATION,0);            llStartAnimation(animation);            llOwnerSay("animation will end in 5 seconds");            llSetTimerEvent(5.0);told = TRUE;        }        else        {        }    }            timer()    {        llParticleSystem([]);        llStopAnimation(animation);        llSetTimerEvent(0.0);    }}

 

If you want your root touch to do something different, keep the script you have for the root and add in an else statement after the IF I showed you at the top, then put your code there.  Like this:

 

string animation;string  CONTROLLER_ID = "A"; // See comments at end regarding CONTROLLERS.integer AUTO_START = TRUE;   // Optionally FALSE only if using CONTROLLERS.list particle_parameters=[]; // stores your custom particle effect, defined below.list target_parameters=[]; // remembers targets found using TARGET TEMPLATE scripts.integer told;integer once_is_too_often; default{    state_entry()    {        told = FALSE;    }        touch_start(integer total_number)    {        if(!(llDetectedLinkNumber(0) == llGetLinkNumber()))// We can use a condition like this to filter from which prims touches are triggered.        {            particle_parameters = [  // start of particle settings            // Texture Parameters:            PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0),             PSYS_PART_START_SCALE, <0.04, .3, FALSE>,     PSYS_PART_END_SCALE, <.12, 0.05, FALSE>,             PSYS_PART_START_COLOR, <.6,.6,.6>,    PSYS_PART_END_COLOR, <0.3,0.4,.6>,             PSYS_PART_START_ALPHA,  (float)0.75,            PSYS_PART_END_ALPHA, (float)0.50,                           // Production Parameters:            PSYS_SRC_BURST_PART_COUNT, (integer)5,             PSYS_SRC_BURST_RATE, (float) 0.01,              PSYS_PART_MAX_AGE, (float)1.0,             PSYS_SRC_MAX_AGE,(float) 0.0,                          // Placement Parameters:            PSYS_SRC_PATTERN, (integer)8, // 1=DROP, 2=EXPLODE, 4=ANGLE, 8=ANGLE_CONE,                        // Placement Parameters (for any non-DROP pattern):            PSYS_SRC_BURST_SPEED_MIN, (float)0.3,   PSYS_SRC_BURST_SPEED_MAX, (float)0.9,             PSYS_SRC_BURST_RADIUS, 0.1,                        // Placement Parameters (only for ANGLE & CONE patterns):            PSYS_SRC_ANGLE_BEGIN, (float) 0.08*PI,    PSYS_SRC_ANGLE_END, (float)0.002*PI,              // PSYS_SRC_OMEGA, <0,0,0>,                         // After-Effect & Influence Parameters:            PSYS_SRC_ACCEL, <0.0,0.0, - 2.0 >,              // PSYS_SRC_TARGET_KEY,      llGetLinkKey(llGetLinkNumber() + 1),                                 PSYS_PART_FLAGS, (integer)( 0         // Texture Options:                                     | PSYS_PART_INTERP_COLOR_MASK                                   | PSYS_PART_INTERP_SCALE_MASK                                   | PSYS_PART_EMISSIVE_MASK                                   | PSYS_PART_FOLLOW_VELOCITY_MASK                                                  // After-effect & Influence Options:                             // | PSYS_PART_WIND_MASK                                         // | PSYS_PART_BOUNCE_MASK                                       // | PSYS_PART_FOLLOW_SRC_MASK                                  // | PSYS_PART_TARGET_POS_MASK                                  // | PSYS_PART_TARGET_LINEAR_MASK               //end of particle settings                                 )            ];                        if ( AUTO_START ) llParticleSystem( particle_parameters );            if(!once_is_too_often)            {                llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);            }        } else // Process root differently        {            // Code to process root        }    }    run_time_permissions(integer perm)    {        if (perm & PERMISSION_TRIGGER_ANIMATION)        {            animation = llGetInventoryName(INVENTORY_ANIMATION,0);            llStartAnimation(animation);            llOwnerSay("animation will end in 5 seconds");            llSetTimerEvent(5.0);told = TRUE;        }        else        {        }    }            timer()    {        llParticleSystem([]);        llStopAnimation(animation);        llSetTimerEvent(0.0);    }}

 

 

 

Share this post


Link to post
Share on other sites

I think I understand what you're trying to do.  Essentially, you want to put the particle script in both child prims and let them be activated by a touch on either the root prim or the prim that holds the script, yes?  If that's the case, your best solution may be to not put any particle scripts at all in child prims.  Just put one particle script in the root but trigger it with llLinkParticleSystem instead of lParticleSystem

integer i = llDetectedLinkNumber(0);if ( i == 1) // Root prim touched, so trigger particles in both child prims{    llLinkParticleSystem(2,particle_parameters);    llLinkParticleSystem(3,particle_parameters);}else //Trigger particles only in the touched child prim.{    llLinkParticleSystem(i,particle_parameters);}

 

 

or some variation on that theme.

Share this post


Link to post
Share on other sites

The problem I am having is I want the child prim to be the root prim and vice versa, but I want the one that is currently the root prim to be the one that emits the partical when the current child prim is touched. 

So basically when its done, the root prim will be touched and the child prim will emit particals.

Share this post


Link to post
Share on other sites

I only have one child prim in this instance, but yes I think llLinkParticleSystem is what I need, but I've been haveing a lot of trouble figuring out how to work it.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...