Don't click here unless you want to be banned.

LSL Wiki : llCreateLink

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawling22.us.archive.org
llCreateLink(key target, integer parent)

Attempts to link the object containing the script and target (requires that permission PERMISSION_CHANGE_LINKS be set). If parent == TRUE, the object calling this function will be the parent prim of the new link set, and the target prim will become that parent's first child (inserted before any children the parent might have already had).

Notes:

The target doesn't require any script permission at all but does require that both objects' owners be the same and each object has modify permission.

Once the target has been linked, its changed event will be triggered with CHANGED_LINK. The target will then also be able to receive link_message events.

Q: What happens if the target is itself a linked object? Do links form trees, or are all the children of the target treated as children of the current object?
A: No, links are not trees. When one object links another, the new prims are added in the order in which they were added to the original object. Suppose we have Object A, consisting of three prims, [A1, A2, A3], and Object B, consisting of [B1, B2, B3]. Upon linking, the new object's link order would be [A1, B1, A2, A3, B2, B3]. This is the case with both linking via llCreateLink and the editing tools.
A: This may have changed recently. Currently, it appears that when linking two sets like those above, the resulting link-order will be [A1, B1, B2, B3, A2, A3], or more generally, [A1, (set of B in order), (rest of A in order) ].

Q: So is there a way to link two objects, with a resulting object's link order of [A1, A2, A3, B1, B2, B3]?
A: Not directly. Not only can you not specify where prims will end up in the resulting object, but you also can't selectively set a prim's position in the linkset. To accomplish this, you'd have to either break all links in the second object (and link its prims individually), or link it, delinking and relinking them individually. This second option is likely better, despite the extra step, as it could be more easily automated, and doesn't necessarily require the second object contain any scripts at all.

To break a link, use llBreakLink. To break all links, use llBreakAllLinks.


Functions | Link
Comments [Hide comments/form]
My apologies, I daftly neglected to use a sensible user name instead of CPE000c4177ae88-CM014290122096.cpe.net.cable.roger.
-- GenePoole (2005-01-18 23:44:33)
What happens if the target is itself a linked object? Do links form trees, or are all the children of the target treated as children of the current object?
-- ZenoConcord (2005-07-17 13:48:56)
As of now, links are not trees. If you link one set to another, both sets are considered to be the children of the parent of whatever set you selected last. If you link a set A to child prim of set B, (by calling llCreateLink in one of set B's children), and specifying TRUE for the parent parameter, Im not quite sure what happens. More the likely however, the parent of set B before the linking becomes the parent of both sets. The other option would be that after the linking, the child that called llCreateLink becomes the parent of both sets.
-- ChristopherOmega (2005-07-17 19:19:16)
I get a 'Link failed - avatar sitting on an object being linked' when I try to link an object to a worn object - what's up with that?
-- StefanNilsson (2005-11-10 12:08:03)
you can't (un)link attachments.
-- BlindWanderer (2005-11-10 14:24:06)
I get the message "Link failed -- pieces too far apart". What is the max distance between the pieces?
-- RaffaelePirandello (2006-01-14 12:31:12)
Link distance is dependent on the size, or mass (basically size, since we cannot affect density much) of the prims involved. I believe there is an official formula laying around somwhere, but basically, two 10x10x10 cubes have the greatest link distance and two 0.01x0.01x0.01 cubes obviously have the smallest. Someone correct me if I'm wrong?
-- StPsaltery (2006-01-14 21:48:30)
I think the comment about "doesn't require any permission" needs to be altered; it does require modify permission.
-- YumiMurakami (2006-02-06 07:23:50)
Is there a way to create a joint in this manner as well?
-- DedricMauriac (2006-03-02 19:06:33)
Nope, sorry dude - the joint API was never exposed to LSL.
-- ChristopherOmega (2006-03-03 08:07:49)
I'm getting an odd message that occurs at random (or so it seems). When I'm having a script link together some groups of objects (one cluster is 120 prims, another is 4, another is 5), I get "Link failed - too many primitives". The weird thing is all of the prims do link together despite this message, and of course it's well under the 256 prim limit.
-- SpiritfireMusketeer (2006-10-04 15:42:42)
I'd like to see an example of this in a script. I am confused as how to set it all up.
-- CJSF
-- 158-147-180-115.harris.com (2007-09-11 04:23:11)
Attach a comment to this page: