Difference between revisions of "LlGetRegionAgentCount"

From Second Life Wiki
Jump to navigation Jump to search
(+related)
m (some readability improvements)
Line 5: Line 5:
|return_text=that is the number of avatars in the region.
|return_text=that is the number of avatars in the region.
|caveats
|caveats
|examples=<lsl>//Tell the owner how many avatars are in the region on touch
|examples=
<lsl>
default
default
{
{
     touch_start(integer count)
     touch_start(integer num_detected)
     {
     {
         llOwnerSay((string)llGetRegionAgentCount());
         integer numberOfAvatarsInSim = llGetRegionAgentCount();
 
    //  PUBLIC_CHANNEL has the integer value 0
 
        llSay(PUBLIC_CHANNEL, "Hello, currently there are "
            + (string)numberOfAvatarsInSim + " avatars in my sim.");
     }
     }
}</lsl>
}
</lsl>
|spec
|spec
|caveats=
|caveats=

Revision as of 11:21, 22 October 2012

Summary

Function: integer llGetRegionAgentCount( );

Returns an integer that is the number of avatars in the region.

Caveats

  • The value returned by this function is technically the average number of agents who were in the region for the past second, rounded to the nearest integer. This means that there is a slight (<1 second) delay in agent count when an agent enters or exits a region.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> default {

   touch_start(integer num_detected)
   {
       integer numberOfAvatarsInSim = llGetRegionAgentCount();
   //  PUBLIC_CHANNEL has the integer value 0
       llSay(PUBLIC_CHANNEL, "Hello, currently there are "
           + (string)numberOfAvatarsInSim + " avatars in my sim.");
   }

}

</lsl>

See Also

Deep Notes

History

Search JIRA for related Issues

Signature

function integer llGetRegionAgentCount();