Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

[BUG-40680] AGENT_LIST_LIMIT option for llGetAgentList() #12323

Open
2 tasks
sl-service-account opened this issue Oct 12, 2016 · 1 comment
Open
2 tasks

[BUG-40680] AGENT_LIST_LIMIT option for llGetAgentList() #12323

sl-service-account opened this issue Oct 12, 2016 · 1 comment

Comments

@sl-service-account
Copy link

sl-service-account commented Oct 12, 2016

How would you like the feature to work?

This proposal is simply to add a new AGENT_LIST_LIMIT (or similar) constant to limit the maximum number of results returned by llGetAgentList().

Note: This is a repost of SCR-371 rather than a duplicate, as I do not have the ability to move issues.

Example

default {
    touch_start(integer x) {
        integer count = llGetRegionAgentCount();
        list agents = llGetAgentList(AGENT_LIST_REGION, [AGENT_LIST_LIMIT, 20]);
        integer length = llGetListLength(agents); integer i;

        if (!length) { llRegionSayTo(llDetectedKey(0), PUBLIC_CHANNEL, "No avatars found"); return; }

        string message = "Found " + (string)length + " avatar(s):";
        for (i = 0; i < length; ++i) {
            message += "\n\tsecondlife:///app/agent/" + llList2String(agents, i) + "/displayname";
        }
        if (length != count) { message += "\nThere may be further results"; }
        llRegionSayTo(llDetectedKey(0), PUBLIC_CHANNEL, message);
    }
}

This simple example will retrieve the first 20 avatars in the region, ensuring a predictable amount of memory is required.

Why is this feature important to you? How would it benefit the community?

Currently the llGetAgentList() function can return up to 100 results, which represents a minimum of 3,600 bytes (LSO @ 36-bytes UTF-8 per key) or 7,200 bytes (Mono @ 72-bytes UTF-16 per key) which is a lot of memory for a script, as it doesn't include the overhead of the list itself, or of processing its contents!

In the example above, if the output were generated for 100 results then in addition to the 7,200 bytes for the list you'd also need a further 15-16kb for the message, ignoring additional space for the manipulations; all-in you're talking half or more of a Mono script's memory! In an LSO script it is impossible to do much of use with the list without deleting it as you go (which is very slow), so far from ideal.

So yeah, an option to limit the results to what the script can actually handle is a must!

Links

Related

Original Jira Fields
Field Value
Issue BUG-40680
Summary AGENT_LIST_LIMIT option for llGetAgentList()
Type New Feature Request
Priority Unset
Status Accepted
Resolution Accepted
Reporter Haravikk Mistral (haravikk.mistral)
Created at 2016-10-12T13:05:48Z
Updated at 2023-08-30T18:16:21Z
{
  'Business Unit': ['Platform'],
  'Date of First Response': '2022-07-16T10:35:53.385-0500',
  'How would you like the feature to work?': 'This proposal is simply to add a new {{AGENT_LIST_LIMIT}} (or similar) constant to limit the maximum number of results returned by [{{llGetAgentList()}}|http://wiki.secondlife.com/wiki/LlGetAgentList].\r\n\r\nNote: This is a repost of SCR-371 rather than a duplicate, as I do not have the ability to move issues.\r\n\r\nh3. Example\r\n{code}default {\r\n    touch_start(integer x) {\r\n        integer count = llGetRegionAgentCount();\r\n        list agents = llGetAgentList(AGENT_LIST_REGION, [AGENT_LIST_LIMIT, 20]);\r\n        integer length = llGetListLength(agents); integer i;\r\n\r\n        if (!length) { llRegionSayTo(llDetectedKey(0), PUBLIC_CHANNEL, "No avatars found"); return; }\r\n\r\n        string message = "Found " + (string)length + " avatar(s):";\r\n        for (i = 0; i < length; ++i) {\r\n            message += "\\n\\tsecondlife:///app/agent/" + llList2String(agents, i) + "/displayname";\r\n        }\r\n        if (length != count) { message += "\\nThere may be further results"; }\r\n        llRegionSayTo(llDetectedKey(0), PUBLIC_CHANNEL, message);\r\n    }\r\n}{code}\r\n\r\nThis simple example will retrieve the first 20 avatars in the region, ensuring a predictable amount of memory is required.',
  'ReOpened Count': 0.0,
  'Severity': 'Unset',
  'Target Viewer Version': 'viewer-development',
  'Why is this feature important to you? How would it benefit the community?': "Currently the {{llGetAgentList()}} function can return up to 100 results, which represents a minimum of 3,600 bytes (LSO @ 36-bytes UTF-8 per key) or 7,200 bytes (Mono @ 72-bytes UTF-16 per key) which is a lot of memory for a script, as it doesn't include the overhead of the list itself, or of processing its contents!\r\n\r\nIn the example above, if the output were generated for 100 results then in addition to the 7,200 bytes for the list you'd also need a further 15-16kb for the message, ignoring additional space for the manipulations; all-in you're talking half or more of a Mono script's memory! In an LSO script it is impossible to do much of use with the list without deleting it as you go (which is very slow), so far from ideal.\r\n\r\nSo yeah, an option to limit the results to what the script can actually handle is a must!",
}
@sl-service-account
Copy link
Author

Arrehn Oberlander commented at 2022-07-16T15:35:53Z, updated at 2022-07-16T15:38:29Z

This issue is even more important now with the 200-avatar capable regions, in anticipation that we will eventually want a llGetAgentList that returns the more avatars, and more script memory available to process them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant