Jump to content

Change properties of child object when clicked


Olivia Rizzo
 Share

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

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

Recommended Posts

Hello I am totally new to this (first day) so please bear with me on wrong terminology. I have searched but not found the answer.

I have made a prim to be a light source, and put this script into it. Now clicking it the light switches on and off. Success! But....

integer on_off = FALSE; //STARTS IN THE OFF POSITION

default
{
    touch_start(integer total_number)
    {
        if (on_off == TRUE)
        {
            llSetPrimitiveParams([
                PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75,
                PRIM_GLOW ,ALL_SIDES,0,
                PRIM_FULLBRIGHT, 3, TRUE
            ]);
            llOwnerSay("You switched off the light");
            on_off = FALSE;                            
        }
 
        else
        {
            llSetPrimitiveParams([
                PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75,
                PRIM_GLOW ,ALL_SIDES,1,
                PRIM_FULLBRIGHT, 3, FALSE
            ]);
            llOwnerSay("You switched on the light");
            on_off = TRUE;  
        }
    }
}

 

Now I want the light source to be just one part of a linked set of prims. How do I make it so that if you click on the 'grouped' items the light source itself (which is only one of the linked items) turns on and off but the other items are not affected?

I am wondering if there is a way to say which one of the 'child' prims should be targeted by the `llSetPrimitiveParams()` command?

Thank you in advance :)

Link to comment
Share on other sites

Hiya - thank you


The first link just went to the top of the page for llSetPrimitiveParams which I was already looking at so I was a bit confused.

I did see something about llSetLinkPrimitiveParamsFast but thought it was just the same apart from not having a delay. To be honest I'm currently finding those LSL Wiki pages a bit overwhelming! 😰But I can follow examples and see what happens when I change things.

I can see they have this example:

llSetLinkPrimitiveParamsFast(2, params);

Is it that number 2 that I need to use to set which object to set the parameters for? Where do I find the number for each prim?

Link to comment
Share on other sites

8 minutes ago, livb89 said:

Hiya - thank you


The first link just went to the top of the page for llSetPrimitiveParams which I was already looking at so I was a bit confused.

I did see something about llSetLinkPrimitiveParamsFast but thought it was just the same apart from not having a delay. To be honest I'm currently finding those LSL Wiki pages a bit overwhelming! 😰But I can follow examples and see what happens when I change things.

I can see they have this example:


llSetLinkPrimitiveParamsFast(2, params);

Is it that number 2 that I need to use to set which object to set the parameters for? Where do I find the number for each prim?

The third block down tells you what you needed. Link numbers start a 0. Issue is that when in edit object the link number does not match the true number. If you have only a few prims you can just manually change the number. Twenty odd you have to do a search by name. IDK why it is wrong in the object edit.

Edited by steph Arnott
Link to comment
Share on other sites

Just now, livb89 said:

This block here (attached pic)? It says ">1: child prims and seated avatars" 

Should I just try all numbers till I find which one it is?

Thank you

Screenshot 2019-02-27 14.44.04.png

If it a few prims then click edit and check the linked prim box and click the reqiured prim  the number is usually 1 either side of what is said.

  • Thanks 1
Link to comment
Share on other sites

llSetPrimitiveParams has two other variants, llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast. Since they're so closely related, they're all stored on the same wiki page... which unfortunately can make it seem daunting - especially with the plethora of options already available to the commands.

The short version is that the "linked" variants contain an extra parameter: an integer which denotes the linknumber of the child prim you wish to target in the linkset. Additionally, llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast are identical save for how long they take to execute. The first command has a built in delay of 0.2 seconds, while the "fast" variant has no such delay.

For finding link numbers, you can temporarily add a touch event that runs a command which will speak the link number of the child prim clicked. See this page for the example: http://wiki.secondlife.com/wiki/LlDetectedLinkNumber

Edited by Fenix Eldritch
typos
  • Thanks 1
Link to comment
Share on other sites

2 minutes ago, Fenix Eldritch said:

llSetPrimitiveParams has two other variants, llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast. Since they're so closely related, they're all stored on the same wiki page... which unfortunately can make it seem daunting - especially with the plethora of options already available to the commands.

The short version is that the "linked" variants contain an extra parameter: and integer which denotes the linknumber of the child prim you which to target in the linkset. Additionally, llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast are identical save for how long they take to execute. The first command has a build in delay of 0.2 seconds, while the "fast" variant has no such delay.

 For finding link numbers, you can temporarily add a touch event that runs the a command which will speak the link number of the child prim clicked. See this page for the example: http://wiki.secondlife.com/wiki/LlDetectedLinkNumber

Awesome, thank you so much! The context is super helpful. I will give it a go now :)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1876 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...