Jump to content

trying to work with a link set script


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

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

Recommended Posts

hi there. I am trying to work with a script that involves with putting in link set numbers to give me the option to hide or show a prim.

I realize every time I relog the link set numbers change.

 EX; I have three different prim shapes. A heart a sphere and a star but I specifically want to hide all but the heart. I find the link set # from each prim and put them into the script as formatted and turns out it will hide the prim I did not desire to be hidden.

this happens while I'm logged on configuring the process and relogging to restart the progress over again. I'm aware this issue is on my end.

what can I do to specifically hide the mesh I need hidden?

Link to post
Share on other sites

Name the links and then collect the link numbers in state_entry

integer len = llGetNumberOfPrims();
integer i;
if (i < len)
{
    ++i;
    name = llGetLinkName(i);
    if (name == "Heart")
    {
        iHeart = i;
    }
}

Save iHeart as a global integer variable.  Then direct your actions at iHeart when you want that specific link.

Edited by Rolig Loon
  • Like 1
Link to post
Share on other sites
On 11/27/2020 at 8:07 PM, Rolig Loon said:

Name the links and then collect the link numbers in state_entry




integer len = llGetNumberOfPrims();
integer i;
if (i < len)
{
    ++i;
    name = llGetLinkName(i);
    if (name == "Heart")
    {
        iHeart = i;
    }
}

Save iHeart as a global integer variable.  Then direct your actions at iHeart when you want that specific link.

When speed isn't particularly an issue, I like to take that same method and turn it into a function... it also avoids  having to have a change event handler to detect when the linkset is changed.

integer NameToLink(string name)
{
	integer count = llGetNumberOfPrims();
	integer i;

	while (i < count)
	{
		++i;
		if (llGetLinkName(i) == name) return i;
	}
    
	return 255;
}

// Now you can reference prims by name instead of number anywhere in your code...

llSetLinkPrimitiveParamsFast(NameToLink("Knob"), [ PRIM_COLOR, ALL_SIDES, <1, 0, 1> , 1 ]);

 

Edited by Phate Shepherd
  • Like 1
Link to post
Share on other sites
On 11/27/2020 at 7:47 PM, y2kcee said:

I realize every time I relog the link set numbers change.

linkset numbers don't change unless you add/remove/relink prims in the object. What does happen is that the viewer goes stupid and incorrectly tells you what the link numbers are. I know Firestorm does it, not sure about others. Relogging is one way to see the correct link numbers again... picking the item up and re-rezzing should too.

  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 86 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...