Difference between revisions of "LlGetObjectPrimCount"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 14: Line 14:
|constants
|constants
|examples=
|examples=
<lsl>default
<source lang="lsl2">default
{
{
     touch_start(integer num)
     touch_start(integer num)
Line 31: Line 31:
                     + " avatars.");
                     + " avatars.");
     }
     }
}</lsl>
}</source>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 01:22, 22 January 2015

Summary

Function: integer llGetObjectPrimCount( key prim );
0.0 Forced Delay
10.0 Energy

Returns an integer that is the total number of prims in the object that contains prim.

• key prim prim UUID that is in the same region

Avatars sitting on the object are not counted[1]. Zero is returned if prim: (A) is not found, (B) is part of an attachment[2], or (C) is not a prim.

Caveats

  • This cannot be used to detect if an avatar is seated (by checking for a non-zero return), use llGetAgentInfo instead.
  • The prim count for attachments are not returned[2]. If possible use llGetNumberOfPrims instead.

Examples

default
{
    touch_start(integer num)
    {
        integer prims = llGetObjectPrimCount(llGetKey());
        if (prims == 0)
        {
            // llGetObjectPrimCount returns zero for attachments.
            prims = llGetNumberOfPrims();
            // Avatars can't sit on attachments so this is ok.
        }
        llOwnerSay("This object has "
                    + (string)prims
                    + " prims and "
                    + (string)(llGetNumberOfPrims() - prims)
                    + " avatars.");
    }
}

See Also

Functions

•  llGetNumberOfPrims Returns the number of prims in the current object.

Deep Notes

Footnotes

  1. ^ llGetNumberOfPrims on the other hand does count avatars sitting on the object.
  2. ^ Weather the attachment exception is a bug or a feature is unclear.

Signature

function integer llGetObjectPrimCount( key prim );