Safe re-linking

Most NS peripherals use hardcoded link and face numbers to control lighting effects. This means that using normal methods to link objects together will result in colouring malfunctions. The following procedure is safer and less likely to cause problems (although you should always make a backup first.)

Three principles govern the ordering of link number assignments:

I. The root prim of the

[A, B] + [C] = [C, A, B]

II. Other selected objects are inserted

[A, B] + [C, D] = [C, A, B, D]

III. When objects are removed from a link set, they are always assigned link number 0 (unlinked). Other link numbers are decremented, so:

[A, B, C, D, E] – [A, B, D] = [C, E] [A] [B] [D]

With the above in mind, our goal is to append one list to another, so that the original linkset's numbers are undisturbed. This is accomplished by the following instructions:

1. We start with the following two linksets:

[A, B, C, D, E, F] [G, H, I, J]

2. Remove the first link from the destination set, i.e. the one that should be the final root prim. If you're adding to a main controller, this will be the root prim of the controller itself. By rule III, we perform:

[A, B, C, D, E, F] – [A] = [A] [B, C, D, E, F]

3. Link the

[G, H, I, J] + [A] = [A, G, H, I, J]

4. Now insert the remainder of the original destination linkset. Using rule II, this operation can be written as:

[A, G, H, I, J] + [B, C, D, E, F] = [A, B, C, D, E, F, G, H, I, J]

Done! If the link numbers do not appear correct after this operation is done correctly, see the caveat above.

## How link numbers work

Three principles govern the ordering of link number assignments:

I. The root prim of the

**last**object selected is set to be link number 1:[A, B] + [C] = [C, A, B]

II. Other selected objects are inserted

**immediately after**the root prim, so that linking two objects together results in interleaving:[A, B] + [C, D] = [C, A, B, D]

III. When objects are removed from a link set, they are always assigned link number 0 (unlinked). Other link numbers are decremented, so:

[A, B, C, D, E] – [A, B, D] = [C, E] [A] [B] [D]

*Caveat*. Some SL viewers will incorrectly display the link numbers—they insert the new prims at the

*end*of the last-selected linkset. Usually this can be corrected by re-rezzing the object or by relogging. Large attachments often get their link numbers scrambled as well, although the root prim is always reliable. The server obeys the above rules, however, regardless of what your UI tells you.

## Appending linksets

With the above in mind, our goal is to append one list to another, so that the original linkset's numbers are undisturbed. This is accomplished by the following instructions:

1. We start with the following two linksets:

[A, B, C, D, E, F] [G, H, I, J]

2. Remove the first link from the destination set, i.e. the one that should be the final root prim. If you're adding to a main controller, this will be the root prim of the controller itself. By rule III, we perform:

[A, B, C, D, E, F] – [A] = [A] [B, C, D, E, F]

3. Link the

*new*linkset to the final root prim. Remember rule I, that you must select the root prim (A) last.[G, H, I, J] + [A] = [A, G, H, I, J]

4. Now insert the remainder of the original destination linkset. Using rule II, this operation can be written as:

[A, G, H, I, J] + [B, C, D, E, F] = [A, B, C, D, E, F, G, H, I, J]

Done! If the link numbers do not appear correct after this operation is done correctly, see the caveat above.