Difference between revisions of "3D Radar"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}
==This script is not working correctly now!!!!==
==Scripts have been corrected and working properly now==
LL has changed the way rezzers work once more. When the owner leaves the simulator or logs out, the script will stop working. I am investigating a workaround.


Rezzes a ball for each avatar in range. Each ball tracks it's on AV and displays distance.
Rezzes a ball for each avatar in range. Each ball tracks it's on AV and displays distance.
Line 15: Line 14:


<lsl>
<lsl>
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Multi-Hud 2.0
// "May 24 2008", "17:33:49"
// Creator: Jesse Barnett
// Released into the Public Domain
//////////////////////////////////////////////////////////////////////////////////////////////////////
integer Scan = TRUE;
integer Scan = TRUE;
string avKey;
string avKey;
Line 20: Line 26:
list key_list;
list key_list;
integer key_chan;//Key channel is generated randomly and passed to the scan ball
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  
integer die_chan = -9423753;//Hey pick your own channels and be sure to paste them into
                            //the scan balls too!
//the scan balls too!
integer key_rem_chan = -49222879;
integer key_rem_chan = -49222879;
default {
default {
Line 49: Line 55:
if (list_pos == -1) {
if (list_pos == -1) {
key_list = (key_list =[]) + key_list +[avKey];
key_list = (key_list =[]) + key_list +[avKey];
key_chan = (integer)llFrand(-1000000) - 1000000;
key_chan = (integer) llFrand(-1000000) - 1000000;
llRezObject("scan ball", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);
llRezObject("scan ball", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);
llSleep(.25);
llSleep(.25);
Line 57: Line 63:
}
}
listen(integer c, string name, key id, string msg) {
listen(integer c, string name, key id, string msg) {
key remove_key = msg;
string remove_key = msg;
integer r = llListFindList(key_list,[remove_key]);
integer r = llListFindList(key_list,[remove_key]);
llDeleteSubList(key_list, r, r);
key_list = llDeleteSubList(key_list, r, r);
}
}
}
}
Line 68: Line 74:
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.
<lsl>
<lsl>
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Multi-Hud 2.0
// "May 24 2008", "17:33:35"
// Creator: Jesse Barnett
// Released into the Public Domain
//////////////////////////////////////////////////////////////////////////////////////////////////////
string avName;
string avName;
string avDistance;
integer avDistance;
key avKey;
key avKey;
integer avListen;
integer avListen;
Line 103: Line 116:
name = FALSE;
name = FALSE;
}
}
vector avDivPos = (avPos - rPos) * 0.010417;//Scan range/Radius of large sphere
vector avDivPos = (avPos - rPos) * 0.010417; //Scan range/Radius of large sphere
avDistance = (string) llVecDist(rPos, llDetectedPos(0));
avDistance = (integer) llVecDist(rPos, llDetectedPos(0));
llSetPos(rPos + avDivPos);
llSetPos(rPos + avDivPos);
llSetText(avName + "[" + avDistance + "]", <1, 1, 1 >, 1);
llSetText(avName + "[" + (string) avDistance + "]", <1, 1, 1 >, 1);
}
}
no_sensor() {
no_sensor() {

Revision as of 13:46, 24 May 2008

Scripts have been corrected and working properly now

Rezzes a ball for each avatar in range. Each ball tracks it's on AV and displays distance.

Scanner/Rezzer Script

Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.

Suggestion: Create a sphere with a diameter of 2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it's avatar to a range of 96 meters.

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.

<lsl> ////////////////////////////////////////////////////////////////////////////////////////////////////// // Multi-Hud 2.0 // "May 24 2008", "17:33:49" // 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,[avKey]); if (list_pos == -1) { key_list = (key_list =[]) + key_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) { string remove_key = msg; integer r = llListFindList(key_list,[remove_key]); key_list = llDeleteSubList(key_list, r, r); } } </lsl>

Scan Ball Script

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. <lsl> ////////////////////////////////////////////////////////////////////////////////////////////////////// // Multi-Hud 2.0 // "May 24 2008", "17:33:35" // 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; llSensorRepeat("", avKey, AGENT, 96, PI, 1.0); llListenRemove(avListen); } } sensor(integer n) { avPos = llDetectedPos(0); integer name = TRUE; if (name) { avName = llDetectedName(0); name = FALSE; } vector avDivPos = (avPos - rPos) * 0.010417; //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); llOwnerSay(avName + " is now out of range."); llDie(); } } </lsl>