Skip to content
lsl.devlsl.devLSL Dev

llGetObjectPrimCount

function
Function syntax
integer llGetObjectPrimCount(
  1. 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.

How to use
integer result = llGetObjectPrimCount(NULL_KEY);
  • 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. If possible use llGetNumberOfPrims instead.
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.");
}
}
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.

  1. llGetNumberOfPrims on the other hand does count avatars sitting on the object. ↩

  2. Whether the attachment exception is a bug or a feature is unclear. ↩