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 Multimove__allow_large_builds_to_ac  

Multimove__allow_large_builds_to_ac

Multimove controller

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Multimove__allow_large_builds_to_ac
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Multimove__allow_large_builds_to_ac_1.lsl
Get file # 2. Multimove__allow_large_builds_to_ac_10.lsl
Get file # 3. Multimove__allow_large_builds_to_ac_2.lsl
Get file # 4. Multimove__allow_large_builds_to_ac_3.lsl
Get file # 5. Multimove__allow_large_builds_to_ac_4.lsl
Get file # 6. Multimove__allow_large_builds_to_ac_5.lsl
Get file # 7. Multimove__allow_large_builds_to_ac_6.lsl
Get file # 8. Multimove__allow_large_builds_to_ac_7.lsl
Get file # 9. Multimove__allow_large_builds_to_ac_8.lsl
Get file # 10. Multimove__allow_large_builds_to_ac_9.lsl
1 // MultiMove Controller Script
2 //
3 // Manages pilot seat, remote control and movement for the whole set
4
5 integer offchan = -9; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer controlstaken; // control keys taken by the script, initialised later
11
12 integer listener;
13 integer maxl = 8;
14 float rate = 0.05; // interval between updates
15
16 integer my_chan = 129; // channel for remote commands
17 integer handle;
18
19 vector sitoffset = <0.25,0,-0.25>; // sitting position
20 rotation sitrot = ZERO_ROTATION; // sitting rotation
21 vector camoffset = ZERO_VECTOR; // camera position (static)
22 vector camtarget = ZERO_VECTOR; // camera direction (static)
23
24 float speed = 2.0; // distance to move within rate
25 float vspeed = 1.0; // vertical distance to move within rate
26 float lspeed = 1.0; // lateral distance to move within rate
27 float rspeed = 0.062831853; // angle in radians to rotate left or right within rate
28 float inertia = 0.8;
29 float moment = 0.5;
30 vector accel = <0.0625, 0.0625, 0.03125>; // acceleration rates fwd, strafe and vert
31 float raccel = 0.03125; // turning acceleration rate
32 float banking = -0.5; // how much the vehicle banks in turns with forward speed
33 float tilting = 0.125; // how much the vehicle tilts fore and aft with forward accel
34
35 vector velocity;
36 float rotacity;
37 float azimut;
38
39 integer pressed;
40
41 rotation rtarget;
42
43 list cam = [CAMERA_ACTIVE, TRUE, CAMERA_BEHINDNESS_ANGLE, 180.0, CAMERA_BEHINDNESS_LAG, 0.5, CAMERA_POSITION_LAG, 1.0, CAMERA_FOCUS_LAG, 0.5, CAMERA_POSITION_LOCKED, TRUE];
44
45 // camera positions
46 vector neutral = <-32, 0, 8>;
47 vector back = <27, -5, 5>;
48 vector down = <-16, 0, 48>;
49 vector up = <-32, 0, -12>;
50 vector out = <0, 48, 8>;
51
52 float cam_vel = 0.5; // velocity at which camera will switch, so that you can maneuver at slow speed from angles
53
54 default
55 {
57 {
58 llSleep(1.6);
60 }
61
63 {
64 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
65 llSetTimerEvent(0.0);
66 velocity = ZERO_VECTOR;
67 rotacity = 0.0;
69 temp.z = 0.0;
70 llVecNorm(temp);
71 azimut = llAcos(temp.x);
72 if(llAsin(temp.y) < 0.0)
73 azimut = -azimut;
74 llMinEventDelay(0.05);
75 llSitTarget(sitoffset, sitrot);
76 llSetCameraAtOffset(camtarget);
77 llSetCameraEyeOffset(camoffset);
78 for (listener = 0; listener < maxl; listener = listener + 1)
79 llShout(unichan + listener, (string)(llGetRootPosition() + llGetRegionCorner()) + "*" + (string)rtarget);
80 handle = llListen(my_chan, "", "", "");
82 }
83
85 {
86 if(c & CHANGED_LINK)
87 {
89 if(id != NULL_KEY)
90 {
91 if(id == llGetOwner())
92 {
94 } else llUnSit(id);
95 } else {
97 llSetTimerEvent(0.0);
98 }
99 }
100 }
101
103 {
105 {
106 integer n;
107 rtarget = llGetRootRotation();
108 velocity = ZERO_VECTOR;
109 rotacity = 0.0;
111 temp.z = 0.0;
112 llVecNorm(temp);
113 azimut = llAcos(temp.x);
114 if(llAsin(temp.y) < 0.0)
115 azimut = -azimut;
116 for (n=0; n<maxl; ++n)
117 llShout(unichan + n, (string)(llGetRootPosition() + llGetRegionCorner()) + "*" + (string)rtarget);
118
119 llSleep(1.0);
120 llTakeControls(controlstaken, TRUE, FALSE);
121 llSetTimerEvent(rate);
123 } else {
125 }
126 }
127
128 listen(integer chan, string name, key id, string msg)
129 {
130 if((llGetOwner() != id) && (llGetOwnerKey(id) != llGetOwner())) return;
131 string t = llGetSubString(msg, 0, 0);
132 if(t == "k") { llSetTimerEvent(0.0); llShout(unichan, "k"); } else if(t == "s")
133 {
134 integer i;
135 for (i=0; i<maxl ; ++i)
136 llShout(unichan + i, "s");
137 llSetTimerEvent(0.0);
138 return;
139 }
140 integer val = (integer)llDeleteSubString(msg, 0, 0);
141 llSetTimerEvent(rate);
142 if(t == "m") {
143 if(val > 0) pressed = pressed | CONTROL_FWD;
144 else if(val < 0) pressed = pressed | CONTROL_BACK;
145 else pressed = pressed & ~(CONTROL_FWD | CONTROL_BACK);
146 } else if(t == "v") {
147 if(val > 0) pressed = pressed | CONTROL_UP;
148 else if(val < 0) pressed = pressed | CONTROL_DOWN;
149 else pressed = pressed & ~(CONTROL_UP | CONTROL_DOWN);
150 } else if(t == "l") {
151 if(val > 0) pressed = pressed | CONTROL_LEFT;
152 else if(val < 0) pressed = pressed | CONTROL_RIGHT;
153 else pressed = pressed & ~(CONTROL_LEFT | CONTROL_RIGHT);
154 } else if(t == "r") {
155 if(val > 0) pressed = pressed | CONTROL_ROT_LEFT;
156 else if(val < 0) pressed = pressed | CONTROL_ROT_RIGHT;
157 else pressed = pressed & ~(CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT);
158 }
159 }
160
161 control(key id, integer level, integer edge)
162 {
163 pressed = level;
164 }
165
166 timer()
167 {
170
171 listener = (listener + 1) % maxl;
172 integer cam_set = FALSE;
173
174 float oldvel = velocity.x;
175 float bank = 0.0;
176 float tilt = 0.0;
177
178 if(pressed & CONTROL_FWD)
179 {
180 velocity.x += accel.x;
181 if(velocity.x > speed) velocity.x = speed;
182
183 if(velocity.x > cam_vel)
184 {
186 cam_set = TRUE;
187 }
188 } else if(pressed & CONTROL_BACK)
189 {
190 velocity.x -= accel.x;
191 if(velocity.x < -speed) velocity.x = -speed;
192
193 if(velocity.x < -cam_vel)
194 {
196 cam_set = TRUE;
197 }
198 } else velocity.x *= inertia;
199
200 if(pressed & CONTROL_UP)
201 {
202 velocity.z += accel.z;
203 if(velocity.z > vspeed) velocity.z = vspeed;
204
205 if((cam_set == FALSE) && (velocity.z > cam_vel))
206 {
208 cam_set = TRUE;
209 }
210 } else if(pressed & CONTROL_DOWN)
211 {
212 velocity.z -= accel.z;
213 if(velocity.z < -vspeed) velocity.z = -vspeed;
214
215 if((cam_set == FALSE) && (velocity.z < -cam_vel))
216 {
218 cam_set = TRUE;
219 }
220 } else velocity.z *= inertia;
221
222 if(pressed & CONTROL_LEFT)
223 {
224 velocity.y += accel.y;
225 if(velocity.y > lspeed) velocity.y = lspeed;
226
227 if((cam_set == FALSE) && (velocity.y > cam_vel))
229 } else if(pressed & CONTROL_RIGHT)
230 {
231 velocity.y -= accel.y;
232 if(velocity.y < -lspeed) velocity.y = -lspeed;
233
234 if((cam_set == FALSE) && (velocity.y < -cam_vel))
236 } else velocity.y *= inertia;
237
238 if(pressed & CONTROL_ROT_LEFT)
239 {
240 rotacity += raccel;
241 if(rotacity > rspeed) rotacity = rspeed;
242 } else if(pressed & CONTROL_ROT_RIGHT)
243 {
244 rotacity -= raccel;
245 if(rotacity < -rspeed) rotacity = -rspeed;
246 } else rotacity *= moment;
247
248 if(llFabs(rotacity) > 0.005)
249 {
250 azimut += rotacity;
251 bank = rotacity * banking * velocity.x;
252 tilt = tilting * (velocity.x - oldvel);
253 orig = llEuler2Rot(<bank, tilt, 0.0>) * llEuler2Rot(<0,0,azimut>);
254 llShout(unichan + listener, (string)(pos + velocity * orig) + "*" + (string)orig);
255 } else if(llVecMag(velocity) > 0.01)
256 {
257 tilt = tilting * (velocity.x - oldvel);
258 orig = llEuler2Rot(<0.0, tilt, 0.0>) * llEuler2Rot(<0,0,azimut>);
259 llShout(unichan + listener, (string)(pos + velocity * orig) + "*" + (string)orig);
260 }
261 }
262 }

Multimove__allow_large_builds_to_ac

move0 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move1 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move2 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move3 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move4 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move5 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move6

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

move7 script

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // Move
2 //
3 // Multimove follower
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer handle; // handle for the listen function
11
12 vector my_offset; // original offset, set at first activation
13 rotation my_orientation; // original rotation, set at first activation
14 integer my_num; // position in the chain of redundancy
15 float azimut;
16
17 vector old_offset;
18 rotation old_orientation;
19
20 default
21 {
23 {
24 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
25 llListenRemove(handle);
26 handle = llListen(unichan + my_num, "", "", "");
27 }
28
30 {
31 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
32 my_num = (integer)llGetSubString(llGetScriptName(), -1, -1);
33 handle = llListen(unichan + my_num, "", "", "");
34 }
35
36 listen(integer chan, string name, key id, string mesg)
37 {
38 if(mesg == "k") llDie();
39 else if(mesg == "s") return;
40
41 integer index = llSubStringIndex(mesg, "*");
42
43 my_offset = llGetPos() + llGetRegionCorner() - (vector)llGetSubString(mesg, 0, index - 1);
44 my_orientation = llGetRot() / (rotation)(llDeleteSubString(mesg, 0, index));
45 my_offset = my_offset / llGetRot();
46 state running;
47 }
48
50 {
51 llListenRemove(handle);
52 }
53 }
54
55 state running
56 {
58 {
59 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
60 llListenRemove(handle);
61 handle = llListen(unichan + my_num, "", "", "");
62 }
63
65 {
66 handle = llListen(unichan + my_num, "", "", "");
67 }
68
69 listen(integer chan, string name, key id, string mesg)
70 {
71 if(mesg == "k")
72 {
73 llDie();
74 } else if(mesg == "s")
75 {
76 state default;
77 } else {
78 integer index = llSubStringIndex(mesg, "*");
79 rotation rtarget = my_orientation * (rotation)llDeleteSubString(mesg, 0, index);
80 vector target = my_offset * rtarget + (vector)llGetSubString(mesg, 0, index - 1) - llGetRegionCorner();
82 }
83 }
84
85 link_message(integer source, integer code, string s, key id)
86 {
87 if(s == "detach")
88 {
89 if(my_offset == ZERO_VECTOR) return;
90
91 llListenRemove(handle);
92 old_orientation = my_orientation;
93 my_orientation = ZERO_ROTATION;
94 old_offset = my_offset;
95 my_offset = ZERO_VECTOR;
96 handle = llListen(code + my_num, "", "", "");
97 } else if(s == "attach")
98 {
99 if(old_offset == ZERO_VECTOR) return;
100 llListenRemove(handle);
101 my_orientation = old_orientation;
102 my_offset = old_offset;
103 handle = llListen(unichan + my_num, "", "", "");
104 }
105 }
106
108 {
109 llListenRemove(handle);
110 }
111 }

Multimove__allow_large_builds_to_ac

controller

Category: Vehicle
By : Amanda Vanness
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 // MultiMove Shuttle Controller Script
2 //
3 // Manages pilot seat, remote control and movement for a specific detachable object of a multimove set
4
5 integer offchan = -100; // this is the unique identifier for this type of vehicle
6 integer unichan; // the channel used by the controller and objects to
7 // sync and move, will be composed of this and part
8 // of your UUID
9
10 integer shuttlechan; // set randomly
11
12 integer controlstaken; // control keys taken by the script, initialised later
13
14 integer listener;
15 integer maxl = 8;
16 float rate = 0.05; // interval between updates
17
18 vector sitoffset = <0.25,0,0.35>; // sitting position
19 rotation sitrot = ZERO_ROTATION; // sitting rotation
20 vector camoffset = ZERO_VECTOR; // camera position (static)
21 vector camtarget = ZERO_VECTOR; // camera direction (static)
22
23 float speed = 2.0; // distance to move within rate
24 float vspeed = 1.0; // vertical distance to move within rate
25 float lspeed = 1.0; // lateral distance to move within rate
26 float rspeed = 0.062831853; // angle in radians to rotate left or right within rate
27 float inertia = 0.8;
28 float moment = 0.5;
29 vector accel = <0.0625, 0.0625, 0.03125>; // acceleration rates fwd, strafe and vert
30 float raccel = 0.03125; // turning acceleration rate
31 float banking = -0.5; // how much the vehicle banks in turns with forward speed
32 float tilting = 0.125; // how much the vehicle tilts fore and aft with forward accel
33
34 vector velocity;
35 float rotacity;
36 float azimut;
37
38 integer pressed;
39
40 rotation rtarget;
41
42 list cam = [CAMERA_ACTIVE, TRUE, CAMERA_BEHINDNESS_ANGLE, 180.0, CAMERA_BEHINDNESS_LAG, 0.5, CAMERA_POSITION_LAG, 1.0, CAMERA_FOCUS_LAG, 0.5, CAMERA_POSITION_LOCKED, TRUE];
43
44 // camera positions
45 vector neutral = <-9, 0, 2>;
46 vector back = <6, -3, 1>;
47 vector down = <-7, 0, 8>;
48 vector up = <-9, 0, -2>;
49 vector out = <0, 9, 3>;
50
51 float cam_vel = 0.25; // velocity at which camera will switch, so that you can maneuver at slow speed from angles
52
53 default
54 {
56 {
57 llSleep(1.6);
59 }
60
62 {
63 unichan = offchan - (integer)("0x" + llGetSubString((string)llGetOwner(), 0, 6));
64 llSetTimerEvent(0.0);
65 velocity = ZERO_VECTOR;
66 rotacity = 0.0;
68 temp.z = 0.0;
69 llVecNorm(temp);
70 azimut = llAcos(temp.x);
71 if(llAsin(temp.y) < 0.0)
72 azimut = -azimut;
73 llMinEventDelay(0.05);
74 llSitTarget(sitoffset, sitrot);
75 llSetCameraAtOffset(camtarget);
76 llSetCameraEyeOffset(camoffset);
78 do { shuttlechan = (integer)llFrand(500000000) + 11; } while(llAbs(shuttlechan - unichan) < 10);
79 }
80
82 {
83 if(c & CHANGED_LINK)
84 {
86 if(id != NULL_KEY)
87 {
88 if(id == llGetOwner())
89 {
91 } else llUnSit(id);
92 } else {
94 llSetTimerEvent(0.0);
95 llMessageLinked(LINK_ROOT, 0, "attach", "");
96 }
97 }
98 }
99
101 {
103 {
104 integer n;
105 llMessageLinked(LINK_ROOT, shuttlechan, "detach", "");
106 rtarget = llGetRootRotation();
107 velocity = ZERO_VECTOR;
108 rotacity = 0.0;
110 temp.z = 0.0;
111 llVecNorm(temp);
112 azimut = llAcos(temp.x);
113 if(llAsin(temp.y) < 0.0)
114 azimut = -azimut;
115
116 llSleep(1.0);
117 llTakeControls(controlstaken, TRUE, FALSE);
118 llSetTimerEvent(rate);
120 for (n=0; n<maxl; ++n)
121 llShout(shuttlechan + n, (string)(llGetRootPosition() + llGetRegionCorner()) + "*" + (string)rtarget);
122 } else {
124 }
125 }
126
127 control(key id, integer level, integer edge)
128 {
129 pressed = level;
130 }
131
132 timer()
133 {
136
137 listener = (listener + 1) % maxl;
138 integer cam_set = FALSE;
139
140 float oldvel = velocity.x;
141 float bank = 0.0;
142 float tilt = 0.0;
143
144 if(pressed & CONTROL_FWD)
145 {
146 velocity.x += accel.x;
147 if(velocity.x > speed) velocity.x = speed;
148
149 if(velocity.x > cam_vel)
150 {
152 cam_set = TRUE;
153 }
154 } else if(pressed & CONTROL_BACK)
155 {
156 velocity.x -= accel.x;
157 if(velocity.x < -speed) velocity.x = -speed;
158
159 if(velocity.x < -cam_vel)
160 {
162 cam_set = TRUE;
163 }
164 } else velocity.x *= inertia;
165
166 if(pressed & CONTROL_UP)
167 {
168 velocity.z += accel.z;
169 if(velocity.z > vspeed) velocity.z = vspeed;
170
171 if((cam_set == FALSE) && (velocity.z > cam_vel))
172 {
174 cam_set = TRUE;
175 }
176 } else if(pressed & CONTROL_DOWN)
177 {
178 velocity.z -= accel.z;
179 if(velocity.z < -vspeed) velocity.z = -vspeed;
180
181 if((cam_set == FALSE) && (velocity.z < -cam_vel))
182 {
184 cam_set = TRUE;
185 }
186 } else velocity.z *= inertia;
187
188 if(pressed & CONTROL_LEFT)
189 {
190 velocity.y += accel.y;
191 if(velocity.y > lspeed) velocity.y = lspeed;
192
193 if((cam_set == FALSE) && (velocity.y > cam_vel))
195 } else if(pressed & CONTROL_RIGHT)
196 {
197 velocity.y -= accel.y;
198 if(velocity.y < -lspeed) velocity.y = -lspeed;
199
200 if((cam_set == FALSE) && (velocity.y < -cam_vel))
202 } else velocity.y *= inertia;
203
204 if(pressed & CONTROL_ROT_LEFT)
205 {
206 rotacity += raccel;
207 if(rotacity > rspeed) rotacity = rspeed;
208 } else if(pressed & CONTROL_ROT_RIGHT)
209 {
210 rotacity -= raccel;
211 if(rotacity < -rspeed) rotacity = -rspeed;
212 } else rotacity *= moment;
213
214 if(llFabs(rotacity) > 0.005)
215 {
216 azimut += rotacity;
217 bank = rotacity * banking * velocity.x;
218 tilt = tilting * (velocity.x - oldvel);
219 orig = llEuler2Rot(<bank, tilt, 0.0>) * llEuler2Rot(<0,0,azimut>);
220 llShout(shuttlechan + listener, (string)(pos + velocity * orig) + "*" + (string)orig);
221 } else if(llVecMag(velocity) > 0.01)
222 {
223 tilt = tilting * (velocity.x - oldvel);
224 orig = llEuler2Rot(<0.0, tilt, 0.0>) * llEuler2Rot(<0,0,azimut>);
225 llShout(shuttlechan + listener, (string)(pos + velocity * orig) + "*" + (string)orig);
226 }
227 }
228 }

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