Skip to content
lsl.devlsl.devLSL Dev

LlGetObjectPrimCount

Looking for the current API? Open the llGetObjectPrimCount reference →

Function notes

Avatars sitting on the object are not countedllGetNumberOfPrims on the other hand does count avatars sitting on the object.. Zero is returned if prim: (A) is not found, (B) is part of an attachmentWhether the attachment exception is a bug or a feature is unclear., or (C) is not a prim.

Return value notes

Returns an integer that is the total number of prims in the object that contains 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 returnedFootnote: {{Footnote|handle=attachment}}. 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

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/prim

Original shared helper source (conditional wiki logic is not evaluated)
<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{LSL Injection Test}}{{#if:

{{#vardefine:p_{{{1|none}}}_desc|{{#if:{{{object|}}}|[[object]]|[[prim]]}} {{HoverLink|UUID|Universally Unique Identifier}} {{#if:{{{sim|}}}|that is in the same [[region]] {{#switch:{{{sim|}}}|*=|#default={{{sim|}}}}}
}}}}

{{#vardefine:p_{{{1|none}}}_hover|{{#if:{{{object|}}}|object|prim}} UUID {{#if:{{{sim|}}}|that is in the same region {{#switch:{{{sim|}}}|*=|#default={{{sim|}}}}}
}}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
!var
!value
|-
|desc
|{{#var:p_{{{1|none}}}_desc}}
|-
|hover
|{{#var:p_{{{1|none}}}_hover}}
|}
</noinclude>
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.