Difference between revisions of "LlGetObjectPrimCount"

From Second Life Wiki
Jump to navigation Jump to search
(Just check if it's zero. don't need to know why)
m
Line 17: Line 17:
   touch_start( integer vIntTouched ){
   touch_start( integer vIntTouched ){
     integer prims = llGetObjectPrimCount( llGetKey() );
     integer prims = llGetObjectPrimCount( llGetKey() );
     if( !prims ){ //does not work on attachments, but avatars can't sit on attachments.
     if( !prims ){ //llGetObjectPrimCount does not work on attachments, but avatars can't sit on attachments.
       prims = llGetNumberOfPrims();
       prims = llGetNumberOfPrims();
     }
     }

Revision as of 10:43, 5 November 2010

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 (1) is not found, (2) is part of an attachment[2], or (3) 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

<lsl>default{

 touch_start( integer vIntTouched ){
   integer prims = llGetObjectPrimCount( llGetKey() );
   if( !prims ){ //llGetObjectPrimCount does not work on attachments, but avatars can't sit on attachments.
     prims = llGetNumberOfPrims();
   }
   llSay( PUBLIC_CHANNEL, "This object has "
                          + (string)prims
                          + " prims and "
                          + (string)(llGetNumberOfPrims() - prims)
                          + " avatars.");
 }
}</lsl>

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 );