llGetObjectPrimCount
function
Function syntax
integer llGetObjectPrimCount(key prim// UUID of the prim in the same region.
);- Returns
integer- Energy
- 10
Avatars sitting on the object are not counted1. Zero is returned if prim: (A) is not found, (B) is part of an attachment2, or (C) is not a prim.
Returns an integer that is the total number of prims in the object that contains prim.
integer result = llGetObjectPrimCount(NULL_KEY);Caveats
Section titled “Caveats”- This cannot be used to detect if an avatar is seated (by checking for a non-zero return), use
llGetAgentInfoinstead. - The prim count for attachments are not returned. If possible use
llGetNumberOfPrimsinstead.
Examples
Section titled “Examples”Example 1
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.8 collapsed lines
} llOwnerSay("This object has " + (string)prims + " prims and " + (string)(llGetNumberOfPrims() - prims) + " avatars."); }}See also
Section titled “See also”Functions
Section titled “Functions”llGetNumberOfPrims— Returns the number of prims in the current object.llGetObjectLinkKey— Returns the key of the link in the linkset an object.
Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.
Footnotes
Section titled “Footnotes”-
llGetNumberOfPrimson the other hand does count avatars sitting on the object. ↩ -
Whether the attachment exception is a bug or a feature is unclear. ↩