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
Sensor Square_Sensor  

Square_Sensor

Put this script into a cube, and change the size of the cube to the area you want to be sensed, then say 'reset'

It has the coodinates of the cubes area, you can then change the size or location of the cube, and it will only sensor the area where you set it.

Category: Sensor
By : Fred Kinsei
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Square_Sensor
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Square_Sensor_1.lsl
1 //Credit to the creator:
2 //Made by SL resident Fred Kinsei
3
4 vector corner1; //Highest
5 vector corner2; //Lowest
6 string scan;
7 refresh()
8 {
9 llSetText(scan, <1,1,1>, 10);
10 }
11 default
12 {
14 {
15 vector mypos = llGetPos();
16 vector myscale= llGetScale();
17 corner1.x = mypos.x + (myscale.x / 2);
18 corner1.y = mypos.y + (myscale.y / 2);
19 corner2.x = mypos.x - (myscale.x / 2);
20 corner2.y = mypos.y - (myscale.y / 2);
21 llSensorRepeat("", "", AGENT, 96, TWO_PI, 10); // this is a 10 second scan, hard for someone to travel 96 meters in 10 seconds!
22 llListen(0, "", llGetOwner(), "");
23 }
24 listen(integer chan, string name, key id, string message)
25 {
26 if(message == "reset")
27 {
29 }
30 }
31 sensor(integer num)
32 {
33 scan = "";
34 integer i;
35 for(i=0;i<num;i++)
36 {
37 vector pos = llDetectedPos(i);
38 if(pos.x > corner2.x && pos.x < corner1.x)
39 {
40 if(pos.y > corner2.y && pos.y < corner1.y)
41 {
42 //When an agent is detected, do something with them within these brackets
43 scan += llDetectedName(i) + "\n";
44 }
45 }
46 }
47 refresh();
48 }
49 }

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