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
Telepad Endless Loop Mover  

Endless Loop Mover

Sit on this prim, it will move you to a destination and unseat you, optionally repeat forever.

Category: Telepad
By : Ferd Frederix
Created: 2015-08-05 Edited: 2017-03-11
Worlds: OpenSim

the Zip file

Download all files for Endless Loop Mover
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. 10.lsl
Get file # 2. ReadMe.txt
Get file # 3. recorder.lsl
Get file # 4. walker.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 // Open Source CC-BY-NC
2 // Please keep open source Open!
3
4
5 integer _debug = FALSE; // print in chats what i s happening.
6 float RANGE = 96; // range it looks for people - if detected, will allow it to move
7 float TINTERVAL = 10; // how often it looks - keep this large and the RANGE small
8 integer Endless = TRUE;
9 vector OFFSET = <0,0,0>; // if you want the tour to ride higher or lower or to one side...
10 integer running = FALSE;
11 float SPEED = 1.0; // speed of vehicle in meters per second
12
13 // Sit for the NPC
14 vector TARGET = <0,0,.7>;
15 vector ROT = <0, 0, 0>;
16 key av;
17
18 float INTERVAL = 0.5; // how often we check
19 float TOLERANCE = 1; // how close to get
20
21 vector startPos;
22 list lCoordinate;
23 list lRotation ;
24 list lText;
25
26 string NOTECARD = "Route"; // the notecard for configuring
27
28 integer count = 0;
29
30 vector TargetLocation;
31 rotation TargetRotation;
32
33
34 Goto(float speed)
35 {
36 if(_debug)
37 llOwnerSay("Looking at Target Location = " + (string) TargetLocation);
38
39 vector ownPosition = llGetPos();
40 float dist = llVecDist(ownPosition, TargetLocation);
41
42 float rate = dist / speed;
43
44 rotation ownRotation = llGetRot();
45
46 llSetKeyframedMotion(
47 [(TargetLocation - ownPosition) + <0.0, 0.0, -.5> * TargetRotation,
48 NormRot(TargetRotation/ownRotation), rate],
49 []);
50
51 }
52
53 rotation NormRot(rotation Q)
54 {
55 float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
56
57 return
58 <Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
59 }
60
61 integer locationLength;
62
63
64 default
65 {
66 on_rez(integer param)
67 {
69 }
71 {
72 if(_debug)
73 llOwnerSay("Reset");
74
75
76 rotation rot = llEuler2Rot(ROT * DEG_TO_RAD); // convert the degrees to radians, then convert that vector into a rotation, rot30x
77 llSitTarget(TARGET, rot); // where they sit
78
79 // read the notecard
80 string data = osGetNotecard(NOTECARD);
81 list lLine = llParseString2List(data, ["\n"], []);
82 integer i;
83 integer j = llGetListLength(lLine);
84 for (i = 0; i < j; i++)
85 {
86 string aLine = llList2String(lLine,i);
87
88 list iList = llParseString2List(aLine, ["|"], []);
89 if(_debug ) llOwnerSay("Line = " + llDumpList2String(iList,":"));
90
91 vector TempLocation = (vector) llList2Vector(iList,1);
92 if(TempLocation != ZERO_VECTOR)
93 {
94 rotation Rot = (rotation) llList2String(iList,2);
95 string text = llList2String(iList,3);
96
97 if(_debug) llOwnerSay((string)TempLocation);
98
99 TempLocation += OFFSET;
100
101 lCoordinate += [TempLocation];
102
103 lRotation += [Rot];
104 lText += [text];
105
106 locationLength = (llGetListLength(lCoordinate));
107 }
108 }
109 state paused;
110 }
111
112 }
113
114 state paused {
115
117 {
118 if(_debug) llOwnerSay("Pause");
119
120 if(!Endless) {
121
123 if(av != NULL_KEY) {
124 llStopAnimation("avatar_walk");
125 llUnSit(av);
126 }
127 }
128
129 TargetLocation = llList2Vector(lCoordinate, 0); // Look at 0th
130 TargetRotation = llList2Rot(lRotation, 0); // Look at 0th
131 startPos = TargetLocation;
132 Goto(50); // go fast
133
134 count = 0;
135
136
137 if(Endless)
138 state moving;
139 }
140
141 changed(integer change)
142 {
143 if(change & CHANGED_LINK)
144 {
146 if(_debug) llOwnerSay("Sit by " + (string) av);
147
148 if(av!= NULL_KEY)
149 {
151 }
152 }
153
154 if(change & CHANGED_REGION_START)
155 {
157 }
158 }
159
161 {
163
164 llStopAnimation("sit");
165 llStartAnimation("avatar_walk");
166 state moving;
167 }
168 }
169 }
170
171
172 state moving
173 {
175 {
176 if(_debug) llOwnerSay("State Moving entered, is pointing to target " + (string) TargetLocation );
177
178 count ++;
179
180 TargetLocation = llList2Vector(lCoordinate, count); // Look at nth
181 TargetRotation = llList2Rot(lRotation, count); // Look at nth
182 string SpeakThis = llList2String(lText, count);
183
184 if(llStringLength(SpeakThis))
185 llSay(0,SpeakThis);
186
187 Goto(SPEED);
188 llSetTimerEvent(INTERVAL);
189 llSensorRepeat("","",AGENT,RANGE,PI,TINTERVAL);
190 }
191
193 {
194 if(! running++)
195 llSetTimerEvent(INTERVAL);
196 }
197
198 no_sensor()
199 {
201 running = FALSE;
202 }
203
204 changed(integer change)
205 {
206 if(change & CHANGED_LINK)
207 {
209 if(av == NULL_KEY) //evaluated as true if not NULL_KEY or invalid
210 {
211 state paused;
212 } else {
214 }
215 }
216 if(change & CHANGED_REGION_START)
217 {
219 }
220
221
222 }
223
225 {
227
228 llStopAnimation("sit");
229 llStartAnimation("avatar_walk");
230 }
231 }
232
233
234 on_rez(integer param)
235 {
237 }
238
239 timer()
240 {
241 if(_debug) llOwnerSay("tick");
242 if(llVecMag(llGetPos() - TargetLocation) <= TOLERANCE) {
243 if(_debug) llOwnerSay("At location: " + (string) llGetPos());
244
245 count ++;
246
247 if(count >= locationLength) {
248 if(_debug) llOwnerSay("EOF");
249 state paused;
250
251 } else {
252 TargetLocation = llList2Vector(lCoordinate, count); // Look at nth
253 TargetRotation = llList2Rot(lRotation, count); // Look at nth
254
255 Goto(SPEED);
256 if(_debug) llOwnerSay("New Target: " + (string) TargetLocation);
257 }
258 }
259 }
260
262 {
264 }
265 }
266

Endless Loop Mover

Rez this from inventory to make a route. Use the recorder to gather the route.

Category: Telepad
By : Ferd Frederix
Created: 2015-08-05 Edited: 2017-03-11
Worlds: OpenSim


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 // name this prim '10' without the double quotes. You will use the prim #10 to establish a path of waypoints to follow.
3 // Rez a prim ad name it '10', or any other number without the double quotes, at a spot at the beginning of the ride.
4 // Mark the prim as 'Phantom'. The final gadget will pass through the #10 prim on its route.
5 // Put the following script in it. Take a copy of that prim back into inventory.
6 // Left-click and drag from inventory the '10' prim at a spot nearby, in the direction you want the object to travel.
7 // If you use shift-copy, move it slightly, then grab the one you r left behind!
8 // The prim you shift copy will be in reverse order, as the original #10 moves, and leaves behind a copy.
9 // You canm also just drag out a new one each time you need another waypoint.
10
11 // Each prim will rename itself to the largest number found +10, about 5 seconds after it rezzes.
12 // Since you started with prim #10, the second prim will rename itself as #20, the next will be 30, and so on.
13 // When finsihes, click the tour object
14
15
16 integer wanted = 0;
17 integer debugger = 1;
18
19 list prims;
20
21
22 debug(string message)
23 {
24 if(debugger)
25 llOwnerSay(message);
26 }
27
28 default
29 {
31 {
32 llListen(300,"","","");
33 wanted++;
34 llRegionSay(300,"number");
35 llSetTimerEvent(5.0); // 5 seconds to hear from all prims
36 llOwnerSay("Setting coordinates");
37 }
38
39 listen(integer channel,string name, key id, string message)
40 {
41 if(message == "die")
42 llDie();
43
44 else if(message =="where")
45 llRegionSay(300,llGetObjectName() + "|" + (string) llGetPos() + "|" + (string) llGetRot() + "|" + llGetObjectDesc());
46
47 else if(message =="number")
49
50 else if(wanted)
51 {
52 prims += (integer) message; // add to memory list
53 }
54
55
56 }
57
58 timer()
59 {
60 wanted = 0;
61 prims = llListSort(prims,1,0); // sort descending
62 integer num = (integer) llList2Integer(prims,0); // get highest number
63 llSetObjectName((string) (num + 10)); // leave room for more prims to be added
64 llOwnerSay("Name set to " + llGetObjectName() + ". You can add text to be spoken when the tour reaches this location by adding some text to the description of this object.");
65
67 }
68
70 {
72 }
73 }

Endless Loop Mover

Route Recorder Script - touch to make a route

Category: Telepad
By : Ferd Frederix
Created: 2015-08-05 Edited: 2017-03-11
Worlds: OpenSim


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 // Open Source CC-BY-NC
2
3 // Recorder script - put this in the touring prim, rez thre #10 prims, and then touch the tour prim to record a route
4 // the route prim will follow the route. Fix any issues by replacing, removing or adding the numbered prims, and touch to save
5 // When finished, delete this script as it is not needed.
6
7 integer debugger = FALSE;
8 list prims;
9
10 debug(string message)
11 {
12 if(debugger)
13 llOwnerSay(message);
14 }
15
16
17
18 string left(string src, string divider) {
19 integer index = llSubStringIndex( src, divider );
20 if(~index)
21 return llDeleteSubString( src, index , -1);
22 return src;
23 }
24
25 string right(string src, string divider) {
26 integer index = llSubStringIndex( src, divider );
27 if(~index)
28 return llDeleteSubString( src, 0, index + llStringLength(divider) - 1);
29 return src;
30 }
31
32
33 list lines;
34
35 default
36 {
38 {
39 llSetText("Click after setting up all tour prims. \nShout on channel '/300 die' to clear all prims", <1.0, 1.0, 1.0>, 2.0);
40
41 }
42
44 {
45 if(llDetectedKey(0) == llGetOwner()) {
46 llOwnerSay("Looking for Route Prims, please wait");
47 prims = [];
48
49 lines = [];
50
51 llListen(300,"","","");
52 llRegionSay(300,"where");
53 }
54 }
55
56 listen(integer channel,string name, key id, string message)
57 {
58 debug(llGetObjectName() + " heard " + message);
59 list parts = llParseString2List(message,["|"],[]);
60
61 integer l = (integer) llList2String(parts,0);
62 vector p = (vector) llList2String(parts,1);
63 rotation r = (rotation) llList2String(parts,2);
64 string text = llList2String(parts,3);
65
66 integer isthere = llListFindList(prims,[(integer) l]);
67
68 if(isthere > -1)
69 {
70 llOwnerSay("Error, there are two prims named " + l + ". Please make sure each prim is uniquely numbered from - to N in sequence from the start prim to the finish prim. Gaps in the sequence are allowed.");
71 }
72 prims += (integer) l;
73 prims += (vector) p;
74 prims += (rotation) r;
75 prims += text;
76 llSetTimerEvent(5.0);
77
78 }
79
80 timer()
81 {
83 integer i = 0;
84
85 prims = llListSort(prims,4,1);
86
87 for (i = 0; i < llGetListLength(prims); i+=4)
88 {
89 integer primnum = llList2Integer(prims,i);
90 vector loc = llList2Vector(prims,i+1);
91 rotation rot = llList2Rot(prims,i+2);
92 string text = llList2String(prims,i+3);
93 lines += [(string) primnum + "|" + (string) loc + "|" + (string) rot + "|" + text];
94
95 }
97 llRemoveInventory("Route");
98
99 osMakeNotecard("Route",lines);
100 llOwnerSay("Route updated");
101 llResetOtherScript("Walker");
102 llSetText("",<1,1,1>,1.0);
103 }
104
106 {
108 }
109 }

Endless Loop Mover

Help notecard for the walker

Category: Telepad
By : Ferd Frederix
Created: 2015-08-05 Edited: 2017-03-11
Worlds: OpenSim


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 // Open Source CC-BY-NC by Ferd Frederix
3 ================
4
5 The walker can be set to auto start in an endless loop(default), or it can be set to wait for a NPC to sit on it. It then unsits the NPC at the end of the route, and returns to the start at high speed.
6
7 The default route I set is a square in mid-air. Rez the prim, it should start moving. Sit on it, you should start walking. In production, make the box invsiible for a NPC to appear to walk at any orientation.
8
9
10
11 '10' Box
12
13 Name this prim '10' without the double quotes. You will use the prim #10 to establish a path of waypoints to follow. It can actually be named any INTEGER such as a 0 ot the number 310, but 10 is the standard start point.
14
15 Rez this at the beginning of the ride.
16
17 The final gadget will start at the #10 prim location and rotation/
18
19 Shift-copy the 10 prim, move it slightly, then GRAB THE ONE YOU LEFT BEHIND and move it to the next place. The prim you shift-copy will be #10, the one left behind will become #20. The original #10 moves, and leaves behind a copy. This copy will automatically make it itself the next larger number.
20
21 You can also just drag out a new one each time you need another waypoint.
22
23 Each prim will rename itself to the largest number found ANYWHERE in the sim, plus 10, about 5 seconds after it rezzes. Since you started with prim #10, the second prim will rename itself as #20, the next will be 30, and so on.
24
25 When finished, click the tour object.
26
27 If you make a mistake, and need to fix it, you can move the prims around. You can renumber them. You can add more prims in between 10 and 20, just renumber them 11, 12, 13, or whatever.
28
29 ==============================
30 Walker Prim - rez the #10 prims, and then touch the tour prim to record a route
31
32 The route prim will follow the route. Fix any issues by replacing, removing or adding the numbered prims, and touch to save
33
34 When finished, delete the Recorder script that is inside the walker as it is not needed.
35
36 The walker can be set to auto start in an endless loop(default), or it can be set to wait for a NPC to sit on it. It then unsits the NPC at the end of the route, and returns to the start at high speed.
37
38 .

Endless Loop Mover

Sample route card to walk in a vertical square

Category: Telepad
By : Ferd Frederix
Created: 2015-08-05 Edited: 2017-03-11
Worlds: OpenSim


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 130|<133.538467,130.615784,23.190590>|<0.000000,0.026177,0.000000,0.999657>|
3 140|<133.779236,130.620636,24.137348>|<0.000000,-0.719340,0.000000,0.694658>|
4 150|<133.779236,130.620636,26.521872>|<0.000000,-0.719340,0.000000,0.694658>|
5 160|<133.310989,130.620636,27.378088>|<0.000000,-0.999962,0.000000,0.008728>|
6 170|<131.158035,130.620636,27.165934>|<0.000000,-0.999962,0.000000,0.008728>|
7 180|<130.844910,130.620636,26.573608>|<0.000000,0.700910,0.000000,0.713250>|
8 210|<130.844910,130.620636,24.083681>|<0.006117,0.700884,-0.006224,0.713222>|
9 220|<131.174484,130.620636,23.452608>|<0.008725,-0.034897,0.000152,0.999353>|

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