De DigiWiki.
// Avatars Scanner v0.1
integer switch;
key name;
default
{
state_entry()
{
llWhisper(PUBLIC_CHANNEL, "Avatars Scanner Active");
name = llGetOwner();
}
touch_start(integer total_number)
{
switch = !switch;
if (switch)
{
llSensorRepeat("", "", AGENT, 96, PI, 20.0);
llWhisper(PUBLIC_CHANNEL, "Alert ON");
}
else
{
llSensorRemove();
llWhisper(PUBLIC_CHANNEL, "Alert OFF");
}
}
sensor(integer number)
{
vector pos = llGetPos();
integer i;
for (i = 0; i < number; i++)
{
if (llDetectedKey(i) != name)
{
float diff = llVecDist(pos,llDetectedPos(i));
integer dist = llRound(diff);
string result = (llDetectedName(i)) + " " + ((string)dist) + "m";
llWhisper(PUBLIC_CHANNEL, result);
}
}
}
no_sensor()
{
llWhisper(PUBLIC_CHANNEL, "Nothing Found");
}
}