User:Jana Kamachi/Detect

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 dtc = [];
list darl = [];

integer darl_d = FALSE;
integer cnt = 0;

vector lastpos;
vector curpos;

default
{
    state_entry()
    {
        llSensorRepeat("", "", SCRIPTED, 1.0, PI, 0.001);   
        llSetTimerEvent(0.001);
        lastpos = llGetPos();
    }
    
    sensor(integer n_m){
        integer i=0;
        dtc = [];
        if(n_m > 2) n_m = 2;//no need for a jump;
        for(; i<n_m; ++i) {
            dtc += (llDetectedName(1) + " owned by " + llKey2Name(llDetectedOwner(1)));
        }
    }
    
    timer(){
        if(llVecDist(lastpos, curpos = llGetPos()) > 1000){
            llOwnerSay("Orbit Detect.");
            llOwnerSay("Possible Orbiters\n" + llDumpList2String(dtc,"\n"));  
            cnt = 0;
            lastpos = curpos; 
        }else if(500 < ++cnt){//will force update lastpos about every 25 to 50 seconds.
            cnt = 0;
            lastpos = curpos;
        }
    }
}