03-04-2013, 03:11 AM
Code:
// Tracks avatars when they teleport away from a sim. A script that will, in an object, follow someone if they teleport -
// and report back to you where they went (in global co-ords it goes and gets them, even on islands).
// Using a hack in llGetObjectDetails
// it should be noted that this example will stop working when SVC-774 is implemented
// more info: http://jira.secondlife.com/browse/SVC-774
//
// Author: unknown
//
//
.
//This script was made by some sandbox goers when llGetObjectDetails first came out.
//This is actually derived from Jana Kamachi's version of the sandbox script
//(although she is not the original script's creator) - messed around with by yours truely ;)
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) || (raw.y > 256 || raw.y <0)){
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>);
}
}