Difference between revisions of "LlGetObjectDesc"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{LSL_Function/prim-desc}}{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/prim-desc}}
|func_id=270|func_sleep=0.0|func_energy=10.0
|func_id=270|func_sleep=0.0|func_energy=10.0
|func=llGetObjectDesc
|func=llGetObjectDesc
|return_type=string
|return_type=string
|func_footnote
|func_footnote=To get the ''object's'' description (not the current prim's), use [[PRIM_DESC]] or [[OBJECT_DESC]].
|func_desc
|func_desc
|return_text=that is the description of the prim the script is attached to.
|return_text=containing the description of the prim the script is attached to.
|spec
|spec
|caveats
|caveats=
{{LSL Tip|This function '''does not''' get the description of the object's rootprim, but the description of the prim containing the script. Please use [[llList2String]]([[llGetLinkPrimitiveParams]]([[LINK_ROOT]], [ [[PRIM_DESC]] ]), 0); instead.}}
|constants
|constants
|examples=<lsl>default
|examples=
{{{!}} class="sortable" width="100%" {{Prettytable}}
{{!}}- {{Hl2}}
! '''Get this prim's description'''
{{!}}-
{{!!}}<source lang="lsl2">
default
{
{
     state_entry()
     state_entry()
     {
     {
         llSay(PUBLIC_CHANNEL, llGetObjectDesc() );
    //  PUBLIC_CHANNEL has the integer value 0
         llSay(PUBLIC_CHANNEL, "This prim's description: " + llGetObjectDesc() );
     }
     }
}</lsl>
}
</source>
{{!}}}
 
{{{!}} class="sortable" width="100%" {{Prettytable}}
{{!}}- {{Hl2}}
! '''Get the root prim's description'''
{{!}}-
{{!!}}
<source lang="lsl2">
default
{
    state_entry()
    {
    //  PUBLIC_CHANNEL has the integer value 0
        llSay(PUBLIC_CHANNEL, "Rootprim's description: "
            + llList2String(llGetLinkPrimitiveParams(LINK_ROOT, [ PRIM_DESC ]), 0));
    }
}
</source>
{{!}}}
|helpers
|helpers
|also_functions=
|also_functions=
Line 27: Line 56:
|notes
|notes
|cat1=Prim
|cat1=Prim
|cat2
|cat2=Description
|cat3
|cat3
|cat4
|cat4
}}
}}

Latest revision as of 01:18, 22 January 2015

Summary

Function: string llGetObjectDesc( );
0.0 Forced Delay
10.0 Energy

Returns a string containing the description of the prim the script is attached to.

To get the object's description (not the current prim's), use PRIM_DESC or OBJECT_DESC.

Caveats

  • The prim description is limited to 127 bytes; any string longer then that will be truncated. This truncation does not always happen when the attribute is set or read.
  • The pipe character '|' and the newline character '\n' are not legal in a prim's description. They will be replaced with '?'.[1]
  • Note that when people have "Hover Tips on All Objects" selected in the viewer's "View" menu, they'll see the object description pop-up for any object under their mouse pointer. For that reason, it is good practice to only set human-friendly information in the description, e.g. keys and such.
  • When an attached object is detached, changes made by script to the name and description (of the root prim) of the attachment will be lost. While the object is attached the name and description can be changed but it will not be reflected in inventory. This caveat does not apply to child prims.
    KBcaution.png Important: This function does not get the description of the object's rootprim, but the description of the prim containing the script. Please use llList2String(llGetLinkPrimitiveParams(LINK_ROOT, [ PRIM_DESC ]), 0); instead.

Examples

Get this prim's description
default
{
    state_entry()
    {
    //  PUBLIC_CHANNEL has the integer value 0
        llSay(PUBLIC_CHANNEL, "This prim's description: " + llGetObjectDesc() );
    }
}
Get the root prim's description
default
{
    state_entry()
    {
    //  PUBLIC_CHANNEL has the integer value 0
        llSay(PUBLIC_CHANNEL, "Rootprim's description: "
            + llList2String(llGetLinkPrimitiveParams(LINK_ROOT, [ PRIM_DESC ]), 0));
    }
}

See Also

Functions

•  llSetObjectDesc Sets the prim description.
•  llGetObjectName Gets the prim name.
•  llSetObjectName Sets the prim name.
•  llGetObjectDetails

Articles

•  Limits SL limits and constrictions
•  Prim Attribute Overloading

Deep Notes

Footnotes

  1. ^ The pipe character historically has been used to separate fields in the serialized version of inventory. The field is not multi-line so the newline character holds no meaning in this context.

Signature

function string llGetObjectDesc();