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

LSL Wiki : Link

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are


In Second Life, several prims can be linked together into a "linked set" (also "link" or "linkset") that act as (or, by its definition, are) a single object. Linked sets have one parent prim and 1 or more child prims. Linksets are limited to 256 prims.

Notice : It seems that a linkset can only have 255 prims + 1 sitting avatar, not 256 prims.

Link Distance

A set of prims needn't be contiguous to be linkable. They can overlap, or they can be completely separated from each other; what you see has little bearing on whether you can link them. What does matter is their size and their relative distance, measured from center to center. The set can only be linked if:

Illuminating example: I could not link a tower of five contiguous parts that was just over 40m tall. But I succeeded in linking its inner parts. Afterward, I was able to link its bottom and top parts to the inner, pre-linked segment.

Andrew Linden posted the exact formula used to calculate the distance:size ratio of prims.

Order Of Objects; The Root Prim

Second Life retains data on the specific order of parent and child objects within a linked set. The last selected prim is the parent/root. (This is probably mostly useful in scripting, but a non-scripting use is ordering behavior of multiple sit targets in a linkset.) In objects with only one prim, the object's link number is 0 (unless there is an avatar sitting on it; then it is 1). In objects with multiple prims, the root is 1 and children start at 2. So, in a 2-prim object, llGetLinkNumber would return 1 in the parent/root and 2 in the first (and only) child. Avatars seated on an object are assigned link numbers at the end of the linked set in the order seated.

If a script is in a child object's inventory, it may return different data than an object contained in the parent. The most notable example is in llSensor.

Note: Linked objects are sometimes erroneously referred to as "groups". This can be confusing when talking about both linked objects and groups of users.


Function Description
llBreakLink Delinks a specified prim from the linkset.
llBreakAllLinks Delinks all prims in the linkset.
llCreateLink Links an object to the linkset.
llDetectedLinkNumber Returns the link number of the prim a touch or collision event was triggered by.
llGetLinkKey Gets the key of a specified prim in the linkset.
llGetLinkName Gets the name of a specified prim in the linkset.
llGetLinkNumber Gets the link number of the prim containing the script.
llGetLocalPos Gets the position of the child prim relative to the root prim.
llGetLocalRot Gets the rotation of the child prim relative to the root prim.
llSetLocalRot Sets the rotation of the child prim relative to the root prim.
llGetNumberOfPrims Returns the total number of prims in the object.
llGetPos Gets the position of the prim in region coordinates.
llSetPos In a child prim, sets position relative to the root prim.
llGetRootPosition Gets the position of the root prim in region coordinates.
llGetRootRotation Gets the rotation of the root prim.
llMessageLinked Sends a message to specified prims to be recieved by other scripts using the link_message event.
llPassCollisions Toggles whether collisions with one prim in a linkset trigger collision events in scripts in other prims.
llPassTouches Toggles whether touches with one prim in a linkset trigger touch events in scripts in other prims.
llRezAtRoot Rezzes an object at the root prim's coordinates.
llSetLinkAlpha Sets the alpha of any specified prim in the object.
llSetLinkColor Sets the color of any specified prim in the object.
llSetLinkTexture Sets the texture of any specified prim in the object
llSetLinkPrimitiveParams Sets the parameters (or properties) of any linked prim in one step.


Event Description
link_message Triggered when a message sent by llMessageLinked is recieved.
changed Triggered when a prim is linked or delinked.


(used by the functions llMessageLinked, llSetLinkAlpha, and llSetLinkColor)
Constant Value Description
LINK_ROOT 1 The root prim in a linked set (but not in a single prim, which is 0)
LINK_SET -1 All prims in the object.
LINK_ALL_OTHERS -2 All other prims in the object besides the prim the function is in.
LINK_ALL_CHILDREN -3 All child prims in the object.
LINK_THIS -4 The prim the script is in.

Q: Is there a way to set the texture of another prim in the linkset?
A: Yes, use llSetLinkTexture.

Q: Can I change the order of prims in a linked object without delinking and relinking it?
A: No.

Functions | Constants | Events | Joints | Root | Parent | Child
Comments [Hide comments/form]
I have noticed that child prims will not receive touch events--even if they have a touch_* handler--if the root prim does not have an active touch handler.
-- GregoryGlinka (2006-11-08 19:10:20)
Sounds like a bug. Report it.
-- BlindWanderer (2006-11-10 11:32:55)
Why is there no llGetLinkPos()? alternatively, why can't you call llGetLocalPos() with a link number argument?
-- ResultsTiki (2006-12-02 19:17:09)
ResultsTiki: Because LSL is egregiously feature-incomplete. It's evolved based upon what people have wanted to do with it, and is still very much in a state of flux. Those are very good suggestions, and I can think of any number of projects I'd like to use them for, but I haven't heard of any plans to add them.
-- CatherineOmega (2006-12-03 14:02:58)
CatherineOmega: Thanks! I've been trying to find time to read through all the to see if this has been suggested yet but the list is very long. It might be trivial to implement for LL and it certainly is "missing." I also just IMed Kelly Linden for advice on how to proceed now that his suggestion cylinder mentioned at LSLFunctionRequest is no longer there.
-- ResultsTiki (2006-12-11 22:23:30)
There are nasty race conditions due to llBreakLink().

Anything that is dependent on link numbers will not be guaranteed to work if a script in
any linked object calls llBreakLink(). Even llBreakLink(llGetLinkNumber()) isn't guaranteed
to do the right thing, because if another script is doing the same thing at the same time,
the link number might change between the call to llGetLinkNumber() and the call to llBreakLink()!

In general the instability of link numbers makes anything that tries to restructure an object
significantly more complicated if not impossible. Even sorting the link numbers in reverse order and operating
on them in that order does not appear to guarantee the stability of the lower link numbers.

The right solution to this is to get rid of link numbers from the API and make the link functions work in
terms of something stable, like keys.

Another kind of solution to part of this mess would be to provide mutual exclusion or critical sections or something
else to allow short sequences of operations (like llBreakLink(llGetLinkNumber()) ) to be done atomically.
-- SumiIzumi (2006-12-14 17:30:42)
Attach a comment to this page: