Difference between revisions of "LlSetObjectName"

From Second Life Wiki
Jump to navigation Jump to search
m
m (changed example script)
Line 20: Line 20:
* Changes to the names of child prims will be saved back to inventory when the object is detached to inventory. They survive detachment.
* Changes to the names of child prims will be saved back to inventory when the object is detached to inventory. They survive detachment.
|constants
|constants
|examples=<lsl>default
|examples=
<lsl>
// WARNING:
//
//      llSetObjectName(string name); sets the name of the prim containing the script.
//
//      to set the name of a linkset's root prim use
//      llSetLinkPrimitiveParamsFast(LINK_ROOT, [PRIM_NAME, string name]); instead
 
default
{
{
     state_entry()
     touch_start(integer total_number)
     {
     {
         string yyyy1mm1dd = llGetDate();
        // store owner's legacy name in the name
         string name = yyyy1mm1dd + " " + llGetObjectName();
        // field of the prim containing the script
        llOwnerSay("llSetObjectName(\"" + name + "\")");
 
         llSetObjectName(name);
         string ownerLegacyName = llKey2Name(llGetOwner());
 
         if (llGetSubString(ownerLegacyName, -1, -1) == "s")
            llSetObjectName(ownerLegacyName + "' prim");
         else
            llSetObjectName(ownerLegacyName + "'s prim");
     }
     }
}</lsl>
}
</lsl>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 12:05, 24 September 2012

Summary

Function: llSetObjectName( string name );

Sets the prim's name according to the name parameter.

• string name

If this function is called from a child prim in a linked set, it will change the name of the child prim and not the root prim.

Caveats

  • The name is limited to 63 characters. Longer prim names are cut short.
  • Names can only consist of the 95 printable characters found in the "Wikipedia logo"ASCII-7 (non-extended) character set.
    • Non-ASCII characters will be replaced with two question marks ("??").
  • While an object is attached, the script cannot change the name of the object as it appears in the user's inventory.[1]
    • Changes to the name of the root prim (with llSetObjectName for example) will not be saved to inventory; when the attachment is detached (to inventory, not dropped) this name change is discarded and the name in inventory is used instead.
    • When attachment is dropped (to the ground) and taking it into inventory, the inventory item will have the new name (not the old).
  • Changes to the names of child prims will be saved back to inventory when the object is detached to inventory. They survive detachment.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> // WARNING: // // llSetObjectName(string name); sets the name of the prim containing the script. // // to set the name of a linkset's root prim use // llSetLinkPrimitiveParamsFast(LINK_ROOT, [PRIM_NAME, string name]); instead

default {

   touch_start(integer total_number)
   {
       // store owner's legacy name in the name
       // field of the prim containing the script
       string ownerLegacyName = llKey2Name(llGetOwner());
       if (llGetSubString(ownerLegacyName, -1, -1) == "s")
           llSetObjectName(ownerLegacyName + "' prim");
       else
           llSetObjectName(ownerLegacyName + "'s prim");
   }

}

</lsl>

See Also

Functions

•  llGetObjectName Get the prims name
•  llGetLinkName Get a linked prims name
•  llGetObjectDesc Get the prims description
•  llSetObjectDesc Set the prims description
•  llGetObjectDetails Get a list of object details

Articles

•  Limits SL limits and constrictions

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ Whether or not this is a bug is still debated, regardless LL has said they will not fix it. This behavior was first recognized as a pain point in 2006 and only confirmed to be lava-flowed more recently (2011).

Signature

function void llSetObjectName( string name );