Ultimate Radar
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Zx Ultimate Radar
An advanced radar to detect users and their language on an entire region without any lag. You can test it in Full Sim: it's not a problem for it.
- Copyright (C) 2016 Luxen - Luxen_Resident - version 5.0
- Optimized: tested with more 90 users, low memory, safe and secure
History
- I created the first version 3 years ago and I sold different versions on MarketPlace.
- Optimized and tested for 3 years.
- I tried to create the perfect SL radar but i understood something: At each version was thinking it was perfect but some months later not. So it's my 2016 SL radar version.
Code:
//////////////////////////////////////////////////////////////////////////////
// Zx Ultimate Radar Hud v5 //
// //
// Copyright (C) 2016 Luxen - Zonyx Technology //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License version 3, as //
// published by the Free Software Foundation. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/> //
//////////////////////////////////////////////////////////////////////////////
integer counter = 0;
key owner = NULL_KEY;
integer RStat = TRUE;
set_time(float Stime, string Stext, integer Scounter)
{
llSetText(Stext, <0.667, 0.667, 0.667>, 1.0);
if (Stime != 5.0) llSetTimerEvent(Stime);
counter = Scounter;
}
default
{
state_entry()
{
if(owner) ;
else
{
llSetMemoryLimit(40000);
owner = llGetOwner();
set_time(10.0, "[- Starting -]", 0);
}
}
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
if(change & (CHANGED_REGION)) state teleport;
}
touch_start(integer total_number)
{
if (llGetAttached())
{
if (counter)
{
set_time(0.0, "[- Off -]", 0);
RStat = FALSE;
}
else if (!RStat)
{
set_time(10.0, "[- Starting -]", 0);
RStat = TRUE;
}
}
}
timer()
{
list AvatarsDetect = llGetAgentList(AGENT_LIST_REGION, []);
integer numOfAvatars = llGetListLength(AvatarsDetect);
if (!llGetAttached())
{
if (llGetObjectPrimCount(llGetKey()))
{
set_time(0.0, "[- Off -]", 0);
RStat = FALSE;
}
}
else if (numOfAvatars < 2)
{
if (counter != 2) set_time(5.0, "[- Nobody -]", 2);
}
else if (numOfAvatars > 100) return;
else
{
integer index;
list NewTab = [];
vector currentPos = llGetPos();
integer Zfix = numOfAvatars;
for (index = 0; index < Zfix; ++index)
{
key AvKey = llList2Key(AvatarsDetect, index);
list AvPos = llGetObjectDetails(AvKey, [OBJECT_POS]);
if (AvPos) NewTab += [llVecDist(currentPos, llList2Vector(AvPos, 0)), AvKey];
else --numOfAvatars;
}
if (numOfAvatars > 1)
{
AvatarsDetect = [];
NewTab = llListSort(NewTab, 2, TRUE);
string mode = "[- Sim: " + (string)(numOfAvatars -1) + " -]";
numOfAvatars *= 2;
for(index = 0; index < numOfAvatars; index += 2)
{
key id = llList2Key(NewTab, index + 1);
if (Zfix)
{
if (id == owner)
{
Zfix = FALSE;
jump Ignore;
}
}
string DName = llGetUsername(id);
string DLang = "?";
if (DName)
{
DLang = llGetAgentLanguage(id);
if (llStringLength(DLang) != 2)
{
if (DLang == "en-us") DLang = "en";
else DLang = "xx";
}
}
else DName = "???";
DName += " (" + DLang + "-" + (string)llList2Integer(NewTab, index) + "m)";
if (index > 18)
{
DName = mode + "\n" + DName;
if (llStringLength(DName) > 254) jump affich;
else mode = DName;
}
else mode += "\n" + DName;
@Ignore;
}
@affich;
NewTab = [];
set_time(5.0, mode, 1);
}
}
}
}
state teleport
{
state_entry()
{
if (counter) set_time(10.0, "[- Searching -]", 0);
state default;
}
on_rez(integer start_param)
{
llResetScript();
}
timer()
{
return;
}
}