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
Bird flamingo  

flamingo

For the bent neck on a flamingo

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life

the Zip file

Download all files for flamingo
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. flamengo.ac
Get file # 2. flamingo.dae
Get file # 3. flamingo2.ac
Get file # 4. flamingo2.dae
Get file # 5. neck.dae
Get file # 6. physics.dae
Get file # 7. Script.lsl
Get file # 8. flamingo honking.wav
Get file # 9. flamingo.wav
Get file # 10. flying-dragon.wav
Get file # 11. Prim_Animation_Compiler_1983.lsl
Get file # 12. Prim_Animation_Compiler_1984.lsl
Get file # 13. Test wings (debug only).lsl
Get file # 14. Wing controller.lsl
Get file # 15. wing flap.lsl
Get file # 16. Script.lsl
Get file # 17. flamingo honking.wav
Get file # 18. flamingo.wav
Get file # 19. Flight script.lsl
Get file # 20. flying-dragon.wav
Get file # 21. pecking.wav
Get file # 22. Prim_Animation_Compiler_1983.lsl
Get file # 23. Prim_Animation_Compiler_1984.lsl
Get file # 24. Recorder.lsl
Get file # 25. Script.lsl
Get file # 26. [90327 bytes] 4270787-vibrant-pink-flamingo-drinking.jpg
Get file # 27. [51112 bytes] Orange flamingo texture.jpg
Get file # 28. [527006 bytes] Orange wing.png
Get file # 29. [47693 bytes] orange-flamingo-head.jpg
Get file # 30. [48354 bytes] Pink flamingo texture.jpg
Get file # 31. [392350 bytes] pink wing.png

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 default
4 {
5
7 {
9 }
10
11 link_message(integer s, integer num, string str, key id)
12 {
13 if(str == "fly")
14 {
16 }
17 else if(str == "land")
18 {
20 }
21
22 }
23
25 {
27 }
28 }

flamingo

test wing flap

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 default
3 {
5 {
6
7 llMessageLinked(LINK_SET,2,"fly","");
8 llSleep(10);
9
10 llMessageLinked(LINK_SET,-2,"land","");
11 }
12
13 link_message(integer from, integer num, string str, key id)
14 {
15 llOwnerSay(str);
16 }
17 }

flamingo

Wing control

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 // Bird flock Wing controller script
3 // Author: Ferd Frederix
4 // This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
5 // This means that this script itself is not for sale, that the script must be full Mod at all time, and that modifications to it MUST be provided to anyone upon request. Pets made with this script may be sold. ~ Ferd Frederix
6 // 5-26-2013
7
8 // Goes into the body of the pet with the SOUND file
9 // 1 ourt of 3 cycles pushes down
10
11 integer STROKE = 2; // bigger is a harder stroke, max is 10
12 float STROKETIME = 0.5; // a wing cycle is twice a stroke
13 integer counter = -1; // boolean for wing up/down
14 string SOUND = "flying-dragon";
15
16 default
17 {
18
19 timer()
20 {
21 counter = ~counter; // -1 = 0 = -1
22
23 if(counter)
24 {
25 llMessageLinked( LINK_SET, -STROKE, "flap",""); // tell the wing to flup up/down
26 llPlaySound(SOUND,1.0);
27
28 }
29 else
30 {
31 llMessageLinked( LINK_SET, STROKE, "flap",""); // tell the wing to flup up/down
32 }
33
34
35
36 }
37
38 link_message(integer from, integer num, string str, key id)
39 {
40
41 llOwnerSay(str);
42
43 if(str =="fly")
44 {
45 llSetTimerEvent(STROKETIME);
46 }
47 else if(str =="land")
48 {
50 }
51
52
53 }
55 {
57 }
58 }

flamingo

FLappy wings

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 default
3 {
4
6 {
8 }
9
10 link_message(integer s, integer num, string str, key id)
11 {
12 if(str=="flap")
13 llSetPrimitiveParams([ PRIM_FLEXIBLE, 1, 2, num, 0.0, 0.0, 2.0, <0,0,0>] );
14
15 else if(str == "fly")
16 {
18 }
19 else if(str == "land")
20 {
22 }
23
24 }
25
27 {
29 }
30 }

flamingo

For one of 2 heads

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 default
3 {
4
6 {
8 }
9
10 link_message(integer s, integer num, string str, key id)
11 {
12 if(str == "fly")
13 {
15 }
16 else if(str == "land")
17 {
19 }
20
21 }
22
24 {
26 }
27 }

flamingo

Flying script

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 // Bird flock flight script
3 // Author: Ferd Frederix
4 // This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
5 // This means that this script itself is not for sale, that the script must be full Mod at all time, and that modifications to it MUST be provided to anyone upon request. Pets made with this script may be sold. ~ Ferd Frederix
6 // 5-26-2013
7
8
9 // requires the following animations, use the names on the right
10 string sLand = "land"; // land is when the legs are down
11 string sFly = "fly"; // fly is legs up
12 string sPeck = "peck"; // peck is actual pecking at the ground
13 string sPeckL = "peckL"; // peckL is left side pecking at the ground
14 string sPeckR = "peckR"; // peckR is right side pecking at the ground
15 string sLegFlop = "legs"; // legs is heads up
16 string sLookAround = "look";// looking around, with a wing flap
17 string sLanding = "landing";// landing positions
18
19 integer _debug = FALSE; // to see what happens, set to FALSE for normal operation
20 float FUDGE = 0.0; // random delay in flight speed each span travlled
21 float SPEED = 2.0; // how fast to fly, large = faster, in meters per second.
22 float RANGE = 10; // how far to sense avatars before flying
23 float TIMEOUT = 5; // how long to stay on ground after flight, and to scan for avatars
24 float MIN = 3; // minimum time between animations
25 float MAX = 7; // MAX + MIN (3+7=10) is the maximum pause between animations
26 integer channel = -325238; // Change this only if you want flocks to not fly unless a sensor in this species detects a human. Otherwise any species will set off flight in 100 meter distance.
27
28 string PECK = "pecking"; // peck sound
29 string FLAP = "flying-dragon"; // flying wing sound, used here when the wings flap idly
30 string IDLE = "flamingo"; // a sound of a bunch of flamingos
31 string FLYING = "flamingo honking"; // used randomly in flight
32
33 // Link message numbers to/from the main bird menu
34 integer fromRoot = -3500;
35 integer toRoot = -3501;
36 integer toFlight = -3502;
37
38
39 float totalTime; // the total time it takes to fly around once.
40 list lCoordinate; // a list of coordinates, rotations, and times from the recorder
41
42 // boolean flags
43 integer iStopMoving; // we need to stop moving
44 integer iAmFlying = FALSE; // true if we are flying.
45 integer iStartTimer = FALSE; // true once the timer is set up
46 integer iStarted = FALSE; // true once someone has clicked Start
47
48 // movement
49
50 integer iAmMaster ; // true if we are the controlling bird
51 vector startPos; // Home pos
52 vector vLastRelPos; // last position we read
53 rotation lastRot; // last rotation
54 rotation startRot; // initial rotation
55 integer listener; // listener int
56
57 rotation NormRot(rotation Q)
58 {
59 float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
60 return <Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
61 }
62
63 DEBUG(string msg)
64 {
65 if(_debug)
66 llOwnerSay(msg);
67 }
68
69 restart()
70 {
71 SetupListens();
72
73 vLastRelPos = ZERO_VECTOR;
74 startRot = llGetRot();
75
76 iAmFlying = FALSE;
77
78 if(iStarted)
79 {
80 llSetTimerEvent(llFrand(MAX)+MIN); // movement channel
81 }
82 }
83
84 menu()
85 {
86 llDialog(llGetOwner(),"Bird Controls:",["Start","-","Stop","Set Home","-","Setup"],channel);
87 }
88
89
90 startFlight()
91 {
92
93 DEBUG("flying");
94
95 // tell the others to boot up
96 if(iAmMaster)
97 llShout(channel,"Start");
98
99 llMessageLinked(LINK_SET,1,sFly,"");
100 iStartTimer = TRUE;
101 llSetTimerEvent(0.1);
102 }
103
104
105 SetupListens()
106 {
107 if(listener)
108 llListenRemove(listener);
109
110 listener = llListen(channel,"","","");
111 }
112
113 default
114 {
116 {
117 llResetScript(); // only if not recrded
118 }
119
121 {
122 startPos = llGetPos();
123 startRot = llGetRot();
124
126
127 llSetKeyframedMotion([],[KFM_COMMAND,KFM_CMD_STOP]);
128
129 llMessageLinked(LINK_SET,1,sLand,"");
130
131 llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]); // needed for older clients
132 vLastRelPos = ZERO_VECTOR;
133 llMessageLinked(LINK_SET,0,"Setup","");
134 totalTime = 0;
135 }
136
137
138 link_message(integer sender_number, integer number, string message, key id)
139 {
140 DEBUG("Bird herd:" +(string) number + ":" + message );
141 if(number == toFlight) // coordinates
142 {
143 list lLine = llParseString2List(message, ["|"], []);
144 DEBUG(llDumpList2String(lLine,","));
145
146 vector pos = (vector) llList2String(lLine,0);
147
148 if(pos != ZERO_VECTOR)
149 {
150 rotation rot = (rotation) llList2String(lLine,1);
151 float distance = llVecDist(pos,vLastRelPos);
152 DEBUG("Dist:" + (string) distance);
153
154 float time = distance / SPEED;
155
156 DEBUG("T1:" + (string) time);
157 time += llFrand(FUDGE);
158
159 // there is a minimum time
160 if(time < .2)
161 time = 0.2;
162
163 //time = (float) ((integer) (time * 45) /45); // round off to nearest frame time to stop drift
164 DEBUG("T2:" + (string) time);
165
166 lCoordinate += pos ; //* newRot;
167 lCoordinate += NormRot(rot);
168 lCoordinate += time;
169 totalTime += time;
170
171 // update the position so we can tell the difference for time calcs
172 vLastRelPos = pos;
173 lastRot = rot;
174 }
175 }
176 else if(message == "Playback")
177 {
178 llSetPos(startPos);
179 llSetRot(startRot);
180 llOwnerSay("Route saved");
181 llOwnerSay("Flight time is " + (string) totalTime + " seconds.");
182
183 state movement;
184 }
185 }
186 }
187
188
189
190 state movement
191 {
193 {
195 restart();
196 menu();
197 }
198
199 link_message(integer sender_number, integer number, string message, key id)
200 {
201 DEBUG("Bird herd:" +(string) number + ":" + message );
202 }
203
204
205 sensor(integer number)
206 {
207 if(iAmMaster && ! iAmFlying)
208 {
209 startFlight();
210 }
211 }
212
214 {
216 {
217 menu();
218 }
219 }
220
221 timer()
222 {
223 if(iStartTimer)
224 {
225 llMessageLinked(LINK_SET,1,sFly,"");
226 llSleep(1); // time for the prims to move into place
227 iAmFlying = TRUE;
228 iStartTimer = FALSE;
229
230 llSetKeyframedMotion(lCoordinate, [KFM_DATA, KFM_TRANSLATION|KFM_ROTATION, KFM_MODE, KFM_FORWARD]);
231 llSetTimerEvent(totalTime); // wake us up at end of the trip.
232 DEBUG("Started flying");
233 }
234 else if(iAmFlying)
235 {
236 DEBUG("Stopping");
237
238 llSetKeyframedMotion([],[KFM_COMMAND,KFM_CMD_STOP]);
239 llMessageLinked(LINK_SET,1,sLanding,"");
240 llSleep(1); // time to land, flapping motion
241 llMessageLinked(LINK_SET,1,sLand,"");
242 llSetPos(startPos);
243 llSetRot(startRot);
245
246 iAmFlying = FALSE;
247
248
249 DEBUG("stopped");
250 llSetTimerEvent(llFrand(MAX)+MIN);
251
252 llSensorRepeat("", "", AGENT, RANGE, PI, TIMEOUT);
253
254 }
255 else
256 {
257 DEBUG("peck");
258
259 float rand = llFrand(10);
260 if(rand < 1.0) // 10 % chance of peck right
261 {
262 llMessageLinked(LINK_ROOT,1,sPeckR,"");
263 llPlaySound(PECK,1);
264 }
265 else if(rand < 2.0) // 10 % chance of a peck to the left {
266 {
267 llMessageLinked(LINK_ROOT,1,sPeckL,"");
268 llPlaySound(PECK,1);
269 }
270 else if(rand < 4.0) // 20% chance of a peck
271 {
272 llMessageLinked(LINK_SET,1,sPeck,"");
273 llPlaySound(PECK,1);
274 }
275 else if(rand < 6.0) // 20% chance of a leg swap
276 {
277 llMessageLinked(LINK_SET,1,sLegFlop,"");
278 }
279 else if(rand < 8.0) // 20 % chance of a look around && flap
280 {
281 llMessageLinked(LINK_ROOT,1,sFly,""); // wings out, flapping
282 llMessageLinked(LINK_ROOT,1,sLookAround,""); // heads up
283 llPlaySound(IDLE,1); // make honking sounds
284 llSleep(2);
285 llMessageLinked(LINK_ROOT,1,sLand,""); // back to idle
286 }
287 else // 20%
288 {
289 if(iAmMaster) // only the lead bird loops the honking
290 {
291 llPlaySound(IDLE,1);
292 }
293 }
294 llSetTimerEvent(llFrand(MAX)+MIN);
295 }
296
297 // they clicked stop, but we were flying, so we shut down here
298 if(iStopMoving)
299 {
301 llSetTimerEvent(0.0);
302 iStopMoving = FALSE;
303 }
304
305 } // timer
306
307
308 listen(integer channel, string name, key id, string message)
309 {
310 if(message == "sensor")
311 {
312 iAmMaster = FALSE;
314 }
315 else if( message == "Setup")
316 {
317 state default;
318 }
319 else if(message == "Stop")
320 {
321 if(iAmFlying)
322 iStopMoving = TRUE; // cannot stop timer when flying, so we signal instead
323 else
326 }
327 else if(message == "Start")
328 {
329 if(iAmFlying)
330 return;
331
332 iStarted = TRUE;
333 llSleep(llFrand(1.0));
334 startFlight();
335 }
336 else if(message == "Set Home")
337 {
338 if(iAmFlying)
339 return;
340
341 startPos = llGetPos();
342 startRot = llGetRot();
343 llOwnerSay("Position set");
344 }
345 }
346
347
349 {
350 llShout(channel,"sensor");
351 iAmMaster = TRUE;
352 restart();
353 }
354
355
356 }
357
358
359
360
361

flamingo

Compiler for movement

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 // For more details on how this script works, see <a href="http://metaverse.mitsi.com/secondlife/posts/prim-compiler/">http://metaverse.mitsi.com/secondlife/posts/prim-compiler/</a>
3 //
4 //This is the Animator menu system. You will also need to the compiler script. You can adjust the script for OpenSim or Second Life with one variable set to TRUE or FALSE for memory checking.
5 // ______ _ ______ _ _
6 // | ___| | | | ___| | | (_)
7 // | |_ ___ _ __ __| | | |_ _ __ ___ __| | ___ _ __ ___ __
8 // | _/ _ \ '__/ _` | | _| '__/ _ \/ _` |/ _ \ '__| \ \/ /
9 // | || __/ | | (_| | | | | | | __/ (_| | __/ | | |> <
10 // \_| \___|_| \__,_| \_| |_| \___|\__,_|\___|_| |_/_/\_\
11 //
12 // fred@mitsi.com
13 // 2-19-2012
14
15 // Animator front-end for Compiler Script
16 // This is free software, it is not for sale at any price
17
18 integer playchannel = 1; // the playback channel, this is the channel you use in LinkMessages
19 integer debug = FALSE; // if set to TRUE, debug info appears
20 integer dialogchannel ; // dialog boxes
21 integer nPrims; // total number of prims
22 integer wantname; // flag indicating we are waiting for a name to be chatted
23 integer wantnum; // flag asking for numbers to be chatted.
24
25 // Link messages
26 integer CLEAR = -234756;
27 integer DATA = -234757;
28 integer COMPILE = -234758;
29 integer DIE = -234759;
30
31 // the list of coords
32 list masterlist; // master list of all positions
33 list llastPrimList; // storage of the last prim position we learned
34 string curranimation; // what we are playing
35 integer STRIDE = 5; // size of the master list
36 integer lastSTRIDE = 3; // size of the last prim list
37 integer listener; // temp listener when we are waiting for them to give us a name
38 vector InitSize; // the initial size when the prims were recorded
39 list LoadedAnims; // animations added to the Menu display
40
41 DEBUG(string msg)
42 {
43 if(debug) llOwnerSay("// " + msg);
44 }
45
46 Record()
47 {
48 if(llStringLength(curranimation) > 0)
49 {
50 integer foundmovement = 0; // will be set if any child moved
51 integer PrimCounter ; // skip past the root prim
52 for (PrimCounter =2; PrimCounter <= nPrims; PrimCounter++ )
53 {
54 //DEBUG("Checking Prim " + (string) PrimCounter);
55
56 list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]);
57 // position is always in region coordinates, even if the prim is a child or the root prim of an attachment.
58 // rot is always the global rotation, even if the prim is a child or the root prim of an attachment.
59 // get current prim pos, rot and size
60 vector vrealPrimPos = llList2Vector(my_list,0) - llGetPos(); // position subtract Global Pos
61 vrealPrimPos /= llGetRot();
62 rotation rrealPrimRot = llList2Rot(my_list,1) / llGetRot(); // rotation subtract Global Rot
63 vector vrealPrimSize = llList2Vector(my_list,2); // size
64
65 // compare it to the last one we had
66 integer iindex = (PrimCounter - 2) * lastSTRIDE; // zeroth position is PrimCounter - start, or 2
67
68 // get the last thing we remembered about this prim
69 vector vlastPrimPos = llList2Vector(llastPrimList, iindex);
70 rotation rlastPrimRot = llList2Rot(llastPrimList, iindex+1);
71 vector vlastPrimSize = llList2Vector(llastPrimList, iindex+2);
72
73 //if(debug)
74 //{
75 // vrealPrimPos = <1,2,llFrand(1)>; // make a small change for debugging in LSL Editor
76 //}
77
78 // if anything changed on this prim, we must record it.
79 if(vlastPrimPos != vrealPrimPos ||
80 rlastPrimRot != rrealPrimRot ||
81 vlastPrimSize!= vrealPrimSize
82 )
83 {
84 foundmovement++;
85
86 //Save changes in the master list of all animations
87 masterlist += curranimation;
88 masterlist += (float) PrimCounter;
89 masterlist += vrealPrimPos;
90 masterlist += rrealPrimRot;
91 masterlist += vrealPrimSize;
92
93 string msg = curranimation + "|" + (string) PrimCounter + "|" + (string) vrealPrimPos + "|" + (string) rrealPrimRot + "|" + (string) vrealPrimSize ;
94 llMessageLinked(LINK_ROOT,DATA,msg,"");
95
96 // update the last movement list
97 llastPrimList = llListReplaceList(llastPrimList,[vrealPrimPos],iindex,iindex);
98 llastPrimList = llListReplaceList(llastPrimList,[rrealPrimRot],iindex+1,iindex+1);
99 llastPrimList = llListReplaceList(llastPrimList,[vrealPrimSize],iindex+2,iindex+2);
100
101 } // if
102 else
103 {
104 //DEBUG( (string) PrimCounter);
105 }
106 } // for
107
108 //DEBUG("history:" + llDumpList2String(llastPrimList,":"));
109
110 if(foundmovement)
111 {
112 llOwnerSay("Recorded " + (string) foundmovement + " prims" );
113 }
114 else
115 {
116 llOwnerSay("You must move at least one child prim.");
117 }
118 }
119 else
120 {
121 llOwnerSay("You must name your animation.");
122 llOwnerSay("Type the new animation name on channel /" + (string) dialogchannel);
123 wantname++;
124 }
125 }
126
127 // on reset, record the base position in history so we can see changes
128 Clear()
129 {
130 llMessageLinked(LINK_ROOT,CLEAR,"","");
131 LoadedAnims = []; // wipe out Menu
132 masterlist = []; // wipe all recordings
133 llastPrimList = []; // wipe last animations
134 integer PrimCounter ; // skip 1, which is the root prim
135 integer counter = 0;
136 // save all the current settings in memory
137 for (PrimCounter=2; PrimCounter <= nPrims; PrimCounter++ )
138 {
139 list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]);
140
141 // save the local pos and rot, since llGetLinkPrimitiveParams returns global pos and rot
142 vector primpos = llList2Vector(my_list,0) - llGetPos();
143 primpos /= llGetRot();
144 rotation primrot = llList2Rot(my_list,1) / llGetRot();
145 vector primsize = llList2Vector(my_list,2) ;
146
147
148 llastPrimList += primpos;
149 llastPrimList += primrot;
150 llastPrimList += primsize;
151 counter++;
152 }
153 llOwnerSay("There are " + (string) counter + " animatable prims");
154 }
155
156 DumpBack ()
157 {
158 integer imax = llGetListLength(masterlist);
159 integer howmany = imax / STRIDE ;
160 llOwnerSay("Preprocessing " + (string) howmany + " movements. " );
161 llMessageLinked(LINK_ROOT,COMPILE,"","");
162 }
163
164
165 rotation calcChildRot(rotation rdeltaRot)
166 {
167
169 return rdeltaRot/llGetLocalRot();
170 else
171 return rdeltaRot/llGetRootRotation();
172
173 }
174
175
176 PlayBack (string name)
177 {
178 integer i;
179 integer imax = llGetListLength(masterlist);
180
181 integer linknum = 0;
182
183 for (i = 0; i < imax; i+= STRIDE)
184 {
185 string saniName = llList2String(masterlist,i);
186
187 vector scale = llGetScale();
188 float delta = scale.x / InitSize.x ; // see if the root prim has grown or shrunk as a percentage
189 if(saniName == name)
190 {
191 float fprimNum = llList2Float(masterlist,i+1);
192 vector vPos = llList2Vector(masterlist,i+2);
193 rotation rRot = llList2Rot(masterlist,i+3) ;
194 vector vprimSize = llList2Vector(masterlist,i+4) ;
195
196 vPos *= delta; // add any difference in size to it positions there
197 vprimSize *= delta; // grow the child prim, too
198
199 // support negative prim numbers as a delay
200 if(fprimNum < 0)
201 {
202 // DEBUG("Sleeping " + (string) (fprimNum * -1));
203 llSleep((float) fprimNum * -1);
204 }
205 else
206 {
207 // set the local pos and locat rot to the prims orientation and position
208 rRot = calcChildRot(rRot);
209
210 list actions = [PRIM_POSITION,vPos,PRIM_ROTATION,rRot,PRIM_SIZE,vprimSize];
211 //DEBUG("Moving prim :" + (string) fprimNum + ":" + llDumpList2String(actions,":"));
212
213 llSetLinkPrimitiveParamsFast((integer) fprimNum,actions);
214 }
215 }
216 }
217 }
218
219 MakeMenu()
220 {
221 list amenu = ["Reset","Record","Help","Name","Compile","Pause", "Finish"] + LoadedAnims;
222
223 llListenRemove(listener);
224 listener = llListen(dialogchannel,"","","");
225 amenu = llDeleteSubList(amenu,12,99);
226 llDialog(llGetOwner(), "Pick a command",amenu,dialogchannel);
227 }
228
229
230 default
231 {
233 {
234 InitSize = llGetScale(); // save the size when we recorded the prims
235 nPrims = llGetNumberOfPrims(); // how many we are recording
236 llOwnerSay("Prim count = " + (string) nPrims);
237 Clear();
238
239 dialogchannel = (integer) (llFrand(100) +600);
240 MakeMenu();
241 }
242
243
244 touch_start(integer total_number)
245 {
247 {
248 llOwnerSay("FreeMemory="+(string)llGetFreeMemory());
249 MakeMenu();
250 }
251 }
252
253 listen( integer channel, string name, key id, string message )
254 {
255 if(message == "Finish")
256 {
257 llMessageLinked(LINK_ROOT,DIE,"die","");
258 if(! debug)
259 {
261 }
262 }
263 else if(message == "Reset")
264 {
266 }
267 else if(wantnum)
268 {
269 float num = (float) message;
270 if(num > 0.0)
271 {
272 num = -1 * (num /1000);
273 masterlist += curranimation;
274 masterlist += num;
275 masterlist += <0,0,0>; // pos
276 masterlist += <0,0,0,1>;// rot
277 masterlist += <0,0,0>; // size
278 string msg = curranimation + "|" + (string) num + "|<0,0,0>|<0,0,0,1>|<0,0,0>" ;
279 llMessageLinked(LINK_ROOT,DATA,msg,"");
280 }
281 else
282 {
283 llOwnerSay("Please enter numbers in milliseconds. 1000=1000ms = 1 second. 500=500ms = 1/2 a second.");
284 llOwnerSay("What is a milliHelen? A milliHelen is a face that can launch one ship!");
285 }
286 wantnum = FALSE;
287 MakeMenu();
288 }
289 else if(message =="Pause")
290 {
291 wantnum= TRUE;
292 llListenRemove(listener);
293 listener = llListen(dialogchannel,"","","");
294 llTextBox(llGetOwner(), "Enter a delay in milliseconds:\n1000 = 1 second\n500 = 1/2 second",dialogchannel);
295 }
296 else if(message == "Record")
297 {
298 Record();
299 MakeMenu();
300 }
301 else if(message == "Name")
302 {
303 llOwnerSay("Enter a new name, or type the animation name on channel /" + (string) dialogchannel);
304
305 wantname = TRUE;
306 MakeMenu();
307 llTextBox(llGetOwner(),"Enter an Animation Name",dialogchannel);
308 }
309 else if(message == "Compile")
310 {
311 DumpBack();
312 MakeMenu();
313 }
314 else if(message == "Help")
315 {
316 llLoadURL(llGetOwner(),"View online help", "http://secondlife.mitsi.com/secondlife/Posts/Prim-Compiler");
317 }
318 else if(wantname)
319 {
320 curranimation = message;
321 LoadedAnims += message;
322
323 MakeMenu();
324 llOwnerSay("Recording is ready for animation '" + curranimation + "'");
325 llOwnerSay("Position any child prims, then select the menu item 'Record', and repeat as necessary. When finished, click 'Compile' to save the animation, or click the animation name to play it back. Click 'Name' to start a new animation sequence");
326 wantname = 0;
327 }
328 else
329 {
330 if(llListFindList(LoadedAnims,[message]) != -1)
331 {
332 PlayBack(message);
333 MakeMenu();
334 }
335 }
336
337
338 }
339 }

flamingo

Compiler for prim animation

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 // This script produces optimized LSL code that can be triggered by link messages.
3 // fred@mitsi.com
4 // 3-7-2012
5 // Rev B, added a missing } at the end of multiple recordings.
6
7
8 // Author: Ferd Frederix
9 // Based on an excellent script by Allen Firethorn
10 // This is free software, it is not for sale at any price
11
12
13 // Tunable stuff:
14 integer OpenSim = FALSE; // Set to FALSE for Second Life to save memory
15 string fast="Fast"; // Set this to an empty string if you don't want to use the fast animation
16 integer debug = FALSE; // set to TRUE to see stuff inside as it runs
17
18 list animations; // holds a list of all animation names
19 list receivedData; // the data from the main program
20 integer STRIDE = 5; // size of the data packets in receivedData
21 integer currentLine; // the line we are processing
22
23 // Link messages
24 integer CLEAR = -234756;
25 integer DATA = -234757;
26 integer COMPILE = -234758;
27 integer DIE = -234759;
28
29 DEBUG(string msg)
30 {
31 if(debug) llOwnerSay("// " + msg);
32 }
33
34 // speak without the name of the prim in the way
35 SayCode (string story){
36 llOwnerSay(story);
37 llSleep(0.1);
38
39 }
40
41 default {
42
43 link_message(integer sender_num,integer num, string msg, key id) {
44
45 if(num == DIE && msg =="die") // clear
46 {
47 llOwnerSay("Compiler has been removed");
48 if(! debug) {
50 }
51 }
52
53 if(num == CLEAR) // clear
54 {
55 animations = [];
56 receivedData = [];
57 currentLine = 0;
58 llOwnerSay("Compiler Ready");
59 }
60 else if(num == DATA) // data
61 {
62 // data formatted like this:
63 // name|primnum|vector Pos|rotation rot|vector size
64 // test1|2|<0.026306,-0.150208,0.191069>|<-0.000008,0.956309,-0.292356,0.000000>|<0.074010,0.074010,0.074010>
65 list primList = llParseString2List(msg,["|"],[]);
66 string name = llList2String(primList,0);
67
68 receivedData += name;
69 receivedData += (float) llList2String(primList,1); // prim Number or ms to sleep
70 receivedData += (vector) llList2String(primList,2); // pos
71 receivedData += (rotation) llList2String(primList,3); // rot
72 receivedData += (vector) llList2String(primList,4); // size
73
74 // Store the name of the animation if it is not already stored
75 integer i = llListFindList(animations, [name]);
76
77 if( i < 0 ){
78 DEBUG("Adding Animation named " + name);
79 animations += name;
80 }
81
82 currentLine++;
83 }
84 else if(num == COMPILE) // finish, compile it
85 {
86
87 //DEBUG("Animations:" + llDumpList2String(animations,":"));
88 //DEBUG("Length:" + ((string) llGetListLength(animations)));
89 //DEBUG("history:" + llDumpList2String(receivedData,":"));
90 //DEBUG("Length:" + ((string) llGetListLength(receivedData)));
91
92
93 string code;
94 integer i;
95
96 llOwnerSay("Compiler processing " + (string)currentLine + " prim movements and " + (string) llGetListLength(animations) + " animations");
97
98 llOwnerSay("Copy everything below this line and paste it into a new script\n");
99
100 string oldname = llGetObjectName();
101 llSetObjectName("Compiler");
102
103 vector scale = llGetScale();
104 SayCode("// Prim animation compiler //\n"
105 + "// Ferd Frederix - http://www.free-lsl-scripts.com\n"
106 + "integer playbackchannel = 1; // The default llMessageLinked number\n"
107 + "rotation calcChildRot(rotation rdeltaRot){\n"
108 + "\tif(llGetAttached())\n"
109 + "\t\treturn rdeltaRot/llGetLocalRot();\n"
110 + "\telse\n"
111 + "\t\treturn rdeltaRot/llGetRootRotation();\n"
112 + "}\n"
113 + "vector originalScale = "
114 + (string) scale
115 + ";"
116 );
117
118
119
120 // Go through each animation and create a function for each one
121 for(i = 0; i < llGetListLength(animations); i++){
122 integer j;
123 string animationName = llList2String(animations, i);
124
125 //DEBUG("Processing " + animationName);
126
127 SayCode(animationName
128 + "(){\n"
129 + "\tvector currentSize = llGetScale();\n"
130 + "\tfloat scaleby = currentSize.x/originalScale.x;\n"
131 );
132
133
134
135 //Read through the list and print out the instructions for this animation
136 integer count = llGetListLength(receivedData);
137 for(j=0; j < count; j += STRIDE)
138 {
139 string name = llList2String(receivedData,j);
140 float primNum = (float) llList2String(receivedData,j+1);
141
142 //DEBUG("name: " + name + " Prim Num: " + primNum);
143 if( name == animationName){
144 if(primNum > 1){ // not a root prim or sleep
145 SayCode( "\tllSetLinkPrimitiveParams"
146 + fast
147 + "("
148 + (string) ((integer)primNum)
149 + ", [PRIM_POSITION, "
150 + (string) llList2Vector(receivedData,j+2)
151 + "*scaleby, "
152 + "PRIM_ROTATION,calcChildRot("
153 + (string) llList2Rot(receivedData,j+3)
154 + "), "
155 + "PRIM_SIZE, "
156 + (string) llList2Vector(receivedData,j+4)
157 + "*scaleby]);"
158 );
159 } else {
160 SayCode("\tllSleep("
161 +(string)(primNum*-1) // negative numbers are sleep times
162 +");"
163 );
164 }
165 } // if name
166 } // for j
167 SayCode ("\n}");
168 } // for animations
169
170 SayCode (
171 "\n\n"
172 + "default{\n"
173 );
174 if(!OpenSim)
175 SayCode("\tstate_entry(){\n"
176 +"\t\tllSetMemoryLimit(llGetUsedMemory() + 512);\n"
177 + "\t\t}");
178
179 code = "\n\tlink_message(integer sender_num, integer num, string message, key id){\n"+
180 "\t\tif(num == playbackchannel){\n";
181 for(i=0; i<llGetListLength(animations);i++){
182 code+="\t\t\tif(message == \""+llList2String(animations,i)+"\"){\n"+
183 "\t\t\t\t"+llList2String(animations,i)+"();\n"+
184 "\t\t\t}\n";
185 }
186 code += "\t\t}\n"+
187 "\t}\n}";
188 SayCode(code);
189
190 SayCode("// Done! Copy everything above to a new script, and Search/Replace the time stamp and Compiler: on the left to be blank");
191 llSetObjectName(oldname);
192
193 }
194 }
195
196
197 }

flamingo

Recorder for movement paths

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 // Bird flock recorder script
3 // Author: Ferd Frederix
4 // This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
5 // This means that this script itself is not for sale, that the script must be full Mod at all time, and that modifications to it MUST be provided to anyone upon request. Pets made with this script may be sold. ~ Ferd Frederix
6 // 5-26-2013
7
8 //
9 //Commands are typed in Chat:
10 //
11 //Init - resets the script and gets it ready
12 //set - records a position and rotation
13 //Run - Plays back the animation
14 //Export - Prints the list to chat so you can save it or put it into another script.
15 //
16 // This work uses content from the Second Life® Wiki article at http://wiki.secondlife.com/wiki/User:Jasper_Flossberg. Copyright © 2007-2012 Linden Research, Inc. Licensed under the Creative Commons Attribution-Share Alike 3.0 License.
17 // Attribution — You must attribute the work
18 // Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
19
20
21 integer debug = FALSE;
22
23
24 // Link message numbers to/from the main bird menu
25 integer fromRoot = -3500;
26 integer toRoot = -3501;
27 integer toFlight = -3502;
28
29 list keys=[];
30 vector last_pos;
31 rotation last_rot;
32
33 vector start_pos;
34 rotation start_rot;
35 integer comChannel; // holds the owners channel
36 integer comHandle;
37
38 update_loc()
39 {
40 last_pos=llGetPos();
41 last_rot=llGetRot();
42 }
43
44 DEBUG(string msg)
45 {
46 if(debug)
47 llOwnerSay(msg);
48 }
49
50 Reset()
51 {
52 DEBUG("Intializing flight recorder");
53 llSetKeyframedMotion([],[]);
54 keys=[];
55 start_pos=llGetPos();
56 start_rot=llGetRot();
57 update_loc();
58 }
59
60 list menu = ["Set Start","Record", "Finish"];
61
62 dialog()
63 {
64 if(comHandle)
65 llListenRemove(comHandle);
66 comChannel = llCeil((llFrand(1000000) + 10000) * -1);
67 comHandle = llListen(comChannel,"","","");
68 integer memory = llGetFreeMemory();
69 llDialog(llGetOwner(),"Select a recording option\nMemory Free:\n" + (string) memory,menu,comChannel);
70 }
71
72
73 default
74 {
76 {
77 Reset();
78 }
79
81 {
83 {
84 dialog();
85 }
86 }
87
88
89 link_message(integer sender_number, integer number, string message, key id)
90 {
91 if(message=="Setup")
92 {
93 Reset();
94 dialog();
95 }
96 }
97
98 listen(integer channel, string name, key id, string message)
99 {
100 if(message == "Set Start")
101 {
102 Reset();
103 dialog();
104 }
105 else if(message == "Record")
106 {
107 keys+=[llGetPos()-last_pos,ZERO_ROTATION*(llGetRot()/last_rot)];
108 update_loc();
109 dialog();
110 }
111 else if(message=="Finish")
112 {
113 llOwnerSay("Saving Route");
114 integer i;
115 integer j = llGetListLength(keys);
116 for ( ; i < j; i+=2)
117 {
118 string msg;
119 vector myPos = llList2Vector(keys,i);
120 rotation myRot = llList2Rot(keys,i+1);
121 msg = (string) myPos + "|" + (string) myRot;
122
123 DEBUG("Recorder:" + msg);
124
125 llMessageLinked(LINK_SET,toFlight,msg,""); // tell the root prim to go silent on the menu
126 llSleep(0.1); // time to dequeue it and encode it.
127 }
128 llMessageLinked(LINK_THIS,toRoot,"Playback",""); // tell the root prim to go silent on the menu
129 state idle;
130 }
131
132
133 }
134 }
135
136
137 state idle
138 {
140 {
141 }
142
143 link_message(integer sender_number, integer number, string message, key id)
144 {
145 if(message=="Setup")
146 {
147 llOwnerSay("Flight route is empty. Move the bird and click Record");
148 Reset();
149 dialog();
150 state default;
151 }
152
153 }
154 }

flamingo

One of two neck scripts

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2014-09-24
Worlds: Second Life


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 default
3 {
4
6 {
8 }
9
10 link_message(integer s, integer num, string str, key id)
11 {
12 if(str == "fly")
13 {
15 }
16 else if(str == "land")
17 {
19 }
20
21 }
22
24 {
26 }
27 }

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