Jump to content

Help for a 3d Radar


MarKenn Tatham
 Share

You are about to reply to a thread that has been inactive for 4412 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi folks,

I'm attempting to create a 3d radar that is able to detect av's in an entire region using the llGetAgentList(AGENT_LIST_REGION, []) code simpley because the standard method is limited to 96m.

However I'm not much of a scripter and need help. I've got a copy of the 3d radar code from the wiki.. located here ... and I've tried to use it as a base to use the new code, it'll accept the changes I make, but doesn't function.

Any ideas?

Link to comment
Share on other sites

have tried a few simple things with no effect really.. the main thing I saw to change was the sensor repeat line... which as the above says.. screwed it up lol.. like I said.. don't really know what I'm doing here so......


integer Scan = TRUE;
string avKey;
integer list_pos;
list key_list;
integer key_chan;    //Key channel is generated randomly and passed to the scan ball
integer die_chan = -9423753;    //Hey pick your own channels and be sure to paste them into the scan balls too!
integer key_rem_chan = -49222879;
default {
    state_entry() {
        llSetObjectName("3D Radar");
    }
    touch_start(integer total_number) {
        if (Scan) {
            llGetAgentList(AGENT_LIST_REGION, []);
            key_list =[];
            llListen(key_rem_chan, "", "", "");
            llOwnerSay("on");
            Scan = FALSE;
        }
        else {
            llSensorRemove();
            llRegionSay(die_chan, "die");
            llOwnerSay("off");
            Scan = TRUE;
        }
    }
    sensor(integer iNum) {
        integer p = 0;
        for (p = 0; p < iNum; ++p) {
            avKey = llDetectedKey(p);
            list_pos = llListFindList(key_list, (list)avKey);
            if (list_pos == -1) {
                key_list += (list) avKey;
                key_chan = (integer) llFrand(-1000000) - 1000000;
                llRezObject("scan ball", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);
                llSleep(.25);
                llRegionSay(key_chan, avKey);
            }
        }
    }
    listen(integer c, string name, key id, string msg) {
        integer r = llListFindList(key_list,[(key)msg]);
        key_list = llDeleteSubList(key_list, r, r);
    }
}

oh and here is the other part if that's needed for the scan ball as well.....

 

string avName;
integer avDistance;
key avKey;
integer avListen;
integer key_chan;
integer die_chan = -9423753;
integer key_rem_chan = -49222879;
vector avPos;
vector rPos;
default {
    state_entry() {
        llSetObjectName("scan ball");
    }
    on_rez(integer start_param) {
        rPos = llGetPos();
        key_chan = start_param;
        llListen(die_chan, "", "", "");
        avListen = llListen(key_chan, "", "", "");
    }
    listen(integer c, string n, key id, string msg) {
        if (c == die_chan)
            llDie();
        else {
            avKey = (key) msg;
            avName = llKey2Name(avKey);
            llGetAgentList(AGENT_LIST_REGION, []);
            llListenRemove(avListen);
        }
    }
    sensor(integer n) {
        avPos = llDetectedPos(0);
        vector avDivPos = (avPos - rPos) / (96 / 1);    //Scan range/Radius of large sphere
        avDistance = (integer) llVecDist(rPos, llDetectedPos(0));
        llSetPos(rPos + avDivPos);
        llSetText(avName + "[" + (string) avDistance + "]", <1, 1, 1 >, 1);
    }
    no_sensor() {
        llRegionSay(key_rem_chan, avKey);
        llDie();
    }
}

Link to comment
Share on other sites

The problem is that LLGetAgentList is not just another way to call a sensor.  It does not fire the sensor event at all.  What it does is return a list of agent keys.  Then you have to take action on that list.  It will take a complete redesign of the wiki code. Have you looked at the wiki sample script for llGetAgentList

Link to comment
Share on other sites

I did take a look yes, and I really don't know what to do with it if it's not gonna plug into what I got already so, unless one of you fine scripters wanna take a crack at it and pass on any successful results, I'll have to let it go for now till I can find time to learn how to script from scratch.

shudders... lol

thanks for taking the time tho folks, preciate it :)

Link to comment
Share on other sites

Don't give up hope.   llSensorRepeat means "keep on scanning with the sensor every n seconds.   So the equivalent using llGetAgentList would be to call that in a timer() event every n seconds, and do inside the timer event -- if llGetAgentList returns any results -- the stuff you do in the sensor event in that script (suitably modified, of course).

I can see other ways of optimising the script now we've got some newer functions to play with, but see if you can get it working with that.

 

 

Link to comment
Share on other sites


MarKenn Tatham wrote:

... till I can find time to learn how to script from scratch.

Well yes, this is a forum for people who script.  This isn't the sort of project you'll be able to do without learning to script.  If you don't want to learn you can hire someone to write the script for you by advertising in in-world employment or wanted.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4412 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...