Ultimate Radar

Expired

 

 

Original Author: Luxen - Zonyx Technology

Create Date: 1/18/2017

Category: Radar

Description: An advanced radar to detect avatars and their language on an entire region.

Download Script Here: 

Download Script

 

 

 
//////////////////////////////////////////////////////////////////////////////
//                      Zx Ultimate Radar Hud   v5                          //
//                                                                          //
//                     By Luxen - Zonyx Technology                          //
//////////////////////////////////////////////////////////////////////////////

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);
                        integer Dlenght = llStringLength(DLang);
                        if (Dlenght == 2)  ;
                        else if (Dlenght == 5)
                        {
                            if (DLang == "en-us") DLang = "en";
                            else DLang = "xx";
                        }
                        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;
    }
}

 

Have Questions? Need help? Leave a note for Kitsune Lassiter in Second Life

 

 

Additional Notes & Instructions(If any):

Simple Ship's Radar

Expired

From Lucinda Bullock via the scripting forum:

this is script to display above a prim your ships heading and any rocks or ships around you

it uses most of the llDetect functions that freak people

study it and see that they arnt as scary as they look

this is a ships compass that detects the closest thing and gives its relative position,heading and speed

the things you need for sailing:

 

list range = ; // list of radar ranges
list angle = ;//list of radar angles
list times = ;//list of radar times
list cp =;//list of headings and positions
integer rate = 0;
integer heading = -10;
integer target = -10;
integer targethead = -10;
key targetkey = NULL_KEY;
float targetvel;
integer targetdis;
integer targettype;
string sonarsound = "";//a radar ping sound to make it more real
string captian = "";

default
{
    state_entry()
    {
     list temp = llParseStringKeepNulls(llKey2Name(llGetOwner()),,);
     captian = "Captian "+llList2String(temp,1);//this just makes the captians name
     llSetTimerEvent(2);// short timer to do the first dispaly
    }

    timer()
    {
     llSetTimerEvent(0);//stop timer
     vector dir = <0.0, 1.0, 0.0> / llGetRot();//convert your rotation to a position vector
     string knots = llGetSubString((string)(llVecMag(llGetVel())*1.943846),0,3);//find your speed in knots
     heading = llRound(llAtan2(dir.x, dir.y) *llGetListLength(cp) / TWO_PI);//find you direction as far as compass points - it can be more
     string result = captian+"\nHeading:- "+llList2String(cp,heading)+"\nSpeed:- "+knots+" kts\n";//start making text string
     if(target != -10)// is there somthing near
      {
       string tknots = llGetSubString((string)(targetvel*1.943846),0,3);//yes get its speed
       result += llKey2Name(targetkey)+" "+(string)targetdis+"m to the "+llList2String(cp,target)+"\n";//print name and distance
       if((targettype == ACTIVE) && (targetvel >0.0)) result += "Ship heading:- "+llList2String(cp,targethead)+"\nSpeed:- "+tknots+" kts\n";//if a ship print its data
      }
     llSetText(result,<1 ,1,1>,1); //print the info above prim
     llSensor("","",ACTIVE|PASSIVE,llList2Float(range,rate),PI_BY_TWO*llList2Float(angle,rate));//start a new radar ping
    }
   sensor(integer tnum)
    {
    
     if(sonarsound != "")llPlaySound(sonarsound,1.0);//something in range sound ping
     vector pos = llGetPos();//get your position
     vector dpos = llDetectedPos(0);//get the targets pos
     vector tdir = <0.0, 1.0, 0.0> / llDetectedRot(0);//turn its rotation into a direction
     float diff = llVecDist(pos,dpos);//get the distance between you and the target
     target = llRound(llAtan2((dpos.y-pos.y)/diff,(dpos.x-pos.x)/diff) * llGetListLength(cp)/ TWO_PI);//work out the compass direction relative to you
     targetkey = llDetectedKey(0);//store the tagets key
     targetvel = llVecMag(llDetectedVel(0));//store the targets speed
     targetdis = llRound(diff);//store the targets distance
     targettype = llDetectedType(0);//get the target type rocks or ship
     targethead = llRound(llAtan2(tdir.x, tdir.y) * llGetListLength(cp)/ TWO_PI);// get the targets heading
     do{rate++;}//decrease range
     while((diff

 

Showing near avatars in a menu

Expired

//Touch and get near avatars in a dialog menu.
//By Kahiro Watanabe
//GPL share it!

//menu listener
integer listener;
integer sensorChannel;

// range and arc for the sensor
float range = 15.0;
float arc = PI;

list avatarsKeys;
list avatarsNames;

menu(key user,integer channel,string title,list buttons)
{
    listener = llListen(channel,"","","");
    llDialog(user,title,buttons,channel);
    //remove listener if there's no activity in menu
    llSetTimerEvent(20.0);
}

integer randomNumber()
{
    return (integer)(llFrand(99999.0) * -1);
}

default
{
    touch_start(integer total_number)
    {
        //only owner can access the menu
        if (llDetectedKey(0) == llGetOwner())
        {
            llSensor("","",AGENT,range,arc);
        }
    }
    sensor(integer total_number)
    {
        integer i;
        key tempId;
        avatarsKeys = [];
        avatarsNames = [];
        i = 0;
        while ((i  -1)
            {
                llSay(0,message + "'s key is " + llList2String(avatarsKeys,pos));
            }
        }
    }
    timer()
    {
        llListenRemove(listener);
        llSetTimerEvent(0.0);
    }
}

 

This simple script can be controlled only by owner, it will generate a list of near avatars and put it in a menu, when the user selects one it will show its key. You can do useful stuff like give an object or animate it, etc etc etc.

 

Avatar Radar (NewAge)

Expired

NewAge Avatar Radar Project Version 1.2 No longer need to spend time making a hud, just copy and past script into a prim and click yes to allow script permission to attach to your UI, Set on Center 2.

 

/////////////////////////////////
// NewAge Radar Project Script
// By Asia Snowfall
// Version 1.2
/////////////////////////////////
// v1.2;
// ------
// (Added) HUD Maker Feature, When you save script, click Yes
// (Added) Power Feature, Turn Radar on and Off
// (Added) HUD Menu, Allowing you to control Power Feature, Change from Avatar Radar to Land Information and back again
// Easier to now Modify script varibles
/////////////////////////////////
// v1.1;
// ------
// (Added) - Agent Count in Region when no agents in sensor range
// (Added) - Lag Status when no agents in sensor range
/////////////////////////////////
// v1.0
// ------
// (Initial Release)
/////////////////////////////////
 
// Configure;
float scan_range = 100;
float speed = 2;
 
integer channel = 1;
integer menu_channel = 666;
integer show_total_agents_in_chat_range = TRUE;
integer show_total_agents_in_region = TRUE;
integer show_lag_status = TRUE;
integer max_people = 7;
integer parcel_description_max_characters = 50;
 
string menu_text = "***\nAvatar Radar Project\n***\nby Asia Snowfall";
string hud_texture = "ec122289-1239-74fd-708f-ab4b949b7cdb";
 
vector hud_size = <0.1,0.1,0.1>;
 
// Core Varibles;
 
// Integer Varibles
integer setting = FALSE;
integer handler;
integer radar_power = TRUE;
integer positioning;
integer positioning_handler;
integer scan_type = TRUE;
 
// String Varibles
string people;
string lag_status;
 
// List Varibles
list people_in_sensor_range;
list people_in_sensor_vectors;
list chat_range;
list hud_position;
list main_menu;
 
// Float Varibles
float position_by = 0.01;
 
// Vector Varibles
vector text_color;
 
// Premade Functions
 
asSetPosMenu() //Might wonder why i make the script empty the hud position and fill it again with same options, but it optimizes script memory! every little helps
{
    setting = TRUE;
    hud_position = [];
    llListenRemove(positioning_handler);
    @retry;
    positioning = llRound(llFrand(999999));
    if(positioning <= 2000)
    {
        jump retry;
    }
    positioning_handler = llListen(positioning, "", "", "");
    hud_position = ["-", "Down", "+", "Left", "===", "Right", "===", "Up", "Done"];
    llSetText("Setup the hud using position control\nClick Done when your finished", <1.0, 1.0, 1.0>, 1.0);
    llSetTimerEvent(30);
}
 
asSetMainMenu()
{
    main_menu = ["Avatars", "Land Info"];
    if(radar_power == FALSE)
    {
        main_menu += "Power On";
    }
    else
    {
        main_menu += "Power Off";
    }
}
 
llLagStatus()
{
    float time_dilation = llGetRegionTimeDilation();
    if(time_dilation <= 0.3)
    {
        lag_status = "Laggy";
        text_color = <1.0,0.0,0.0>;
    }
    else if(time_dilation > 0.3 && time_dilation <= 0.5)
    {
        lag_status = "Not Bad";
        text_color = <1.0,1.0,0.0>;
    }
    else if(time_dilation > 0.5 && time_dilation <= 0.8)
    {
        lag_status = "Good";
        text_color = <0.0,1.0,0.0>;
    }
    else if(time_dilation > 0.8 && time_dilation <= 1.0)
    {
        lag_status = "Excellent";
        text_color = <0.0,1.0,1.0>;
    }
}
 
all_status()
{
    if(show_total_agents_in_region == TRUE)
    {
        people += "Region Agent Count = "+(string)llGetRegionAgentCount()+"\n";
    }
    if(show_total_agents_in_chat_range == TRUE)
    {
        people += "Agents in Range = "+(string)llGetListLength(chat_range)+"\n";
    }
    if(show_lag_status == TRUE)
    {
        people += "Lag Status = "+lag_status;
    }
}
 
finish()
{
    llOwnerSay("Starting radar system\nClick HUD for Menu");
    setting = FALSE;
    llSetTimerEvent(speed);
    llListenRemove(positioning_handler);
}
 
 
default
{
    state_entry()
    {
        llListen(menu_channel, "", "", "");
        if(llGetAttached() != 0)
        {
            llSetScale(hud_size);
            llSetTexture(hud_texture, ALL_SIDES);
            handler = llListen(channel, "", "", "");
            llOwnerSay("Find location of avatar within sensor range by typing either their full or partial name on channel "+(string)channel + ", example; /"+(string)channel+" Mark");
            asSetPosMenu();
            llDialog(llGetOwner(), menu_text, hud_position, positioning);
        }
        else if(llGetAttached() == 0)
        {
            llSensor("", "", AGENT, scan_range, PI);
            setting = FALSE;
            llListenRemove(handler);
            llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
        }
    }
    touch_start(integer x)
    {
        if(llDetectedKey(0) == llGetOwner())
        {
            if(setting == FALSE)
            {
                if(llGetAttached() != 0)
                {
                    asSetMainMenu();
                    llDialog(llGetOwner(), menu_text, main_menu, menu_channel);
                }
                else
                {
                    llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
                }
            }
            else
            {
                llDialog(llGetOwner(), menu_text, hud_position, positioning);
            }
        }
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_ATTACH)
        {
            llAttachToAvatar(ATTACH_HUD_CENTER_2);
        }
        else
        {
            llOwnerSay("Some features disabled when not attached");
            llSetTimerEvent(speed);
        }
    }
    attach(key id)
    {
        llResetScript();
    }
    listen(integer chan, string name, key id, string str)
    {
        if(id == llGetOwner())
        {
            str = llToLower(str);
            if(chan == channel)
            {
                integer index = llListFindList(people_in_sensor_range, [str]);
                if(index != -1)
                {
                    llOwnerSay(llList2String(people_in_sensor_range, index)+" is located at "+llList2String(people_in_sensor_vectors, index));
                }
                else if(index == -1)
                {
                    integer i = 0;
                    integer length = llGetListLength(people_in_sensor_range);
                    integer ind;
                    do
                    {
                        if(llStringLength(llList2String(people_in_sensor_range, i)) > 0)
                        {
                            ind = llSubStringIndex(llList2String(people_in_sensor_range, i), str);
                            if(ind != -1)
                            {
                                llOwnerSay(llList2String(people_in_sensor_range, i) + " is located at "+llList2String(people_in_sensor_vectors, i));
                                return;
                            }
                        }
                    }while(i++, 1.0);
                }
            }
            else if(chan == positioning)
            {
                if(str == "+")
                {
                    if(position_by <0.1)
                    {
                        position_by += 0.01;
                    }
                    llOwnerSay("Positioning will move by "+(string)position_by+" meters");
                }
                else if(str == "-")
                {
                    if(position_by > 0.01)
                    {
                        position_by -= 0.01;
                    }
                    llOwnerSay("Positioning will move by "+(string)position_by+" meters");
                }
                else if(str == "down")
                {
                    llSetPos(llGetLocalPos()+<0.0,0.0,-position_by>*llGetRot());
                }
                else if(str == "left")
                {
                    llSetPos(llGetLocalPos()+<0.0,position_by,0.0>*llGetRot());
                }
                else if(str == "right")
                {
                    llSetPos(llGetLocalPos()+<0.0,-position_by,0.0>*llGetRot());
                }
                else if(str == "up")
                {
                    llSetPos(llGetLocalPos()+<0.0,0.0,position_by>*llGetRot());
                }
                else if(str == "done")
                {
                    finish();
                }
                if(setting == TRUE)
                {
                    llSetTimerEvent(30);
                    llDialog(llGetOwner(), menu_text, hud_position, positioning);
                }
            }
        }
    }
    on_rez(integer g)
    {
        if(g & CHANGED_OWNER)
        {
            llResetScript();
        }
    }
    changed(integer h)
    {
        if(h & CHANGED_OWNER)
        {
            llResetScript();
        }
    }
    sensor(integer x)
    {
        people_in_sensor_range = [];
        people_in_sensor_vectors = [];
        integer i = 0;
        integer index;
        --x;
        if(x > max_people)
        {
            x = max_people-1;
        }
        do
        {
            index = llListFindList(chat_range, [llDetectedName(i)]);
            if(llStringLength(llDetectedName(i)) >! 0)
            {
                if(llVecDist(llDetectedPos(i), llGetPos()) <= 20)
                {
                    if(index == -1)
                    {
                        chat_range += llDetectedName(i);
                        llOwnerSay(llDetectedName(i) + " has entered chat range");
                    }
                }
                else
                {
                    if(index != -1)
                    {
                        llOwnerSay(llDetectedName(i) + " has left chat range");
                        chat_range = llDeleteSubList(chat_range, index, index);
                    }
                }
                people_in_sensor_range += llToLower(llDetectedName(i));
                people_in_sensor_vectors += llDetectedPos(i);
                people += llDetectedName(i) + " - " + llGetSubString((string)llVecDist(llDetectedPos(i), llGetPos()), 0, 4)+"m\n";
            }
        }while(i++ 0)
            {
                people += "\nParcel Owner = "+llKey2Name((key)llList2String(details, 2));
            }
            else
            {
                people += "\nParcel Owner = Group Owned";
            }
            people += "\nParcel Area = "+llList2String(details, 3);
            people += "\nRegion FPS = "+(string)llGetRegionFPS();
            people += "\nRegion Time Dilation = "+(string)llGetRegionTimeDilation();
        }
        llSetText(people, text_color, 1.0);
        people = "";
    }
    no_sensor()
    {
        if(llGetListLength(chat_range) > 0)
        {
            chat_range = [];
        }
        people += "Region Agent Count = "+(string)llGetRegionAgentCount()+"\nAgents in Range = "+(string)llGetListLength(chat_range)+"\n";
        people = "No People In Range\n";
        llLagStatus();
        all_status();
        llSetText(people, text_color, 1.0);
        people = "";
    }
    timer()
    {
        if(setting == FALSE)
        {
            llSensor("", "", AGENT, scan_range, PI);
        }
        else
        {
            finish();
        }
    }
}

 

Aim Detection

Expired

This script detects who's aiming at you.

 

//This script was designed by Han Shuffle AKA MichaelRyan Allen AKA Dugley Reanimator
//Cleaned up a bit by another resident.
//Cleaned up some more by another resident.
 
default
{
    state_entry()
    {
        // black and transparent floattext
        llSetText("", ZERO_VECTOR, (float)FALSE);
 
        llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, 90, PI, 0.1);
    }
 
    sensor(integer num_detected)
    {
        list output;
 
        integer i;
        do
        {
            key agentKey = llDetectedKey(i);
            string agentName = llDetectedName(i);
            vector agentPosition = llDetectedPos(i);
            rotation agentRotation = llDetectedRot(i);
            vector ownPosition = llGetPos();
 
            if (llGetAgentInfo(agentKey) & AGENT_MOUSELOOK)
            {
                if (llVecDist(ownPosition, agentPosition+llRot2Fwd(agentRotation)*llVecDist(ownPosition,agentPosition)) <1.5)
                    output += [agentName];
            }
        }
        while (++i < num_detected);
 
        llSetText(llDumpList2String(output, "\n"), <1.0, 1.0, 1.0>, (float)TRUE);
    }
}