Difference between revisions of "Recent Avatar Scanner"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 19: Line 19:
             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 list");
             RecentAgents += (key)Agent;
             RecentAgents += (key)Agent;
             if (llGetListLength(RecentAgents)>MaxRecent) llDeleteSubList(RecentAgents, 0, 0);
             if (llGetListLength(RecentAgents)>MaxRecent) RecentAgents=llDeleteSubList(RecentAgents, 0, 0);
         }
         }
     }
     }

Revision as of 08:35, 7 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 list");
            RecentAgents += (key)Agent;
            if (llGetListLength(RecentAgents)>MaxRecent) RecentAgents=llDeleteSubList(RecentAgents, 0, 0);
        }
    }
}
default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);
        llSetTimerEvent(5.0);
    }
    timer()
    {
        Process_Region_Agents();
    }
    touch_start(integer index)
    {
        integer TotalRecentAgents=llGetListLength(RecentAgents);
        if (TotalRecentAgents)
        {
            llOwnerSay ((string)TotalRecentAgents+" recent avatars:");
            integer i=0;
            for (i;i<TotalRecentAgents;i++)
            {
                key recentagentskey=llList2Key(RecentAgents,i);
                llOwnerSay ((string)(i+1)+". secondlife:///app/agent/" + (string)recentagentskey + "/inspect ");
            }
        }
        else llOwnerSay("No Recent Avatars");
    }
    //changed(integer change)
    //{
    //    if ( change & CHANGED_REGION ) Process_Region_Agents();
    //}
    run_time_permissions(integer perms)
    {
        if ( perms & PERMISSION_TAKE_CONTROLS ) llTakeControls(CONTROL_BACK, FALSE, TRUE);
    }
}