Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

using llSetLinkColor for multiple links?

JoeTheCatboy Freelunch
Registered User
Join date: 14 Jun 2006
Posts: 42
12-30-2006 12:18
How would I use llSetLinkColor on multiple links? would they be OR'd together, or AND'd? or... something else I don't know? For instance, let's say I have these constants
PRIMSWITHTHISCOLOR1 = (link numbers 1, 2, 3, 4)
PRIMSWITHTHISCOLOR2 = (link numbers 5, 6 ,7 ,8)

can I do that, or is that not possible? My current thought is either | them or & them (1 | 2 | 3 | 4) or (1 & 2 & 3 & 4)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-30-2006 12:26
From: JoeTheCatboy Freelunch
How would I use llSetLinkColor on multiple links? would they be OR'd together, or AND'd? or... something else I don't know? For instance, let's say I have these constants
PRIMSWITHTHISCOLOR1 = (link numbers 1, 2, 3, 4)
PRIMSWITHTHISCOLOR2 = (link numbers 5, 6 ,7 ,8)

can I do that, or is that not possible? My current thought is either | them or & them (1 | 2 | 3 | 4) or (1 & 2 & 3 & 4)



Afraid it doesnt work like that. You can either specify a link number or a link constant but thats it.
JoeTheCatboy Freelunch
Registered User
Join date: 14 Jun 2006
Posts: 42
12-30-2006 13:54
Thanks for your help, I figured out an alternative.

To anyone who wants to do the same thing, create a constant list with the integer prims you want

list EXAMPLE = [1,2,3,4,5]

and then loop through and change the color (or alpha) for the index of the list
CODE

for (integer i = 0; i < llGetNumberOfPrims(); i++)
{
llSetLinkColor(llList2Integer(EXAMPLE,i),color,face);
}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
12-30-2006 15:29
yep, or if its a contiguious block just a straight while loop
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
12-30-2006 16:13
In the non-contiguous case, bound the loop with llGetListLength() instead of llGetNumberOfPrims(), as they will not be equal.

Otherwise the ROOT prim will always get colored even if not selected.

CODE

integer len = llGetListLength(EXAMPLE);
for (integer i = 0; i < len; i++)
{
llSetLinkColor(llList2Integer(EXAMPLE,i), color, face);
}


-peekay

ps. in a linked object, link numbers zero and one both refer to the root prim.