Difference between revisions of "LlGetAgentList"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Wanted to try this. Wonder what people think)
Line 9: Line 9:
|func_footnote=
|func_footnote=
|return_type=list
|return_type=list
|return_text=[key id0, key id1, ..., key idn] or [string error_msg] -  returns avatar keys for all agents in the region limited to the area(s) specified by scope
|return_text=<code><nowiki>[</nowiki>[[key]]&nbsp;{{HoverText|id0|First agent key}}, [[key]]&nbsp;{{HoverText|id1|Second agent key}}, ..., [[key]]&nbsp;{{HoverText|idn|nᵗʰ agent key}}]</code> or <code><nowiki>[</nowiki>[[string]]&nbsp;{{HoverText|error_msg|An error message}}]</code> -  returns avatar keys for all agents in the region limited to the area(s) specified by scope
|spec=
|spec=
|p1_type=integer|p1_name=scope|p1_desc=selection scope
|p1_type=integer|p1_name=scope|p1_hover=AGENT_LIST_* flag specifies the selection scope|p1_desc=<span></span>
{{Collapsible_Table|title=AGENT_LIST_* flag specifies the selection scope|title-style=text-align:left; font-weight:normal;|table-attributes=cellpadding="0" cellspacing="0"
|content={{!}}
* [[AGENT_LIST_PARCEL]] - returns only agents on the same parcel where the script is running.
* [[AGENT_LIST_PARCEL]] - returns only agents on the same parcel where the script is running.
* [[AGENT_LIST_PARCEL_OWNER]] - returns only agents on any parcel in the region where the parcel owner is the same as the owner of the parcel under the scripted object.
* [[AGENT_LIST_PARCEL_OWNER]] - returns only agents on any parcel in the region where the parcel owner is the same as the owner of the parcel under the scripted object.
* [[AGENT_LIST_REGION]] - returns any/all agents in the region.
* [[AGENT_LIST_REGION]] - returns any/all agents in the region.
}}
|p2_type=list|p2_name=options|p2_desc=Unused.
|p2_type=list|p2_name=options|p2_desc=Unused.
|p2_hover=selection flags
|p2_hover=selection flags
Line 48: Line 51:
|also_articles
|also_articles
|also_footer
|also_footer
|notes=
|notes
|mode=pre-release
|deprecated
|deprecated
|location
|location

Revision as of 08:56, 10 May 2012

Summary

Function: list llGetAgentList( integer scope, list options );

Requests a list of agents currently in the region, limited by the scope parameter.
Returns a list [key id0, key id1, ..., key idn] or [string error_msg] - returns avatar keys for all agents in the region limited to the area(s) specified by scope

• integer scope
AGENT_LIST_* flag specifies the selection scope
  • AGENT_LIST_PARCEL - returns only agents on the same parcel where the script is running.
  • AGENT_LIST_PARCEL_OWNER - returns only agents on any parcel in the region where the parcel owner is the same as the owner of the parcel under the scripted object.
  • AGENT_LIST_REGION - returns any/all agents in the region.
• list options Unused.

Caveats

  • There is no guaranteed understandable order or randomness to the list returned.
  • Will only return up to 100 agents.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//Displays up to 100 avatar key: name pairs detected in the entire region list gaAgents;

default {

   touch_start(integer total_number)
   {
       integer  i;
       integer  liCount;
       gaAgents = llGetAgentList(AGENT_LIST_REGION, []);
       liCount = llGetListLength(gaAgents);
       if (liCount > 0)
           if (llGetListEntryType(gaAgents,0) == TYPE_STRING)
               llOwnerSay("Error: "+llList2String(gaAgents,0));
           else
               for (i=0; i < liCount; ++i)
                   llOwnerSay(llList2String(gaAgents,i)+": "+llKey2Name(llList2String(gaAgents,i)));
  }
}</lsl>

See Also

Deep Notes

History

All Issues

~ Search JIRA for related Issues
   llGetAgentList() with scope AGENT_LIST_PARCEL or AGENT_LIST_PARCEL_OWNER returns empty list when attached to avatar

Signature

function list llGetAgentList( integer scope, list options );