User:Jana Kamachi/Detect
< User:Jana Kamachi
Jump to navigation
Jump to search
Revision as of 12:24, 19 November 2007 by Strife Onizuka (talk | contribs) (There is a min event delay (pointless to try to loop faster then it), the scan arc is between 0 and PI, not TWO_PI)
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(i) + " owned by " + llKey2Name(llDetectedOwner(i))); } } 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; } } }