AGENT AUTOMATED

From Second Life Wiki
Revision as of 11:21, 12 October 2023 by Gwyneth Llewelyn (talk | contribs) (Documenting this new little flag which didn't exist before :-))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

Constant: integer AGENT_AUTOMATED = 0x4000;

The integer constant AGENT_AUTOMATED has the value 0x4000

Identifies an avatar as having been registered with Linden Lab as an automated/scripted agent, i.e. a Template:Hovertext

Related Articles

Constants

•  AGENT_FLYING
•  AGENT_IN_AIR
•  AGENT_WALKING
•  AGENT_ALWAYS_RUN

Examples

// Simple bot detector.
// Place the script in a prim, Attach it as a HUD,
// touch to identify which avatars in the parcel are bots.
//
// 🅭 2023 by Gwyneth Llewelyn. Some rights reserved.
// Licensed under a MIT license (https://gwyneth-llewelyn.mit-license.org/)
//
// Based on the LSL Wiki example at https://wiki.secondlife.com/wiki/LlGetAgentList
//
default
{
    touch_start(integer total_number)
    {
        list avatarsInParcel = llGetAgentList(AGENT_LIST_PARCEL, []);
        integer numOfAvatars = llGetListLength(avatarsInParcel);

        // If no avatars are present in the parcel, abort avatar listing process and give a short notice.
        // Note that at least one avatar will be present, namely, the one running this script!
        if (numOfAvatars < 2)
        {
            llOwnerSay("Neither avatars nor 'bots found in the current parcel.");
            return;
        }
        integer numOfBots;  // counts #bots
        integer index;
        while (index < numOfAvatars)
        {
            key id = llList2Key(avatarsInParcel, index);
            string name = llKey2Name(id);

            if (llGetAgentInfo(id) & AGENT_AUTOMATED) {
                ++numOfBots;
                llOwnerSay((string)numOfBots + ": " + name + " [" + (string)id + "] ('bot)");
            }
            ++index;
        }
        if (numOfBots == 0) {
            llOwnerSay("No 'bots found in parcel,");
            if (numOfAvatars > 1) {
                llOwnerSay("only other humans (including yourself).");
            } else {
                llOwnerSay("you're the only human around.");
            }
        } else {
            llOwnerSay("--------\nTotal # of humans: " + (string)(numOfAvatars - numOfBots)+ " (counting yourself)\nTotal # of 'bots: " + (string)numOfBots);
        }
    }
}

Notes

Added by Rider Linden on 13 April 2023‎, following the Linden Lab announcement on its new scripted agent privacy policy

Deep Notes

Search JIRA for related Issues

Signature

integer AGENT_AUTOMATED = 0x4000;