Skip to content

llGetNumberOfPrims

integer llGetNumberOfPrims()

Returns the number of prims in a link set the script is attached to.

Returns the number of prims in (and avatars seated on) the object the script is in.

  • The number of prims returned also includes the number of avatars sitting on the object.
default {
state_entry() {
llOwnerSay((string)llGetLinkNumber());
llOwnerSay((string)llGetNumberOfPrims());
}
}

If you need to get the number of prims while excluding seated avatars:

// Returns the number of prims in the object, ignoring seated avatars
integer getNumberOfPrims() {
if (llGetObjectPrimCount(llGetKey()) == 0) return llGetNumberOfPrims(); // attachment
return llGetObjectPrimCount(llGetKey()); // non-attachment
}