Jump to content

LlGetNumberOfPrims: Difference between revisions

From OSgrid Wiki
Created page with "==Function: integer llGetNumberOfSides( );== Returns an integer that is the number of faces (or sides) of the prim. <br><br> See Face for more information about faces and the..."
 
No edit summary
 
Line 1: Line 1:
==Function: integer llGetNumberOfSides( );==
==Function: integer llGetNumberOfPrims( );==
Returns an integer that is the number of faces (or sides) of the prim. <br><br>
Returns an integer that is the number of prims in a link set the script is attached to. <br> <br>
See Face for more information about faces and the conditions that control the number of faces a prim will have.<br><br>
'''Caveats'''  <br>
'''Examples'''<br>
• The number of prims returned includes the count of avatars sitting on the object. <br> <br>
'''Examples''' <br>
{|border="1" cellpadding="5" cellspacing="0"
{|border="1" cellpadding="5" cellspacing="0"
|<source lang="lsl">
|<source lang="lsl">
Line 9: Line 10:
     state_entry()
     state_entry()
     {
     {
         // Set the hovertext to indicate the number of sides
         llOwnerSay((string) llGetLinkNumber());
        integer numOfSides = llGetNumberOfSides();
         llOwnerSay((string) llGetNumberOfPrims());
         llSetText( "I have " + (string)numOfSides + " sides." );
     }
     }
}
Useful Snippets
//Returns the number of agents on the object
integer GetNumberOfAgents()
{//count avatars
    return llGetNumberOfPrims() - llGetObjectPrimCount(llGetKey());
}
//Returns the number of prims in the object
integer GetNumberOfPrims()
{//ignores avatars
    return llGetObjectPrimCount(llGetKey());
}
}
</source>
</source>
|}
|}
<br>
See Also  <br>
'''Functions''' <br>
•  [[llGetObjectPrimCount]] – Returns the number of prims in any object. <br>
•  [[llGetLinkNumber]] – Returns the link number of the prim the script is in. <br> <br>

Latest revision as of 22:44, 31 December 2017

Function: integer llGetNumberOfPrims( );

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

Caveats
• The number of prims returned includes the count of avatars sitting on the object.

Examples

<source lang="lsl">

default {

   state_entry()
   {
       llOwnerSay((string) llGetLinkNumber());
       llOwnerSay((string) llGetNumberOfPrims());
   }

}

Useful Snippets

//Returns the number of agents on the object integer GetNumberOfAgents() {//count avatars

   return llGetNumberOfPrims() - llGetObjectPrimCount(llGetKey());

}

//Returns the number of prims in the object integer GetNumberOfPrims() {//ignores avatars

   return llGetObjectPrimCount(llGetKey());

} </source>


See Also
Functions
• llGetObjectPrimCount – Returns the number of prims in any object.
• llGetLinkNumber – Returns the link number of the prim the script is in.