Difference between revisions of "Recent Avatar Scanner"

From Second Life Wiki
Jump to navigation Jump to search
(cosmetics)
Line 17: Line 17:
         if (Test == -1 && Agent!=llGetOwner() )
         if (Test == -1 && Agent!=llGetOwner() )
         {
         {
             llOwnerSay("NEW AVATAR: secondlife:///app/agent/" + (string)Agent + "/inspect added to your list");
             //llOwnerSay("NEW AVATAR: secondlife:///app/agent/" + (string)Agent + "/inspect added to your RECENT AVATAR list");
             RecentAgents += (key)Agent;
             RecentAgents += (key)Agent;
             if (llGetListLength(RecentAgents)>MaxRecent) RecentAgents=llDeleteSubList(RecentAgents, 0, 0);
             if (llGetListLength(RecentAgents)>MaxRecent) RecentAgents=llDeleteSubList(RecentAgents,0,0);
            llSleep(0.03);
         }
         }
     }
     }
Line 27: Line 28:
     state_entry()
     state_entry()
     {
     {
        llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);
         llSetTimerEvent(5.0);
         llSetTimerEvent(5.0);
     }
     }
Line 37: Line 37:
     {
     {
         integer TotalRecentAgents=llGetListLength(RecentAgents);
         integer TotalRecentAgents=llGetListLength(RecentAgents);
        llOwnerSay ((string)TotalRecentAgents+" recent avatars:");
        llSleep(0.03);
         if (TotalRecentAgents)
         if (TotalRecentAgents)
         {
         {
            llOwnerSay ((string)TotalRecentAgents+" recent avatars:");
             integer i=0;
             integer i=0;
             for (i;i<TotalRecentAgents;i++)
             for (i;i<TotalRecentAgents;i++)
             {
             {
                 key recentagentskey=llList2Key(RecentAgents,i);
                 key recentagentskey=llList2Key(RecentAgents,i);
                 llOwnerSay ((string)(i+1)+". secondlife:///app/agent/" + (string)recentagentskey + "/inspect ");
                 llOwnerSay ("secondlife:///app/agent/" + (string)recentagentskey + "/inspect ");
                llSleep(.03);
             }
             }
         }
         }
        else llOwnerSay("No Recent Avatars");
     }
     }
     //changed(integer change)
     attach(key id)
     //{
    {
    //    if ( change & CHANGED_REGION ) Process_Region_Agents();
        if (id) llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS );
     //}
    }
    changed(integer change)
     {
        if ( change & CHANGED_OWNER ) llResetScript();
     }
     run_time_permissions(integer perms)
     run_time_permissions(integer perms)
     {
     {

Revision as of 05:31, 8 January 2016

Recent Avatar Scanner by Ackley Bing. Put this script in a prim. Wear the object as a HUD. It notifies you as it collects avatar names. Touch it to see a list of recently collected names. Stores up to 100 names. Adjust 100 to 1000 or whatever you want, just beware of script memory use or you will get a Stack Heap Collision. Modify it to suit your particular use in another Hud, weapon, or whatever you want. <3 --Ackley Bing

list RecentAgents;
integer MaxRecent=100;
Process_Region_Agents()
{
    list RegionAgents=llGetAgentList(AGENT_LIST_REGION,[]);
    integer TotalAgentsInRegion=llGetListLength(RegionAgents);
    integer i;
    for(i=0;i<TotalAgentsInRegion;i++)
    {
        integer Test;
        key Agent = llList2Key(RegionAgents, i);
        Test=llListFindList(RecentAgents,[Agent]);
        if (Test == -1 && Agent!=llGetOwner() )
        {
            //llOwnerSay("NEW AVATAR: secondlife:///app/agent/" + (string)Agent + "/inspect added to your RECENT AVATAR list");
            RecentAgents += (key)Agent;
            if (llGetListLength(RecentAgents)>MaxRecent) RecentAgents=llDeleteSubList(RecentAgents,0,0);
            llSleep(0.03);
        }
    }
}
default
{
    state_entry()
    {
        llSetTimerEvent(5.0);
    }
    timer()
    {
        Process_Region_Agents();
    }
    touch_start(integer index)
    {
        integer TotalRecentAgents=llGetListLength(RecentAgents);
        llOwnerSay ((string)TotalRecentAgents+" recent avatars:");
        llSleep(0.03);
        if (TotalRecentAgents)
        {
            integer i=0;
            for (i;i<TotalRecentAgents;i++)
            {
                key recentagentskey=llList2Key(RecentAgents,i);
                llOwnerSay ("secondlife:///app/agent/" + (string)recentagentskey + "/inspect ");
                llSleep(.03);
            }
        }
    }
    attach(key id)
    {
        if (id) llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS );
    }
    changed(integer change)
    {
        if ( change & CHANGED_OWNER ) llResetScript();
    }
    run_time_permissions(integer perms)
    {
        if ( perms & PERMISSION_TAKE_CONTROLS ) llTakeControls(CONTROL_BACK, FALSE, TRUE);
    }
}