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
Vehicle A_working_CrossGrid_Non_Physical_Vehicle  

A_working_CrossGrid_Non_Physical_Vehicle

Multi-Grid non physical vehicle. Jerky, but it works

Category: Vehicle
By : Michael R. Horton
Created: 2013-07-31 Edited: 2013-07-31
Worlds: Second Life

the Zip file

Download all files for A_working_CrossGrid_Non_Physical_Vehicle
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. A_working_CrossGrid_Non_Physical_V_1.lsl
1
2 // Yes, a WORKING Cross-Grid (X-Grids) Non Physical Vehicle Script.
3 //
4 // I have personally tested this script to work in
5 // Second Life, InWorldz, & OpenSim. It works great
6 // in all grids that I have tested so far, and can
7 // be used as a flying/levitating vehicle of sorts.
8 //
9 // Pro Tips: Non physical vehicles are not as CPU intensive
10 // as physical vehicles for the sim, and they can
11 // help protect you from being pushed across the
12 // sim from giant bullets, sim cleaners, and chaos.
13 // Setting the object to phantom further reduces
14 // CPU load on the sim because the physics engine
15 // is no longer used for collision detection with
16 // the phantom object. Micro optimizations include
17 // renaming all child links in a linkset to ".",
18 // keeping all object, script, and animation names
19 // under 16 characters, and setting all object
20 // textures to the factory "Blank" texture for
21 // very small sim and viewer load reductions.
22 //
23 // Copyright 2013 Michael R. Horton
24 //
25 // Real Life ............. Michael R. Horton
26 // Second Life ........... Mick Scarbridge
27 // InWorldZ .............. Mick Daftwood
28 //
29 // This program is free software; you can redistribute it and/or modify
30 // it under the terms of the GNU General Public License as published by
31 // the Free Software Foundation; Version 32 of the License.
32 //
33 // This program is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 // GNU General Public License for more details.
37 //
38 // You should have received a copy of the GNU General Public License
39 // along with this program; if not, write to the Free Software
40 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
41 // MA 02110-1301, USA.
42 //
43 // This header must remain in tact for your application of this script.
44 // Any modifications that you do should be recorded below with each new
45 // version, including your name or avatar name, etc for proper credit to
46 // your modifications.
47 //
48 // Upgrades
49 //
50 // v0.4.6 Features:
51 //
52 // * llSetRegionPos() used for higher efficiency than llSetPos().
53 // * Tested to work across all grids as of 2013.05.15
54 //
55 // v0.4.8 Features:
56 //
57 // * Tested to self-delete when user stands for AutoCleanup.
58 // * Tested to self-delete when user accidentally sits on another object.
59 // * Tested to self-delete when user crashes or teleports.
60 //
61 // v0.5.0 Features:
62 //
63 // * Final code cleanup.
64 // * Inserted GPL licensing information.
65 // * Adjusted formatting for better readability.
66 // * Final testing for directional speeds.
67 //
68 // Instructions:
69 //
70 // * Build a one prim object, such as a box or sphere.
71 // * Set the rotation to <0,0,0> and set texture to "Blank".
72 // * Drop in an animation you like, then rename the animation to "dz" inside the object.
73 // * Create a new script in the object then paste this into it.
74 // * Set the default action to "Sit" for the object.
75 // * Set to compile in MONO instead of LSO/LSL for greater efficiency.
76 // * Rename the object you created to something you will remember, such as "npv.xgrids".
77 // * Take the object into inventory before sitting or it will self-delete when you stand.
78 // * Rez the object in-world and left click to sit.
79 // * Enjoy!
80
81 integer r=FALSE;
82 key s;
83 key t;
84 key p=NULL_KEY;
85 string a="";
86 integer b=FALSE;
87 c(key d,string n)
88 {
89 p=d;
90 a=n;
92 }
93
94 q(){
95 if(b)
96 {
97 p=NULL_KEY;
98 b=FALSE;
100 }
101 }
102
103 f(vector g)
104 {
105 llSetRot(llEuler2Rot(llRot2Euler(llGetRot())+g*DEG_TO_RAD));
106 }
107
108 default
109 {
111 {
113 llSetSitText("^,..,^");// Better than boring "Sit Here".
114 llSetStatus(STATUS_PHANTOM,TRUE);// Reduces CPU load on the sim server.
115 llVolumeDetect(FALSE);// Set to TRUE if you desire collision detection.
116 t=llGetOwner();
117 }
118
120 {
121 llSitTarget(<0.0,0.0,1.0>,<0.0,0.0,0.0,1.0>);// Haxx - seems to allow sit even if rezzed inside a megaprim sensor type.
122 // llSitTarget(ZERO_VECTOR,ZERO_ROTATION);// Alternative that may work better than the previous line in YOUR sim grid.
123 llSetCameraEyeOffset(<-5.0,0.0,2.0>);// I nuu wanna be staring at every hair follicle in the back o my head.
124 llSetCameraAtOffset(<0.0,0.0,2.0>);
125 // llCollisionSound("",0.0);// If non phantom, why sound like beating them when bumping them?
126 }
127
128 touch(integer j)
129 {
131 {
133 }
134 }
135
137 {
140 {
141 if((s==p)&&(r))
142 {
143 llStopAnimation("sit_ground");
145 r=FALSE;
146 llSleep(0.1);
147 llDie();
148 }
149
150 else if(!r)
151 {
153 r=TRUE;
156 }
157 }
158 }
159
161 {
162 if(l&CONTROL_FWD){llSetRegionPos(llGetPos()+(<4.0,0,0>)*llGetRot());}
163 if(l&CONTROL_BACK){llSetRegionPos(llGetPos()+(<-4.0,0,0>)*llGetRot());}
164 if(l&CONTROL_LEFT||l&CONTROL_ROT_LEFT){f(<0,0,25.0>);}
165 if(l&CONTROL_RIGHT||l&CONTROL_ROT_RIGHT){f(<0,0,-25.0>);}
166 if(l&CONTROL_UP){llSetRegionPos(llGetPos()+(<0,0,4.0>)*llGetRot());}
167 if(l&CONTROL_DOWN){llSetRegionPos(llGetPos()+(<0,0,-4.0>)*llGetRot());}
168 }
169
171 {
173 {
177 b=TRUE;
178 }
179
181 {
182 llStartAnimation("dz");
183 llStopAnimation("sit");
184 }
185
186 else
187 {
188 q();
189 }
190 }
191 }
192 ///////////////////////////////////////// Code end.
193 // EOF

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