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
Vehicles Chen_Engine  

Chen_Engine

Chen Engine.lsl

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

the Zip file

Download all files for Chen_Engine
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Chen_Engine_1.lsl
1
2 integer speedfoward = 25;
3 integer speedback = -15;
4 integer handleleft = 3;
5 integer handleright = 3;
6 float attract = .5;
7 string preset = "Manual";
8
9 default
10 {
11
12
14 {
15 llPreloadSound("tricyclealarm");
16 llPreloadSound("arm");
17 llListen(0,"","","");
20
21
22 llSetSitText("Drive");
23
24
25 llSitTarget(<0.6, 0.03, 0.20>, ZERO_ROTATION);
26
27 llSetCameraEyeOffset(<-15.0, -0.00, 3.0>);
28 llSetCameraAtOffset(<3.0, 0.0, 3.0>);
29
30
31
33
34
35
37
38
43
44
45 llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
48 llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.5);
49
52
53
56
57
61
62
63
64
65 llCollisionSound("", 0.0);
66
67
68 }
69
70
71 listen(integer channel, string name, key id, string message)
72 {
73 if(message == "speed +" && id == llGetOwner()){
74 speedfoward = speedfoward + 10;
75 speedback = speedback - 5;
76 preset = "Manual";
77 llSay(0, "Foward Speed is Now " +(string)speedfoward +" Meters/s. The Reverse Speed is now " +(string)speedback +" Meters/s");
78 }if(message == "speed -" && id == llGetOwner()){
79 speedfoward = speedfoward - 10;
80 speedback =speedback +5 ;
81 preset = "Manual";
82 llSay(0, "Foward Speed is Now " +(string)speedfoward +" Meters/s. The Reverse Speed is now " +(string)speedback +" Meters/s");
83 }
84 if(message == "speed" && id == llGetOwner()){
85
86 llSay(0, "Foward Speed is Currently " +(string)speedfoward +" Meters/s. The Reverse Speed is Currently " +(string)speedback +" Meters/s");
87 }
88 if(speedback >=0)
89 {
90 speedback = -15;
91 llSay(0, "The Reverse Speed Has Reached The Slowest Speed of 5 Meters/s..Setting Speed To -15 Meters/s");
92 }
93 if(speedfoward <=0)
94 {
95 speedfoward = 10;
96 llSay(0, "The Foward Speed Has Reached The Slowest Speed of 10 Meters/s");
97 }
98 if(speedback >=60)
99 {
100 speedback = -59;
101 llSay(0, "The Reverse Speed Has Reached The Fastest Speed of -60 Meters/s");
102 }
103 if(speedfoward >=60)
104 {
105 speedfoward = 59;
106 llSay(0, "The Foward Speed Has Reached The Fastest Speed of 60 Meters/s");
107 }
108 if(handleleft <=1)
109 {
110 handleleft = 1;
111 handleright = 1;
112 llSay(0, "The Handling Has Reached The Loosest Turn at 1 Out Of 12");
113 }
114 if(handleleft >=12)
115 {
116 handleleft = 12;
117 handleright = 12;
118 llSay(0, "The Handling Has Reached The Tightest Turn at 12 Out Of 12");
119 }
120 if(message == "handling +" && id == llGetOwner()){
121 handleleft = handleleft + 1;
122 handleright =handleright + 1 ;
123 preset = "Manual";
124
125 llSay(0, "The Handling on the cycle is now " +(string)handleleft +" Out Of 12.");
126 }
127 if(message == "handling -" && id == llGetOwner()){
128 handleleft = handleleft - 1;
129 handleright =handleright - 1 ;
130 preset = "Manual";
131
132 llSay(0, "The Handling on the cycle is now " +(string)handleleft +" Out Of 12.");
133 }
134 if(message == "handling" && id == llGetOwner()){
135
136
137 llSay(0, "The Handling on the cycle is now " +(string)handleleft +" Out Of 12.");
138 }
139 if(message == "stats" && id == llGetOwner()){
140
141 llSay(0, "Speed: Foward = " +(string)speedfoward +" Meters/s. Reverse = " +(string) speedback +" Meters/s");
142 llSay(0, "Handling: " +(string)handleleft +" Out Of 12");
143 llSay(0, "Gravity: " +(string)attract +" Out Of 1, Where 1 = Heavy and 0 = Light");
144
145 llSay(0, "Current Preset: " +preset);
146 }
147 if(preset != "Flat Land" && preset != "Hills" && preset !="Mountains" && preset != "Trick"){
148 preset = "Manual";
149 }
150
151
152 if(message == "preset flat land" && id == llGetOwner()){
153 speedfoward = 50;
154 speedback = -45;
155 handleleft = 4;
156 handleright = 4;
157 attract = .75;
158 preset = "Flat Land";
159
160
161 llSay(0, "Adjusting For Flat Terrian...");
162 llSleep(3);
163 llSay(0, "Ole' Betsy Now Adjusted To Flat Land!");
164 }
165 if(message == "preset hills" && id == llGetOwner()){
166 speedfoward = 30;
167 speedback = -25;
168 handleleft = 3;
169 handleright = 3;
170 attract = .9;
171 preset = "Hills";
172
173 llSay(0, "Adjusting For Hilly Terrian...");
174 llSleep(3);
175 llSay(0, "Ole' Betsy Now Adjusted To Hilly Land!");
176 }
177 if(message == "preset mountains" && id == llGetOwner()){
178 speedfoward = 25;
179 speedback = -15;
180 handleleft = 2;
181 handleright = 2;
182 attract = .4;
183
184
185
186 llSay(0, "Adjusting For Rough Terrian...");
187 llSleep(3);
188 llSay(0, "Ole Betsy Now Adjusted To Bumpy Land!");
189 }
190 if(message == "preset trick" && id == llGetOwner()){
191 speedfoward = 59;
192 speedback = -25;
193 handleleft = 7;
194 handleright = 7;
195 attract = .5;
196 preset = "Trick";
197
198
199 llSay(0, "Adjusting For Stunts & Tricks...");
200 llSleep(3);
201 llSay(0, "Ole' Betsy Now Adjusted To Stunts & Tricks!");
202 }
203
204 if(attract <0)
205 {
206 attract =0;
207 llSay(0, "The Cars Gravity Has Reached The Lightest Weight it Can of 0!");
208 }
209 if(attract >1)
210 {
211 attract =1;
212 llSay(0, "The Cars Gravity Has Reached The Heviest Weight it Can of 1!");
213 }
214 if(message == "gravity -" && id == llGetOwner())
215 {
216 attract =attract -.1;
217 llSay(0, "The Cars Gravity is Now Set To " +(string)attract +" Out of 1 Where 1 Was the Heaviest.");
218 }
219 if(message == "gravity +" && id == llGetOwner())
220 {
221 attract =attract -.1;
222 llSay(0, "The Cars Gravity is Now Set To " +(string)attract +" Out of 1 Where 1 Was the Heaviest.");
223 }
224
225
226 }touch(integer detected)
227 {
229 {
230 llWhisper(0, "Hello, " +llKey2Name(llDetectedKey(0)) +", Right click me and choose 'Drive' from the pie menu to Ride.");
231 }
232 else
233 {
234 llWhisper(0, "Hello, " +llKey2Name(llDetectedKey(0)) +", wanna buy this hot ride? Visit Busy Ben's In Oak Grove To Buy Your Own!!");
235 llGiveInventory(llDetectedKey(0),"Busy Ben's Vehicle Lot");
236 }
237
238 }
239
240
241
242 changed(integer change)
243 {
244
245 if(change & CHANGED_LINK)
246 {
247
248 key agent = llAvatarOnSitTarget();
249
250
251 if(agent)
252 {
253
254 if(agent != llGetOwner())
255 {
256 llSay(0, "Burgular Alarm activated ....BEEEEEEP!!!!");
257 llLoopSound("tricyclealarm", 1.0);
258 llUnSit(agent);
259
260 llSleep(15);
262
263
264
265
266 }
267
268 else
269 {
270
272
274
275 llPlaySound("SUZ_start (2).wav", 0.7);
276
277 llMessageLinked(LINK_SET, 0, "get_on", "");
278 }
279 }
280
281 else
282 {
283
286 llPlaySound("arm",1.0);
287
288 llSay(23,"idle");
289 }
290 }
291
292 }
293
294
296 {
297 if(perm)
298 {
299
301 }
302 }
303
304
305 control(key id, integer level, integer edge)
306 {
307
308 vector angular_motor;
309
310 if(level & CONTROL_FWD)
311 {
312 llSay(23,"drive");
313
315
316 }
317 if(level & CONTROL_BACK)
318 {
320 }
322 {
323
324 angular_motor.x += handleright;
325 angular_motor.z -= handleright;
326 }
328 {
329 angular_motor.x -= handleleft;
330 angular_motor.z += handleleft;
331 }
332 if(level & (CONTROL_UP))
333 {
334 angular_motor.y -= 50;
335 }
336
337 if((edge & CONTROL_FWD) && (level & CONTROL_FWD))
338 {
339
340 llMessageLinked(LINK_SET, 0, "burst", "");
341 }
342 if((edge & CONTROL_FWD) && !(level & CONTROL_FWD))
343 {
344 llMessageLinked(LINK_SET, 0, "stop", "");
345 }
346
347
349 }
350
351 }
352 // END //

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