Difference between revisions of "PRIM LINK TARGET"

From Second Life Wiki
Jump to navigation Jump to search
m (renaming)
m
Line 5: Line 5:


{{#vardefine:link_target_const|{{LSL Const|PRIM_LINK_TARGET|integer|34|c=Used to set the link target of {{GetSet|{{{1|}}}|llGetPrimitiveParams|llSetPrimitiveParams}}}}}}
{{#vardefine:link_target_const|{{LSL Const|PRIM_LINK_TARGET|integer|34|c=Used to set the link target of {{GetSet|{{{1|}}}|llGetPrimitiveParams|llSetPrimitiveParams}}}}}}
{{#ifeq:{{{1|}}}|set||
Only run this if it's a get.
{{#vardefine:caveats|{{#var:caveats}}
*If {{#ifeq:{{{2}}}|link|'''link''' (or}} {{#var:link_target_const}}'s '''{{LSL Param|link_target}}'''{{#ifeq:{{{2}}}|link|)}} describes a seated avatar...
** Flags not explicitly mentioned have obvious values.
** {{#var:name_const}} will return the avatar's {{LSLGC|Legacy Name|legacy name}}.
** {{#var:desc_const}} will return <code>{{HoverText|{{String}}|An empty string}}</code>.
** {{#var:type_const}} will return <code><nowiki>[</nowiki>[[PRIM_TYPE_BOX]], [[PRIM_HOLE_DEFAULT]], <0., 1., 0.>, 0., <0., 0., 0.>, <1., 1., 0.>, <0., 0., 0.>]</code>
** {{#var:material_const}} will return <code>[[PRIM_MATERIAL_FLESH]]</code>.
** {{#var:temponrez_const}} will return <code>[[FALSE]]</code>.
** {{#var:phantom_const}} will return <code>[[FALSE]]</code>.
** {{#var:size_const}} will return <code>[[llGetAgentSize]]([[llGetLinkKey]]({{LSL Param|link}}))</code>.
** {{#var:text_const}} will return <code>[["", <0., 0., 0.>, 1.]]</code>.
** {{#var:light_const}} will return <code><nowiki>[</nowiki>[[FALSE]], <0., 0., 0.>, 0., 0., 0.]</code>.
** {{#var:flexible_const}} will return <code><nowiki>[</nowiki>[[FALSE]], 0, 0., 0., 0., 0., <0., 0., 0.>]</code>.
** {{#var:color_const}}, {{#var:glow_const}}, {{#var:fullbright_const}}, {{#var:bumpshiny_const}}, {{#var:texgen_const}}
*** {{#var:ALL_SIDES}} will return the values for 21 faces.{{Footnote|1=Avatars really have 29 textures, [[llGetLinkNumberOfSides]] however returns 0 - {{Jira|SVC-6646}}.|2=Avatars really have 29 textures, llGetLinkNumberOfSides however returns 0 - SVC-6646}}
*** Regardless of the face specified, the values are always defaults:
::{{{!}}{{Prettytable}}
{{!}}-{{Hl2}}
!{{HoverText|flag|PRIM_* flag}}
!Flag return for a single face.
{{!}}-
{{#var:facetable}}
{{!}}-
{{!}}}<!--PRIM_TEXTURE is wrong but i'm not going to fix it now-->
}}
}}


}}</onlyinclude>{{#if:
}}</onlyinclude>{{#if:

Revision as of 14:52, 9 January 2012

Description

Constant: integer PRIM_LINK_TARGET = 34;

The integer constant PRIM_LINK_TARGET has the value 34

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

llSetPrimitiveParams

llSetPrimitiveParams([ PRIM_LINK_TARGET, integer link_target ]);
• integer link_target Link 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

llGetPrimitiveParams([ PRIM_LINK_TARGET ]);

Returns the list [ integer link_target ]

• integer link_target Link 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

  • If PRIM_LINK_TARGET's link_target describes a seated avatar...
    • Flags not explicitly mentioned have obvious values.
    • will return the avatar's legacy name.
    • will return "".
    • will return [PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0., 1., 0.>, 0., <0., 0., 0.>, <1., 1., 0.>, <0., 0., 0.>]
    • will return PRIM_MATERIAL_FLESH.
    • will return FALSE.
    • will return FALSE.
    • will return llGetAgentSize(llGetLinkKey(link)).
    • will return [["", <0., 0., 0.>, 1.]].
    • will return [FALSE, <0., 0., 0.>, 0., 0., 0.].
    • will return [FALSE, 0, 0., 0., 0., 0., <0., 0., 0.>].
    • , , , ,
      • will return the values for 21 faces.[2]
      • Regardless of the face specified, the values are always defaults:
flag Flag return for a single face.
All Issues ~ Search JIRA for related Bugs

Related Articles

Constants

Flag Description
LINK_ROOT 1 refers to the root prim in a multi-prim linked set[1]
Flag Description
LINK_THIS -4 refers to the prim the script is in

Functions

•  llSetLinkPrimitiveParams
•  llSetLinkPrimitiveParamsFast
•  llGetLinkPrimitiveParams
•  llSetPrimitiveParams
•  llGetPrimitiveParams
•  llGetLinkNumber Returns the link number of the prim the script is in.

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.

  • If an object consists of only one prim, and there are no avatars seated upon it, the (root) prim's link number is zero.
  • However, if the object is made up of multiple prims or there is an avatar seated upon the object, the root prim's link number is one.

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.

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ LINK_ROOT does not work on single prim objects. Unless there is an avatar sitting on the object.
  2. ^ Avatars really have 29 textures, llGetLinkNumberOfSides however returns 0 - SVC-6646.

Signature

integer PRIM_LINK_TARGET = 34;