
targeting.MKIII
list noobkeys;
list noobnames;
GOTCHASUCKER(key target){
// [endless possibilities]
llOwnerSay((string)target);
}
dispAvFeed(){
string targetlist="";
key thisnub;
string tgtname;
vector tgtpos;
integer dist=0;
integer i;
noobnames=[];
for(i=0;i<llGetListLength(noobkeys);i++){
thisnub=llList2Key(noobkeys,i);
list tgtintel=llGetObjectDetails(thisnub,[OBJECT_NAME,OBJECT_POS]);
tgtname=llList2String(tgtintel,0);
tgtpos=llList2Vector(tgtintel,1);
dist=(integer)llVecDist(llGetPos(),tgtpos);
targetlist+=tgtname+" ["+(string)dist+"]\n";
noobnames+=tgtname;
}
llSetText(targetlist,<1,1,1>,1);
}
updateList(integer flag, list nubs){
integer i;
string currnub; integer nubFound;
for(i=0;i<llGetListLength(nubs);i++){
currnub=llList2String(nubs,i);
nubFound=llListFindList(noobkeys,[currnub]);
if(flag>0 && nubFound==-1 && currnub!=llGetOwner())
noobkeys+=currnub;
else if(flag==0 && nubFound>-1)
noobkeys=llDeleteSubList(noobkeys,nubFound,nubFound);
}
dispAvFeed();
}
default{
on_rez(integer param){
llResetScript();
}
state_entry(){
noobkeys=[];
llSetText("",<0,0,0>,1);
llListen(-777777777,"","","");
llTriggerSound("76c78607-93f9-f55a-5238-e19b1a181389",1);
llListen(-19,"","","");
llSetTimerEvent(5);
}
listen(integer chan,string who,key id,string msg){
integer feedflag;
if(chan==-19){
integer tgtindex=llListFindList(noobnames,[msg]);
key target=llList2Key(noobkeys,tgtindex);
GOTCHASUCKER(target);
}
else{
//llOwnerSay(msg);
list nubs=llParseString2List(msg,[","],[]);
feedflag=(integer)llList2String(nubs,1);
nubs=llDeleteSubList(nubs,0,1);
updateList(feedflag,nubs);
}
}
changed(integer chg){
if(chg & CHANGED_REGION){
noobkeys=[];
llSetText("",<0,0,0>,1);
llTriggerSound("76c78607-93f9-f55a-5238-e19b1a181389",1);
}
}
touch_start(integer num){
if(llGetListLength(noobnames)>0)
llDialog(llGetOwner(),"Let's annoy someone.",noobnames,-19);
}
timer(){
dispAvFeed();
}
}