Page 1 of 1

Help get the 3D Region Scanner to work on 512x512 Varregion

Posted: Tue Mar 15, 2022 11:26 am
by Lunk Portal
Greetings all,

I have a region scanner that shows the location of other avatars and it works fine for a single region, but not for varregion 512x512

Here is the script

Code: Select all

// :CATEGORY:Radar
// :NAME:3D_Radar
// :AUTHOR:Jesse Barnett
// :KEYWORDS:
// :CREATED:2010-12-27 12:41:03.763
// :EDITED:2013-09-18 15:38:46
// :ID:4
// :NUM:6
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// Rezzes a ball for each avatar in range. Each ball tracks it's on AV and displays distance.
// :CODE:
// 
// This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) & multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):
// 
// 1/96 = approximately 0.010417. 

//////////////////////////////////////////////////////////////////////////////////////////////////////

//                3D Radar 2.5

//                 "Oct 15 2008", "18:43:28"

//                 Creator: Jesse Barnett

//                Released into the Public Domain

//////////////////////////////////////////////////////////////////////////////////////////////////////

 

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) {

            llSensorRepeat("", "", AGENT, 96, PI, 1);

            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, <0.0,0.0,0.0,1.0>, 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);

    }

}
and the rez ball script for avatar location

Code: Select all

// :CATEGORY:Radar
// :NAME:3D_Radar
// :AUTHOR:Jesse Barnett
// :KEYWORDS:
// :CREATED:2010-12-27 12:41:03.763
// :EDITED:2013-09-18 15:38:46
// :ID:4
// :NUM:7
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// DESCRIPTION: []::Rezzes a ball for each avatar in range. Each ball tracks it's on AV and displays distance
// :CODE:

// Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself.
// 
// Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80. 
//////////////////////////////////////////////////////////////////////////////////////////////////////

//                3D Radar 2.5

//                 "Oct 15 2008", "18:44:36"

//                 Creator: Jesse Barnett

//                Released into the Public Domain

//////////////////////////////////////////////////////////////////////////////////////////////////////

 

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);

            llSensorRepeat("", avKey, AGENT, 96, PI, 1.0);

            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();

    }

}
Anyone know how to make this work?? Or have one where I can designate the areas to scan, say 3 of the 4 regions and ignore the 4th?

Thanks

Re: Help get the 3D Region Scanner to work on 512x512 Varregion

Posted: Tue Mar 15, 2022 7:59 pm
by Lunk Portal
Well, I played with the script today and added a lot of my own elements, such as sculpted region, and a region map edited in photoshop to imitate the scanner from the Book of Boba Fett, which is my inspiration for this project for TatooineRP.

Image

https://www.flickr.com/photos/tatooiner ... ed-public/

I still cannot get the scanner to scan further than 96m, and the scanner is designed to scan a sphere of 96m, I would settle for x,y only for the 512x512 since flying will be disabled in my region, but I cannot for the life of me figure it out!

Re: Help get the 3D Region Scanner to work on 512x512 Varregion

Posted: Tue Mar 15, 2022 8:19 pm
by Christine Nyn
The script is designed to track avatars on a 256x256 region, the standard in Second Life, and if all you are wanting to do is track avatars on a larger region and get their positions there is a much neater option open to you in Opensim:

list osGetAvatarList()
C#: LSL_List osGetAvatarList()
Returns a strided list of the UUID, position, and name of each avatar in the region except the owner.

This function is similar to osGetAgents but returns enough info for a radar.
Threat Level None
Permissions ${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER

If it isn't immediately clear to you how to implement this contact me inworld and we can put together something that exactly meets your needs?

Re: Help get the 3D Region Scanner to work on 512x512 Varregion

Posted: Tue Mar 15, 2022 8:31 pm
by Lunk Portal
Christine Nyn wrote: Tue Mar 15, 2022 8:19 pm The script is designed to track avatars on a 256x256 region, the standard in Second Life, and if all you are wanting to do is track avatars on a larger region and get their positions there is a much neater option open to you in Opensim:

list osGetAvatarList()
C#: LSL_List osGetAvatarList()
Returns a strided list of the UUID, position, and name of each avatar in the region except the owner.

This function is similar to osGetAgents but returns enough info for a radar.
Threat Level None
Permissions ${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER

If it isn't immediately clear to you how to implement this contact me inworld and we can put together something that exactly meets your needs?
Thanks, I'll see if I can hash it out. My region isn't online yet, still have about a month's worth of scripting and construction before it can go live, but I like the sound of this and think it may work for me.