User:Jana Kamachi/AvatarTracker

From Second Life Wiki
Jump to navigation Jump to search

If you like this script, or any script I've released, please post on my Talk page, or I'll most likely never see it o: If you want to improve a script, just go for it!


list    keys = [];
vector  last = <0,0,0>;

default
{
        state_entry(){
                llListen(3,"",llGetOwner(),"");
                llSensorRepeat("",NULL_KEY,AGENT,96,PI*2,1);
                llSetTimerEvent(0.00001);
        }

        timer(){
                integer i=0;
                list    temp;
                vector  raw;

                @home;
                for(i=0;i<llGetListLength(keys);i++){
                        temp = llGetObjectDetails(llList2Key(keys,i),[OBJECT_POS]);
                        raw  = llList2Vector(temp,0);
                        if(raw.x > 256 || raw.x < 0 && llKey2Name(llList2Key(keys,i))!="Pinkie Piek"){
                                llOwnerSay(llKey2Name(llList2Key(keys,i)) + " has left the sim to " + (string)raw);
                                last = raw;
                                keys = llDeleteSubList(keys,i,0);
                                jump home;
                        }
                }
        }

        sensor(integer n_m){
                integer i=0;
                for(i=0;i<n_m;i++){
                        if(llListFindList(keys,[llDetectedKey(i)])==-1){
                                keys+=[llDetectedKey(i)];
                                llOwnerSay("Indexed: " + llKey2Name(llDetectedKey(i)));
                        }
                }
        }

        changed(integer c){
                if(c  == CHANGED_TELEPORT){
                        keys = [];
                }
        }

        touch_start(integer n_m){
                llMapDestination(llGetRegionName(),last,<0,0,0>);
        }

        listen(integer c, string name, key id, string msg){
                llMapDestination(llGetRegionName(),(vector)msg,<0,0,0>);
        }
}