Difference between revisions of "User:Daemonika Nightfire/Scripts/Bot Ejecter"

From Second Life Wiki
Jump to navigation Jump to search
m
m (extended version added)
Line 61: Line 61:
     {
     {
         llLinksetDataDelete("ejects");
         llLinksetDataDelete("ejects");
        llResetScript();
    }
}
</source>
== *DS* Bot Ejecter v1.0.04 =
Extended Version with individual statistics.
<source lang="lsl2">
/*
    *DS* Bot Ejecter v1.0.04 by Daemonika nightfire
   
    The motivation behind this script is to make it as difficult as possible for data collectors to use bots.
    Bots are teleported home by this script within a second without warning.
    The height at which a bot is located is irrelevant.
    The bot is also ejected at the highest point at 2147483647 metres.
   
    It is expressly permitted and even desired to pass on this script free & fullperm.
   
    Please see https://wiki.secondlife.com/wiki/LlTeleportAgentHome#Ownership_Limitations for details.
*/
list known_bots = [];
integer num = 0;
integer total = 0;
Refresh()
{
    string msg = "Ejected bots: " + (string)total;
    llSetText(msg, <1,1,1>, 1.0);
    llSetObjectDesc(msg);
}
default
{
    state_entry()
    {
        Refresh();
        llSetTimerEvent(1.0); // don't set faster than once per second
    }
    timer()
    {
        llSetTimerEvent(0.0); // stops the timer temporarily to process the list
       
        list agents = llGetAgentList(AGENT_LIST_PARCEL, []); // use AGENT_LIST_REGION if you own the whole region
        integer length = llGetListLength(agents);
        integer i = 0;
        do
        {
            key agent = llList2Key(agents, i);
            integer info = llGetAgentInfo(agent);
            if(info & AGENT_AUTOMATED)
            {
                if(!llSameGroup(agent)) // your own bots are save with the same group
                {
                    if(!~llListFindList(known_bots, [agent]))
                    {
                        known_bots += agent;
                        known_bots += 1;
                       
                        if(llGetFreeMemory() < 10000)
                        {
                            llDeleteSubList(known_bots, 0, 1);
                        }
                        num = llGetListLength(known_bots);
                    }
                    else
                    {
                        integer index = llListFindList(known_bots, [agent]);
                        integer count = llList2Integer(known_bots, index+1);
                       
                        count++;
                        known_bots = llListReplaceList(known_bots, [count], index+1, index+1);
                    }
                   
                    llTeleportAgentHome(agent);
                    total++;
                    Refresh();
                }
            }
        }
        while(++i < length);
       
        llSetTimerEvent(1.0); // restart the timer
    }
   
    touch_start(integer number)
    {
        key user = llDetectedKey(0);
        key current_uuid;
        integer current_number;
        integer counter = 0;
        integer i = 0;
        do
        {
            if(num > 0)
            {
                if(!(i&1))
                {
                    current_uuid = llList2Key(known_bots, i);
                }
                else if(i&1)
                {
                    current_number = llList2Integer(known_bots, i);
                   
                    counter++;
                    llRegionSayTo(user, 0, "/me " + (string)counter + ". Known bot: secondlife:///app/agent/" + (string)current_uuid + "/about (" + (string)current_number + ")");
                }
            }
            else
            {
                llRegionSayTo(user, 0, "Currently no bot stored.");
            }
        }
        while(++i < num);
    }
   
    on_rez(integer Dae)
    {
         llResetScript();
         llResetScript();
     }
     }
}
}
</source>
</source>

Revision as of 08:34, 7 September 2024

*DS* Bot Ejecter v1.0.01

This little script sends every agent with the scritped agent status (usually called bot) home within a second without warning.

/*
    *DS* Bot Ejecter v1.0.00 by Daemonika nightfire
    
    The motivation behind this script is to make it as difficult as possible for data collectors to use bots.
    Bots are teleported home by this script within a second without warning.
    The height at which a bot is located is irrelevant.
    The bot is also ejected at the highest point at 2147483647 metres.
    
    It is expressly permitted and even desired to pass on this script free & fullperm.
    
    Please see https://wiki.secondlife.com/wiki/LlTeleportAgentHome#Ownership_Limitations for details.
*/

integer counter = 0;
Refresh()
{
    string msg = "Ejected Bots: " + (string)counter;
    llSetText(msg, <1,1,1>, 1.0);
    llSetObjectDesc(msg);
}

default
{
    state_entry()
    {
        counter = (integer)llLinksetDataRead("ejects");
        Refresh();
        
        llSetTimerEvent(1.0); // don't set faster than once per second
    }

    timer()
    {
        list agents = llGetAgentList(AGENT_LIST_PARCEL, []); // use AGENT_LIST_REGION if you own the whole region
        integer length = llGetListLength(agents);
        integer i = 0;
        do
        {
            key agent = llList2Key(agents, i);
            integer info = llGetAgentInfo(agent);
            if(info & AGENT_AUTOMATED)
            {
                if(!llSameGroup(agent)) // your own bots are save with the same group
                {
                    llTeleportAgentHome(agent);
                    
                    counter++;
                    llLinksetDataWrite("ejects", (string)counter);
                    Refresh();
                }
            }
        }
        while(++i < length);
    }
    
    on_rez(integer Dae)
    {
        llLinksetDataDelete("ejects");
        llResetScript();
    }
}

= *DS* Bot Ejecter v1.0.04

Extended Version with individual statistics.

/*
    *DS* Bot Ejecter v1.0.04 by Daemonika nightfire
    
    The motivation behind this script is to make it as difficult as possible for data collectors to use bots.
    Bots are teleported home by this script within a second without warning.
    The height at which a bot is located is irrelevant.
    The bot is also ejected at the highest point at 2147483647 metres.
    
    It is expressly permitted and even desired to pass on this script free & fullperm.
    
    Please see https://wiki.secondlife.com/wiki/LlTeleportAgentHome#Ownership_Limitations for details.
*/

list known_bots = [];
integer num = 0;

integer total = 0;
Refresh()
{
    string msg = "Ejected bots: " + (string)total;
    llSetText(msg, <1,1,1>, 1.0);
    llSetObjectDesc(msg);
}

default
{
    state_entry()
    {
        Refresh();
        llSetTimerEvent(1.0); // don't set faster than once per second
    }

    timer()
    {
        llSetTimerEvent(0.0); // stops the timer temporarily to process the list
        
        list agents = llGetAgentList(AGENT_LIST_PARCEL, []); // use AGENT_LIST_REGION if you own the whole region
        integer length = llGetListLength(agents);
        integer i = 0;
        do
        {
            key agent = llList2Key(agents, i);
            integer info = llGetAgentInfo(agent);
            if(info & AGENT_AUTOMATED)
            {
                if(!llSameGroup(agent)) // your own bots are save with the same group
                {
                    if(!~llListFindList(known_bots, [agent]))
                    {
                        known_bots += agent;
                        known_bots += 1;
                        
                        if(llGetFreeMemory() < 10000)
                        {
                            llDeleteSubList(known_bots, 0, 1);
                        }
                        num = llGetListLength(known_bots);
                    }
                    else
                    {
                        integer index = llListFindList(known_bots, [agent]);
                        integer count = llList2Integer(known_bots, index+1);
                        
                        count++;
                        known_bots = llListReplaceList(known_bots, [count], index+1, index+1);
                    }
                    
                    llTeleportAgentHome(agent);
                    total++;
                    Refresh();
                }
            }
        }
        while(++i < length);
        
        llSetTimerEvent(1.0); // restart the timer
    }
    
    touch_start(integer number)
    {
        key user = llDetectedKey(0);
        key current_uuid;
        integer current_number;
        integer counter = 0;
        integer i = 0;
        do
        {
            if(num > 0)
            {
                if(!(i&1))
                {
                    current_uuid = llList2Key(known_bots, i);
                }
                else if(i&1)
                {
                    current_number = llList2Integer(known_bots, i);
                    
                    counter++;
                    llRegionSayTo(user, 0, "/me " + (string)counter + ". Known bot: secondlife:///app/agent/" + (string)current_uuid + "/about (" + (string)current_number + ")");
                }
            }
            else
            {
                llRegionSayTo(user, 0, "Currently no bot stored.");
            }
        }
        while(++i < num);
    }
    
    on_rez(integer Dae)
    {
        llResetScript();
    }
}