The integer constant PRIM_LINK_TARGET has the value 34

Used to get or set multiple links with a single PrimParameters call.

Syntax

integer PRIM_LINK_TARGET = 34;

Usage

llSetPrimitiveParams([ PRIM_LINK_TARGET, integer link_target ]);

integerlink_targetLink number (0: unlinked, 1: root prim, >1: child prims and seated avatars) or a LINK_* flag

The same syntax applies to llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast but with an additional prefixed link parameter in the function call.

llGetPrimitiveParams([ PRIM_LINK_TARGET, integer link_target ]);

Returns the list [  ]

integerlink_targetLink number (0: unlinked, 1: root prim, >1: child prims and seated avatars) or a LINK_* flag

The same syntax applies to llGetLinkPrimitiveParams, but with an additional prefixed link parameter in the function call.

Caveats

Examples

default
{
    touch_start(integer num_detected)
    {
    //  color the root prim red and the first linked-prim green
        llSetLinkPrimitiveParamsFast(LINK_ROOT,
                [PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, (float)TRUE,
            PRIM_LINK_TARGET, 2,
                PRIM_COLOR, ALL_SIDES, <0.0, 1.0, 0.0>, (float)TRUE]);

    //  instead of:
    //  llSetLinkPrimitiveParamsFast(LINK_ROOT,
    //          [PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, (float)TRUE]);
    //  llSetLinkPrimitiveParamsFast(2,
    //          [PRIM_COLOR, ALL_SIDES, <0.0, 1.0, 0.0>, (float)TRUE]);
    }
}
//  assume that you have a global list "gPanels" loaded with the link numbers of prims
//  named "panel" and that the global integer parameter "gON" has been defined ....

    touch_start(integer num)
    {
    //  basic on/off switch
        gON = !gON;

    //  conditions which will change on touch
    //  white panel
        list WhichWay = [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, (float)TRUE];

        if (gON)//  red panel
            WhichWay = [PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, (float)TRUE];

    //  to accumulate the parameter list that will be affected by SLPPF in this event
        list params;
        integer numberOfPrims = llGetNumberOfPrims();

    //  Links in a linkset start numbering with 1
        integer index = 1;
        do
        {
        //  build the parameters list, in the format PRIM_LINK_TARGET, link number, parameters
            params += [PRIM_LINK_TARGET, llList2Integer(gPanels, index)] + WhichWay;
        }
        while (++index < numberOfPrims);

    //  apply the parameters to all "panel" prims
        llSetLinkPrimitiveParamsFast(LINK_SET, params);
    }

Notes

Link Numbers

Each prim that makes up an object has an address, a link number. To access a specific prim in the object, the prim's link number must be known. In addition to prims having link numbers, avatars seated upon the object do as well.

When an avatar sits on an object, it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without unseating all avatars first.

Counting Prims & Avatars

There are two functions of interest when trying to find the number of prims and avatars on an object.

integer GetPrimCount() { //always returns only the number of prims
    if(llGetAttached())//Is it attached?
        return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
    return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}

See llGetNumberOfPrims for more about counting prims and avatars.

Errata

If a script located in a child prim erroneously attempts to access link 0, it will get or set the property of the linkset's root prim. This bug (BUG-5049) is preserved for broken legacy scripts.

See also

Constants

FlagDescription
LINK_ROOT1refers to the root prim in a multi-prim linked set[3]
FlagDescription
LINK_THIS-4refers to the prim the script is in

Functions

Articles

Deep notes

PRIM_TYPE top_size and client taper conversion

RangeTop
Tapered
No
Tapering
Bottom
Tapered
Client≥ -1, ≤ 11.00.0-1.0
PRIM_TYPE≥ 0, ≤ 20.01.02.0
LEGACY≥ 0, ≤ 10.01.0NA
Client < 1.11≥ 0, ≤ 10.01.0NA

top_size Explained

When the original PRIM_TYPE interface was retired (PRIM_TYPE_LEGACY, SL 1.5), the new PRIM_TYPE interface did not yet support tapering of the bottom of the prim, this feature wasn't added until SL 1.11 (two years later). Instead of retiring the new PRIM_TYPE when it was added, the range of top_size was enlarged; meanwhile in the client they redefined the parameter and it's values. This redefinition and range enlargement resulted in two interfaces that did the same thing but achieved it through different values. Meanwhile PRIM_TYPE_LEGACY's interface was not updated to support tapering of the bottom of the prim. Consequently all three interfaces have different ranges, making for a rather nasty caveat.

Issues

Footnotes

  1. The pipe character historically has been used to separate fields in the serialized version of inventory and possibly other internal fields for prim parameters.
  2. Floating text with an alpha set to 0.0 is rendered "invisible"
  3. LINK_ROOT does not work on single prim objects. Unless there is an avatar sitting on the object.