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
Glasses Matrix_Glasses_24_Controller  

Matrix_Glasses_24_Controller

Matrix Glasses 2004 Controller.lsl

Category: Glasses
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Matrix_Glasses_24_Controller
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Matrix_Glasses_24_Controller_1.lsl
1
2 float scanWeather = 0.1;
3 float scanAirTraffic = 1;
4 float scanTactical = 5;
5 integer notify = 1;
6 integer interval = 20;
7 integer range = 200;
8 string radarID="";
9 key id;
10 float rotSpeed;
11
12 default
13 {
15 {
16 // Figure out who owns me and listen to them
17 llListen(0,"",llGetOwner(),"");
18
19 // Set up initial rotation
20 rotSpeed = scanAirTraffic;
21 llTargetOmega(<0,0,1>, rotSpeed, 0);
22
23 // Turn on sensor
24 if(notify==1)
25 llSensorRepeat("","",AGENT,range,PI,interval);
26 }
27
28 // Give instructions note card
29 touch_start(integer total_number)
30 {
31 // llGiveInventory(llDetectedKey(0), "Matrix Glasses 2004 Controller");
32 }
33
34 // Handle sensor events (if turned on)
35 sensor(integer n) {
36 integer i;
37 string preamble;
38 vector pos;
39 vector me = llGetPos();
40 integer dist;
42 string dt =
43 (string)((t/3600)%24)
44 +":"
45 +(string)((t%3600)/60)
46 +":"
47 +(string)(t%60);
48 string iSee = " ";
49 for(i=0; i<n; i++) {
50 pos = llDetectedPos(i);
51 dist = (integer)llVecDist(me, pos);
52 iSee += " ["+llDetectedName(i)+" @ "+(string)dist+"M] ";
53 }
54 if(radarID!="")
55 preamble="["+radarID+"] : ";
56 else
57 preamble = "";
58 llInstantMessage(llGetOwner(), preamble+iSee);
59 }
60
61 // Listen for instructions
62 listen(integer channel, string name, key id, string message) {
63 float magnitude = 2;
64 rotSpeed = -1;
65 list cmd = llParseString2List(message, [" "], []);
66 string auth = llList2String(cmd, 0);
67
68 if(id != llGetOwner()) {
69 //string op = llToUpper(llList2String(cmd, 0));
70 //llSay(0, op+" NAK: Control by non-owners is forbidden.");
71 return;
72 }
73
74 // Handle 'factory'
75 if(auth=="reset") {
76 // llSay(0, "Calling Reset..: Scan reset done.");
78 // This stuff is obsolete, oh well
79 notify = 1;
80 interval = 60;
81 range = 96;
82 radarID="";
83 rotSpeed = scanAirTraffic;
84 llTargetOmega(<0,0,1>, rotSpeed, 2);
86 llSensorRepeat("","",AGENT,range,PI,interval);
87 }
88
89 // Handle 'scanctl x y'
90 if(auth=="scan") {
91 integer scanset=0;
92 string scan = llList2String(cmd, 1);
93 if(scan=="on") {
95 llSensorRepeat("","",AGENT,range,PI,interval);
96 scan="Enable scanner";
97 scanset=1;
98 }
99 if(scan=="off") {
101 scan="Disable scanner";
102 scanset=1;
103 }
104 if(scan=="interval") {
105 interval = llList2Integer(cmd, 2);
106 scan="Set interval "+(string)interval+" and enable scanner";
108 llSensorRepeat("","",AGENT,range,PI,interval);
109 scanset=1;
110 }
111 if(scan=="range") {
112 range = llList2Integer(cmd, 2);
113 scan="Set range "+(string)range+" and enable scanner";
115 llSensorRepeat("","",AGENT,range,PI,interval);
116 scanset=1;
117 }
118 if(scan=="name") {
119 radarID = llList2String(cmd, 2);
120 scan="Set name '"+radarID+"'";
121 scanset=1;
122 }
123 if(scanset!=1) {
124 // llSay(0, "SCAN: Try 'on', 'off', 'name xyz', 'interval x' (seconds), or 'range x' (0-96).");
125 } else {
126 // llSay(0, "SCAN: ["+scan+"]");
127 }
128 }
129
130 // Handle 'radarctl x y z'
131 if(auth=="radarctl") {
132 string speed = llList2String(cmd, 1);
133 if(speed=="Weather")
134 rotSpeed = scanWeather;
135 if(speed=="AirTraffic")
136 rotSpeed = scanAirTraffic;
137 if(speed=="Tactical")
138 rotSpeed = scanTactical;
139 if(speed=="stop")
140 rotSpeed = 0;
141 if(speed=="speed") {
142 rotSpeed = llList2Float(cmd, 2);
143 speed = "Set speed "+(string)rotSpeed;
144 }
145 if(rotSpeed == -1) {
146 // llSay(0, "RADARCTL: Try 'Weather', 'AirTraffic', 'Tactical', 'stop', or 'speed n.nn'.");
147 }
148 if(rotSpeed >= 0) {
149 // llSay(0, "RADARCTL ACK: ["+speed+"]");
150 if(rotSpeed==0)
151 magnitude = 0;
152 llTargetOmega(<0,0,1>, rotSpeed, magnitude);
153 }
154 }
155 }
156 }// END //

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