LlGetObjectName: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Strife Onizuka (talk | contribs)
mNo edit summary
Kireji Haiku (talk | contribs)
m side-by-side comparison between llGetObjectName and llGetLinkName(LINK_ROOT)
Line 12: Line 12:
|constants
|constants
|examples=
|examples=
{{{!}} class="sortable" width="100%" {{Prettytable}}
{{!}}- {{Hl2}}
! '''Get this prim's name'''
! '''Get the root prim's name'''
{{!}}-
{{!!}}<lsl>
default
{
    state_entry()
    {
    //  PUBLIC_CHANNEL has the integer value 0
        llSay(PUBLIC_CHANNEL, "This prim's name: " + llGetObjectName() );
    }
}
</lsl>
{{!!}}
<lsl>
<lsl>
default
default
Line 17: Line 33:
     state_entry()
     state_entry()
     {
     {
        // PUBLIC_CHANNEL has the integer value 0
    // PUBLIC_CHANNEL has the integer value 0
         llSay(PUBLIC_CHANNEL, "This prim's name: " + llGetObjectName() );
         llSay(PUBLIC_CHANNEL, "Root prim's name: "
            + llGetLinkName(LINK_ROOT));
     }
     }
}
}
</lsl>
</lsl>
{{!}}}
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 04:26, 25 November 2012

Summary

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

Returns a string that is the name of the prim the script is attached to.

Caveats

  • The prim name is limited to 63 bytes, any string longer than that will be truncated. This truncation does not always happen when the attribute is set or read.
Important: This function does not get the name of the object's rootprim, but the name of the prim containing the script. Please use llGetLinkName(LINK_ROOT); instead.

Examples

Get this prim's name Get the root prim's name
<lsl>

default {

   state_entry()
   {
   //  PUBLIC_CHANNEL has the integer value 0
       llSay(PUBLIC_CHANNEL, "This prim's name: " + llGetObjectName() );
   }

} </lsl>

<lsl> default {

   state_entry()
   {
   //  PUBLIC_CHANNEL has the integer value 0
       llSay(PUBLIC_CHANNEL, "Root prim's name: "
           + llGetLinkName(LINK_ROOT));
   }

} </lsl>

Notes

  • This function may return "(Waiting)" sometimes.

Presumably the function queries the asset server for a predetermined time and returns "(Waiting)" if that elapses. It then silently proceeds to the next instruction. A work around therefore, might be to test object name is not "(Waiting)" after calling llGetObjectName.

See Also

Functions

•  llSetObjectName Set the prims name
•  llGetLinkName Get a linked prims name
•  llGetObjectDesc Get the prims description
•  llSetObjectDesc Sets the prims description
•  llGetObjectDetails

Articles

•  Limits SL limits and constrictions
•  Prim Attribute Overloading

Deep Notes

Signature

function string llGetObjectName();