Difference between revisions of "LlGetObjectPrimCount"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 4: Line 4:
|return_type=integer
|return_type=integer
|p1_type=key|p1_name=prim|p1_desc
|p1_type=key|p1_name=prim|p1_desc
|func_footnote=Avatar sitting on the object are not counted{{Footnote|[[llGetNumberOfPrims]] on the other hand does count avatars sitting on the object.|llGetNumberOfPrims on the other hand does count avatars sitting on the object.}}. If '''id''' is not found or it is not a prim, zero is returned.
|func_footnote=Avatars sitting on the object are not counted{{Footnote|[[llGetNumberOfPrims]] on the other hand does count avatars sitting on the object.|llGetNumberOfPrims on the other hand does count avatars sitting on the object.}}. If '''id''' is not found or it is not a prim, zero is returned.
|func_desc
|func_desc
|return_text=that is the total number of prims in the object that contains '''prim'''.
|return_text=that is the total number of prims in the object that contains '''prim'''.

Revision as of 18:03, 14 February 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]. If id is not found or it is not a prim, zero is returned.

Caveats

  • This cannot be used to detect if an avatar is seated (by checking for a non-zero return), use llGetAgentInfo instead.

Examples

<lsl>default{

 touch_start( integer vIntTouched ){
   integer prims = llGetObjectPrimCount( llGetKey() );
   llSay( PUBLIC_CHANNEL, "This object has "
                          + (string)prims
                          + " prims and "
                          + (string)(llGetNumberOfPrims() - prims)
                          + " avatars.");
 }
}</lsl>

Notes

llGetObjectPrimCount can be used as an alternative for llGetAgentSize for testing if a uuid that is known to be in the sim is an avatar. The big difference being the two is that llGetObjectPrimCount returns zero on avatars while llGetAgentSize returns ZERO_VECTOR on prims. These two could be used in conjunction to test if the uuid is in the sim but llGetBoundingBox maybe a better choice.

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.

Signature

function integer llGetObjectPrimCount( key prim );