Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Radar Radar  

Radar

Radar

Category: Radar
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Radar
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Radar_1.lsl
1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // ISBN: 160439000
6 X// Copyright 2007 by Heaton Research, Inc.
7 //
8 // This script may be freely copied and modified so long as this header
9 // remains unmodified.
10 //
11 // For more information about this book visit the following web site:
12 //
13 // http://www.heatonresearch.com/articles/series/22/
14
15 integer freq = 1;
16
17 default
18 {
20 {
21 llSensorRepeat("", "",AGENT, 96, PI, freq);
22 }
23
24 sensor(integer num_detected)
25 {
26 integer i;
27 string name;
28 integer distance;
29 string result = "";
30 list data = [];
31
32 vector pos = llGetPos();
33
34
35 for(i=0;i<num_detected;i++)
36 {
37 name = llKey2Name(llDetectedKey(i));
38 vector detPos = llDetectedPos(i);
39 distance = (integer)llVecDist(pos, detPos);
40 data += distance;
41 data += name;
42 }
43
44 llListSort(data,2,FALSE);
45
46 integer listLength = llGetListLength(data);
47 for( i=0;i<listLength;i+=2)
48 {
49 distance = llList2Integer(data,i);
50 name = llList2String(data,i+1);
51
52 result = result + name + " [" + (string)distance + "m]\n";
53 }
54
55 llSetText(result,<1,1,1>,1);
56 }
57 }

Back to the Best Free Tools in Second Life and OpenSim.