Linksets
An object is a linkset: one root prim plus any child prims, moving and rezzing as a unit. Each prim has a link number. The root is 1 when there are several prims, and 0 in a single-prim object. Seated avatars are added after the prims.
Most prim functions have a Link variant that works on any prim by link number, so one script can control the whole object. What a single prim looks like is covered by Prims.
Concepts
- Every prim has a link number; the object has a number of prims (including seated avatars) and a prim count
- Special link constants address the root, this prim, all prims, all others or all children
Namesandkeyshelp find a prim by role instead of by number, because numbers change when the object is relinked
LinkingandunlinkingneedPERMISSION_CHANGE_LINKSfrom the owner- The
changedevent reportsCHANGED_LINK
- The
- One script can
setorreadmany properties of any prim, or several prims, in one call- Scripts in different prims talk with link messages
- The object as a whole has a root position, a bounding box, a
massand an owner, and can bescaledas a unit- Details of other objects are read by key
- Objects in inventory can be
rezzedwith a position, velocity and parametersllRezObjectWithParamssets many properties at rez time- The child receives the start parameter in
on_rez - Objects can delete themselves or derez others they own
Functions and events
integer | llGetLinkNumber() |
integer | llGetNumberOfPrims() |
string | llGetLinkName(integer link) |
key | llGetLinkKey(integer link) |
void | llCreateLink(key target, integer parent) |
void | llBreakLink(integer link) |
void | llSetLinkPrimitiveParamsFast(integer link, list rules) |
list | llGetLinkPrimitiveParams(integer link, list params) |
void | llMessageLinked(integer link, integer num, string str, key id) |
key | llRezObjectWithParams(string item, list options) |
event | on_rez(integer start_param) |
event | changed(integer changes) |
Rezzing
Rez objects from inventory, pass them a start parameter or string, and derez them later.
Scripting Details
Link numbers functions
Section titled “Link numbers functions”integer | llGetLinkNumber()Returns the integer link number of the prim containing the script (0 for unlinked, 1 for the root, and 2+ for children). |
integer | llGetNumberOfPrims()Returns an integer representing the total number of prims and seated avatars in the linkset containing the script. |
integer | llGetObjectPrimCount(key prim)Returns an integer representing the total number of prims in the object containing the specified prim. |
string | llGetLinkName(integer link)Returns a string containing the name of the linked prim specified by link. |
key | llGetLinkKey(integer link)Returns the key (UUID) of the linked prim or avatar specified by link. |
integer | llGetLinkNumberOfSides(integer link)Returns an integer representing the number of sides (faces) of the linked prim specified by link. |
integer | LINK_ROOT = 1Refers to the root prim of the linkset. |
integer | LINK_SET = -1Refers to every prim in the linkset. |
integer | LINK_THIS = -4Refers specifically to the single prim containing the running script. |
integer | LINK_ALL_OTHERS = -2Refers to every other prim in the linkset, excluding the prim containing the script. |
integer | LINK_ALL_CHILDREN = -3Refers to all child prims in the linkset (every prim except the root). |
Linking and unlinking
Section titled “Linking and unlinking”void | llCreateLink(key target, integer parent)Attempts to link the object containing the script with target. Requires the PERMISSION_CHANGE_LINKS runtime permission. |
void | llBreakLink(integer link)Delinks the prim specified by the link number link. Requires the PERMISSION_CHANGE_LINKS runtime permission. |
void | llBreakAllLinks()Delinks all prims in the linkset. Requires the PERMISSION_CHANGE_LINKS runtime permission, which must be requested and granted by the owner. |
event | changed(integer changes)Triggered when various properties of the object change. The parameter changes is a bitfield of CHANGED_* flags. |
integer | CHANGED_LINK = 0x20Number of prims making up the object or avatars seated on it has changed. Also occurs when duplicating a linked object or when a prim changes type or shape. Does not trigger on attach/detach, sit/unsit in attachments, or single prim duplication. |
integer | PERMISSION_CHANGE_LINKS = 0x00080Runtime permission that allows the script to successfully create, break, or modify links to other objects using llCreateLink, llBreakLink, or llBreakAllLinks. |
Controlling every prim
Section titled “Controlling every prim”void | llSetLinkPrimitiveParamsFast(integer link, list rules)Sets primitive parameters for the linked prim link according to rules with no built-in script sleep delay. |
list | llGetLinkPrimitiveParams(integer link, list params)Returns a list of primitive parameters requested in params for the linked prim specified by link (equivalent to llGetPrimitiveParams). |
void | llSetLinkColor(integer link, vector color, integer face)Sets the Blinn-Phong diffuse RGB color of face on the linked prim link. |
void | llSetLinkAlpha(integer link, float alpha, integer face)Sets the Blinn-Phong alpha (transparency) of face on the linked prim link. |
void | llSetLinkTexture(integer link, string texture, integer face)Applies texture (UUID or inventory name) to face of the linked prim link. |
void | llMessageLinked(integer link, integer num, string str, key id)Triggers a link_message event, sending num, str, and id to the scripts in the prim(s) specified by link to allow scripts within the same object to communicate. |
The object as a whole functions
Section titled “The object as a whole functions”vector | llGetRootPosition()Returns a vector representing the position (in region coordinates) of the root prim of the linkset containing the script. |
rotation | llGetRootRotation()Returns a rotation representing the orientation (relative to the region) of the root prim of the linkset containing the script. |
list | llGetBoundingBox(key object)Returns the bounding box of object (including any linked prims) relative to its root prim in local coordinates, formatted as [ (vector) min_corner, (vector) max_corner ]. |
vector | llGetGeometricCenter()Returns a vector representing the geometric center of the object relative to its root prim. |
vector | llGetCenterOfMass()Returns the vector position (in region coordinates) of the center of mass. Returns the individual child prim's center of mass if called from a child, or the entire linkset's center of mass if called from the root. |
float | llGetObjectMass(key id)Returns a float representing the mass of the avatar or object specified by id. |
list | llGetObjectDetails(key id, list params)Returns a list containing the requested parameters of the specified avatar or object id, retrieved in the order requested by params. |
key | llGetOwnerKey(key id)Returns the key (UUID) of the owner of the prim specified by id. |
key | llGetCreator()Returns the key (UUID) of the prim's original creator. |
integer | llScaleByFactor(float scaling_factor)Attempts to uniformly resize the entire object by scaling_factor, maintaining size-position ratios of the prims. Fails if the linkset is physical, a pathfinding character, in keyframed motion, would exceed prim scale/linkability limits, or would overflow parcel capacity. |
float | llGetMaxScaleFactor()Returns a float representing the maximum scale factor that can be applied to the object via llScaleByFactor without violating size or linkability limits. |
float | llGetMinScaleFactor()Returns a float representing the minimum scale factor that can be applied to the object via llScaleByFactor without violating size limits. |
Rezzing objects functions
Section titled “Rezzing objects functions”key | llRezObjectWithParams(string item, list options)Instantiates the named inventory object (defaulting to the rezzing prim's position unless REZ_POS is specified) using the initial set of parameters specified in options. Returns the key of the rezzed object, or a blank key on failure. |
void | llRezObject(string item, vector pos, vector vel, rotation rot, integer start_param)Instantiates the named inventory object with the bounding box centered at pos with velocity vel and rotation rot, passing param as the on_rez start parameter. The vel parameter is ignored if the rezzed object is non-physical. |
void | llRezAtRoot(string item, vector pos, vector vel, rotation rot, integer start_param)Instantiates the named inventory object with the root prim at pos with velocity vel and rotation rot, passing start_param as the on_rez start parameter. The vel parameter is ignored if the rezzed object is non-physical. |
event | object_rez(key id)Triggered when this object successfully rezzes another object from its inventory. Passes the key (UUID) id of the newly rezzed object. |
event | on_rez(integer start_param)Triggered when the object is rezzed into the world (by a script or user). Passes start_param from the rezzing call (or 0 if rezzed from inventory). Also triggers on attachments during login or when attached from inventory. |
integer | llGetStartParameter()Returns an integer representing the start/rez parameter passed to the object on creation (returns 0 if rezzed by an agent). |
string | llGetStartString()Returns the initialization string passed to the object's root prim on rez with llRezObjectWithParams (via REZ_PARAM_STRING; returns an empty string if rezzed by an agent). |
void | llDie()Deletes the entire object containing the script (the object does not go to inventory). Use llBreakLink first to delete only a single prim. |
integer | llDerezObject(key id, integer flags)Derezzes (deletes or returns) a targeted object in the region previously rezzed by a script in this linkset, returning TRUE on success or FALSE on failure. |
void | llGodLikeRezObject(key id, vector pos)Rezzes an object directly from a UUID specified by id at the position pos, provided the owner has the god-bit set. |
Additional
- Link functions take a link number or a link constant (some take only one link)
llGetObjectDetails—OBJECT_*details of any object by keyllRezObjectWithParams—REZ_*parameters and flagsllDerezObject— derez modesDEREZ_DIE— immediately delete (kill) the object
Link numbers
Section titled “Link numbers”See also Page Guide: working with link numbersPage Guide: linkset resources (reusable prims)
The object as a whole
Section titled “The object as a whole”Constant groups ObjectDetailsParam 56
See also Category Object Target
Rezzing objects
Section titled “Rezzing objects”Constant groups RezParam 13RezFlag 8DerezMode 3
See also Category RezSL Wiki LSL RezSL Wiki Script library: rezzers
Related
Section titled “Related”See also Category Linkset TargetFeature PrimsFeature Inventory