Difference between revisions of "LlSetObjectDesc"

From Second Life Wiki
Jump to navigation Jump to search
m
m (grammar error fix again)
 
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Issues/VWR-437}}{{Issues/VWR-3429}}{{LSL_Function/limits}}{{LSL_Function
{{LSL_Function
|inject-2={{Issues/VWR-437}}{{Issues/SVC-3429}}{{Issues/VWR-8761}}{{LSL_Function/prim-desc|set}}
|func=llSetObjectDesc
|func=llSetObjectDesc
|func_id=271|func_sleep=0.0|func_energy=10.0
|func_id=271|func_sleep=0.0|func_energy=10.0
Line 7: Line 8:
|return_text
|return_text
|spec
|spec
|caveats=
|caveats
*The description is limited to 127 bytes, any string longer then that will be truncated.
*The pipe character | is not legal in an object's description, it will be replaced by a '?'{{Footnote|This is because the pipe character historically has been used to separate fields in the serialized version of inventory.}}.
*When an 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. These limitations do ''not'' apply to child prims.
|constants
|constants
|examples=<lsl>//store the owner's name in the prim description
|examples=
{{{!}} class="sortable" width="100%" {{Prettytable}}
{{!}}- {{Hl2}}
! '''Set this prim's description'''
! '''Set the root prim's description'''
{{!}}-
{{!!}}<syntaxhighlight lang="lsl2">
default
default
{
{
     touch_start(integer total_number)
     state_entry()
     {
     {
        string temp;
         llSetObjectDesc("NEW PRIM DESCRIPTION");
 
        temp = llKey2Name(llGetOwner());
 
         llSetObjectDesc(temp);
     }
     }
}</lsl>
}
</syntaxhighlight>
{{!!}}
<syntaxhighlight lang="lsl2">
default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_ROOT,
            [PRIM_DESC, "NEW ROOT PRIM DESCRIPTION"]);
    }
}
</syntaxhighlight>
{{!}}}
|helpers
|helpers
|also_functions=
|also_functions=
Line 31: Line 44:
|also_tests
|also_tests
|also_events
|also_events
|also_articles=
|also_articles
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
{{LSL DefineRow||}}
|notes
|notes=
* Object descriptions are often used to store data that needs to be protected from script resets (see, for example, [[Prim Attribute Overloading]]). However, descriptions are not immutable and can be tampered with by users or other scripts, either intentionally or accidentally, so this method should only be considered a last resort for data storage.
** [[llLinksetDataWrite]] and associated functions are generally better suited for this purpose, because they allow for significantly more data storage and are much more secure against tampering.
|cat1=Prim
|cat1=Prim
|cat2
|cat2

Latest revision as of 19:08, 5 January 2023

Summary

Function: llSetObjectDesc( string description );
0.0 Forced Delay
10.0 Energy

Sets the prims description

• string description

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.

Examples

Set this prim's description Set the root prim's description
default
{
    state_entry()
    {
        llSetObjectDesc("NEW PRIM DESCRIPTION");
    }
}
default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_ROOT,
            [PRIM_DESC, "NEW ROOT PRIM DESCRIPTION"]);
    }
}

Notes

  • Object descriptions are often used to store data that needs to be protected from script resets (see, for example, Prim Attribute Overloading). However, descriptions are not immutable and can be tampered with by users or other scripts, either intentionally or accidentally, so this method should only be considered a last resort for data storage.
    • llLinksetDataWrite and associated functions are generally better suited for this purpose, because they allow for significantly more data storage and are much more secure against tampering.

See Also

Functions

•  llGetObjectDesc Gets the prim description.
•  llGetObjectName Gets the prim name.
•  llSetObjectName Sets the prim name.

Articles

•  Limits SL limits and constrictions

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 void llSetObjectDesc( string description );