Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

making only certain linked objects hide

Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
06-09-2006 07:23
I was womdering tif there was a way to make only certain objects that are linked together to hide and appear leaving the others untouched? I was going to do a search for it here in the forums but got lazy. If anyone can help please reply here or send me an im in game. thanks.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
06-09-2006 09:07
llSetLinkAlpha is your friend.
Xixao Dannunzio
Owner, X3D Enterprises
Join date: 20 Mar 2006
Posts: 114
06-10-2006 01:13
...that, or...

Send a Linked Message to the set with "Hide" or "Show", and setup listeners on the pieces to be hidden, calling llSetAlpha() as necessary.
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
06-10-2006 04:40
I'm with BamBam on this one, llSetLinkAlpha is the one you want, I'm afraid Xixao's method although appearing to be simpler would be a lot harder on the sim (see the following thread: /54/8f/105133/1.html)

This is how I would do it:

CODE

integer toggle = TRUE;
list links_to_alpha_1;
list links_to_alpha_2;
integer x;

list find_links(string names)
{
list links_to_alpha = [];
for(x=0;x<=llGetNumberOfPrims();++x)
{
if (llGetLinkName(x) == names)
{
links_to_alpha += x;
}
}
return links_to_alpha;
}

set_alpha(list links_to_alpha, float alpha)
{
for(x=0;x<llGetListLength(links_to_alpha);++x)
{
llSetLinkAlpha(llList2Integer(links_to_alpha,x),alpha,ALL_SIDES);
}
}

default
{
state_entry()
{
links_to_alpha_1 = find_links("part_1");
links_to_alpha_2 = find_links("part_2");
}

changed( integer change ) // update the link number records whenever the linked set is changed
{
if ( change == CHANGED_LINK )
{
links_to_alpha_1 = find_links("part_1");
links_to_alpha_2 = find_links("part_2");
}
}

touch_start(integer total_number)
{
toggle = !toggle;
if (toggle)
{
set_alpha(links_to_alpha_1,1.0);
set_alpha(links_to_alpha_2,0.0);
}
else
{
set_alpha(links_to_alpha_1,0.0);
set_alpha(links_to_alpha_2,1.0);
}
}
}