Second Life Copybot
Multi prims llGetAgentList radar - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Communication Scripts (https://secondlifecopybot.com/forum-46.html)
+----- Thread: Multi prims llGetAgentList radar (/thread-669.html)



Multi prims llGetAgentList radar - zion - 02-18-2013

1. Make/drag-copy around 20 cubes. Or really, how many you want. Basically you need 1 cube + amount of avatars you want to display.

2. Link all cubes

3. Put this script into the root cube:

PHP Code:
////////Start here////////

list lTemp;
list 
lTargets// List of Agents
key kTemp;
integer iPrimCount// Amount of prims
integer iTemp;
integer iLast// Last amount of targets
string md5// Md5 of agent list
clear()
{
// Clean text
iTemp=iPrimCount;
do
llSetLinkPrimitiveParamsFast((iPrimCount+1) - iTemp=~-iTemp,[PRIM_TEXT,"",<1,1,1>,1]);
while(
iTemp);
// Get agents
lTargets=[];
if(
iTemp=((lTemp=llGetAgentList(AGENT_LIST_REGION,[]))!=[]))
do
lTargets+=[kTemp=llList2Key(lTemp,iTemp=~-iTemp),llKey2Name(kTemp)];
while(
iTemp);
// Save md5 of target list, and amount of targets
md5=llMD5String(llDumpList2String(lTemp," "),111);
iLast=(lTargets!=[])/2;
}


build()
{
// Put together prims
if((iTemp=llGetNumberOfPrims()) > 1)
do
llSetLinkPrimitiveParamsFast(iTemp,[PRIM_SIZE,<0.01,0.01,0.01>,PRIM_POSITION,<0,0,0.2 + (0.1 iTemp)>]);
while((
iTemp=~-iTemp) > 1);
}


default
{
state_entry()
{
// Start stuff
iPrimCount=llGetNumberOfPrims()-1;
build();
clear();
llSetTimerEvent(2);
}
on_rez(integer foo)
{
clear();
}
changed(integer change)
{
// Clear/rebuild prims on region change/relink
if(change CHANGED_REGION)
clear();
else if(
change CHANGED_LINK)
{
build();
clear();
}
}
timer()
{
// If llGetAgentList() has a differet md5 than the one we stored, avatars changed
if(md5!=llMD5String(llDumpList2String(lTemp=llGetAgentList(AGENT_LIST_REGION,[])," "),111))
{
// empty list and re-fill
lTargets=[];
if(
iTemp=lTemp!=[])
do
lTargets+=[kTemp=llList2Key(lTemp,iTemp=~-iTemp),llKey2Name(kTemp)];
while(
iTemp);
md5=llMD5String(llDumpList2String(lTemp," "),111);
// Clean text prims that are now empty
if((iTemp=((lTargets!=[])/2)) < iLast)
do
llSetLinkPrimitiveParamsFast(iTemp=-~iTemp,[PRIM_TEXT,"",<1,1,1>,1]);
while(
iTemp iLast);
iLast=(lTargets!=[])/2;
}
// If we have links, display stuff
if(llGetNumberOfPrims() > 1)
if(
iTemp=lTargets!=[])
{
do
{
iTemp=~-iTemp;
llSetLinkPrimitiveParamsFast(2iTemp/2,[PRIM_TEXT,llList2String(lTargets,iTemp+1)+" "+llList2String(llGetObjectDetails(llList2Key(lTargets,iTemp=~-iTemp),[OBJECT_POS]),0),<1,1,1>,1]);
}
while(
iTemp);
}
}
}

//===============End=========