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
Wedding Wedding Walk  

Wedding Walk

A walker for two people at a wedding

Category: Wedding
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
Worlds: Second Life

the Zip file

Download all files for Wedding Walk
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Script.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2
3
4 ////////////////////////////////////////////
5 // Wedding walk Script
6 //
7 ////////////////////////////////////////////
8 float forward_power = 1; //Power used to go forward (1 to 30)
9 float reverse_power = -1; //Power used to go reverse (-1 to -30)
10 float turning_ratio = .1; //How sharply the vehicle turns. Less is more sharply. (.1 to 10)
11 /////////////// CONSTANTS ///////////////////
12 string FWD_DIRECTION = "x";
13 vector POSITION_OFFSET = <0.0, 0.0, 0.0>; // Local coords
14 float SCAN_REFRESH =.2;
15
16 ///////////// END CONSTANTS /////////////////
17
18 ///////////// GLOBAL VARIABLES ///////////////
19 key gOwner;
20 rotation gFwdRot;
21 float last_dist = 9999; // store the last distance to the sensor
22 /////////// END GLOBAL VARIABLES /////////////
23
24 turn(string direction)
25 {
26
27 //llSetText("Turning " + direction, <2,2,2>, 5);
28 //llSleep(1);
29 vector angular_motor;
30 integer reverse=1;
31 //get current speed
32 vector vel = llGetVel();
33 float speed = llVecMag(vel);
34
35 //car controls
36 if(direction == "Forward")
37 {
39 reverse=1;
40 }
41 if(direction == "Back")
42 {
44 reverse = -1;
45 }
46
47 if(direction == "Right")
48 {
49 angular_motor.z -= speed / turning_ratio * reverse;
50 }
51
52 if(direction == "Left")
53 {
54 angular_motor.z += speed / turning_ratio * reverse;
55 }
56
58
59 } //end control
60
61 help()
62 {
63 llWhisper(0,"You can say the following commands:");
64 llWhisper(0,"/start <-- I will walk down the path");
65 llWhisper(0,"/stop <-- I will stay where I am.");
66 llWhisper(0,"/help <-- I will repeat this message.");
67 }
68
69 StartScanning()
70 {
71
73 llTriggerSound("whistle2",1);
74
75 llSensorRepeat("End", "",PASSIVE, 50, PI, SCAN_REFRESH);
76 // llSensorRepeat("RRail-B Right Gravel", "",PASSIVE, 10, PI/2, SCAN_REFRESH);
77 llSetText("Starting", <2,2,2>, 5);
78 }
79
80 StopScanning()
81 {
85 llSetText("Stopped", <2,2,2>, 5);
86 llTargetOmega(<0,0,0>,PI,0); //keep it from wobbling
87 }
88
89
90 rotation GetFwdRot()
91 {
92 // Special case... 180 degrees gives a math error
93 if(FWD_DIRECTION == "-x")
94 {
95 return llAxisAngle2Rot(<0, 0, 1>, PI);
96 }
97
98 string Direction = llGetSubString(FWD_DIRECTION, 0, 0);
99 string Axis = llToLower(llGetSubString(FWD_DIRECTION, 1, 1));
100
101 vector Fwd;
102 if(Axis == "x")
103 Fwd = <1, 0, 0>;
104 else if(Axis == "y")
105 Fwd = <0, 1, 0>;
106 else
107 Fwd = <0, 0, 1>;
108
109 if(Direction == "-")
110 Fwd *= -1;
111
112 return llRotBetween(Fwd, <1, 0, 0>);
113 }
114
115 rotation GetRotation(rotation rot)
116 {
117 vector Fwd;
118 Fwd = llRot2Fwd(rot);
119
120 float Angle = llAtan2( Fwd.y, Fwd.x );
121 return gFwdRot * llAxisAngle2Rot(<0, 0, 1>, Angle);
122 }
123
124
125 default
126 {
127
129 {
130 llSetStatus(STATUS_PHANTOM, TRUE);
131 gOwner = llGetOwner();
132 // gFwdRot = GetFwdRot();
133
139 llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
142 llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.5);
148
149 llSetText("Ready", <2,2,2>, 5);
150
151 llListen(0, "", "", "");
152 }
153
154
155
156
157 touch_start(integer total_number)
158 {
159 llSetText("Touched", <2,2,2>, 5);
160 last_dist = 9999;
161 StartScanning();
162 }
163
164 listen(integer channel, string name, key id, string mesg)
165 {
166 mesg = llToLower(mesg);
167 if((id == gOwner) && ( mesg == "/start" ))
168 {
169 StartScanning();
170 }
171 else if((id == gOwner) && (mesg == "/stop" ))
172 {
173 StopScanning();
174 }
175
176 else if((id == gOwner) && (mesg == "/help"))
177 {
178 help();
179 }
180 }
181
182
183
184 on_rez(integer start_param)
185 {
187 }
188
189
190
191 sensor(integer num_detected)
192 {
193
194 vector Pos = llDetectedPos(0);
195 vector Myself = llGetPos();
196 float dist = llVecDist(Myself, Pos);
197
198 //llOwnerSay("The distance between " + (string) Myself +
199 // " and " + (string) Pos + " is: "+(string) dist + " last time was " + (string) last_dist);
200
201
203
204
205
206 if(dist > last_dist)
207 {
208 //llOwnerSay("Made it");
209 StopScanning();
210 }
211 else
212 {
213 //llOwnerSay("Closer");
214 last_dist = dist;
215 }
216 //llSleep(1);
217
218 }
219
220
221 }

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