Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Adding prims without changing existing link numbers

Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-03-2007 10:20
Okay, this is driving me nuts:
I have a fairly complex, prim-heavy object; it is controlled by a single script in the root which then uses llSetLinkPrimitiveParams() to assign values to child-links as required, reducing the script count to one per object (plus any special effects).

However, I now want to add a prim. Problem is, all the link numbers are hard-coded, and if I add a prim simply by selecting the new prim, then the existing object and linking, then it changes the order of all the link numbers which completely destroys the order that I want, breaking the script completely.

Is there some technique to linking new prims to an exisiting object without altering any of the existing link-numbers, or at least restoring them at the end?

I know this is really building, but regular builders tend not to give a damn about link-numbers so I figure it's more a scripting issue.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Ultralite Soleil
Registered User
Join date: 31 Aug 2006
Posts: 108
06-03-2007 10:30
I have the same problem. If you find out a way, let me know. Here is my workaround: I have a function called IdentifyChildren called from state_entry that loops over all prims in the linkset, comparing their names with some hardcoded prim names that I care about. If a name matches, I store the link number of that prim in a unique variable. Whenever I need to send a message to that prim, I use the stored link number.

This way, you can avoid hardcoding the link numbers, but you do have to hardcode the names of the prims you care about. When the link numbers change (due to unlinking/relinking), you have to remember to reset the script, which calls state_entry, which calls IdentifyChildren.

I'd love a simpler way to deal with this.
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
06-03-2007 10:51
From: Ultralite Soleil
When the link numbers change (due to unlinking/relinking), you have to remember to reset the script, which calls state_entry, which calls IdentifyChildren.
You could just have the script call IdentifyChildren whenever changed( CHANGED_LINK ) is raised. Though, this would also happen when sat/unsat upon, but you could easily disable that once building is complete.
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-03-2007 11:47
Currently my solution is to have a link-offset. If I add two new prims, I just put the offset up by two, since the new prims seem to be added BEFORE the previous ones.
I just find it odd that if I select two new prims, THEN select the original object, that the first selected end up as the 'top' two children.

I would have thought it should add linked-sets in order, so the root is still root, prim 2 is still prim 2 etc. Then if you add linked sets to linked sets, they maintain their ordering, even if the link numbers themselves have increased.

Is there anything out there that relies on this behaviour? I think I'm going to list it as a bug on the Jira as it seems wrong to me.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
06-04-2007 08:10
Try this:
1. Unlink the Object
2. Deselect the root
3. Select the new prims
4. Reselect the root
5. Relink

Might work (but I haven't tried).