//Chav's Radar Script - September 2007
//Maggiedoll's working mod of chav's radar script
//range 96meters, turns on on attatch aug 2008
default
{
attach(key id)
{
llSetText("", <1,1,1>, 1);
llGetOwner();
llSensorRepeat("", NULL_KEY, AGENT, 96, PI, 1);
state running;
//clear the hover text (just in case), get owner, enter state running
//turn on on attatch
}
touch_start(integer total_number)
{
llSetText("", <1,1,1>, 1);
llGetOwner();
state running;
//clear the hover text (just in case), get owner, enter state running
//turn on if switched off
}
}
state running
{
state_entry()
{
llOwnerSay("Radar active. Scanning..."
;llSensorRepeat("", NULL_KEY, AGENT, 96, PI, 1);
//start scan and tell owner
//start scan on attatch
}
sensor(integer num_detected)
{
string results;
integer x;
for (x=0 ; x < num_detected ; x++)
{
integer distance = (integer)llVecDist(llGetPos(), llDetectedPos(x));
results += llDetectedName(x) + " (" + (string)distance + "m)\n";
}
//not entirely sure, I ripped this bit from the freebie IBM radar script so your guess is as good as mine and possibly better
llSetText(results, <1,1,1>, 1);
//display results
}
touch_start(integer total_number)
{
llOwnerSay("Switching off..."
;llSensorRemove();
llSetText("", <1,1,1>, 1);
state default;
//switch off, clear hover, and return to state default
}
}
