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
Egret Gwenette  

Gwenette

script for the fish

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

the Zip file

Download all files for Gwenette
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. [37504 bytes] f2.png
Get file # 2. [31821 bytes] red.png
Get file # 3. Closed Mouth.lsl
Get file # 4. Fish scriptt.lsl
Get file # 5. open mouth.lsl
Get file # 6. Animator.lsl
Get file # 7. flight.lsl
Get file # 8. Movement.txt
Get file # 9. Route.txt
Get file # 10. test flap.lsl
Get file # 11. Bent Wing.lsl
Get file # 12. Flexwing.lsl
Get file # 13. [101739 bytes] Image1.jpg
Get file # 14. [99831 bytes] Image2.jpg
Get file # 15. [81821 bytes] Image3.jpg
Get file # 16. [98398 bytes] Image4.jpg
Get file # 17. [64496 bytes] Image5.jpg
Get file # 18. [32298 bytes] body.jpg
Get file # 19. [219609 bytes] clow fish texture.jpg
Get file # 20. Egret.ac
Get file # 21. egret.dae
Get file # 22. [31631 bytes] head.jpg
Get file # 23. Single Egret.ac
Get file # 24. [197012 bytes] Swan.spreads.wings.arp.png
Get file # 25. [337375 bytes] trumpeter.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 default
3 {
4
6 {
8 }
9
10 link_message(integer s, integer num, string str, key id)
11 {
12
13 if(str == "peck")
14 {
16 }
17 else
18 {
20 }
21
22 }
23
25 {
27 }
28 }

Gwenette

For the closed mouth

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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
13 if(str == "open")
14 {
16 }
17 else if(str =="close")
18 {
20 }
21
22 }
23
25 {
27 }
28 }

Gwenette

for the open mouth

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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
13 if(str == "open")
14 {
16 }
17 else if(str =="close")
18 {
20 }
21
22 }
23
25 {
27 }
28 }

Gwenette

for the flex wing

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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=="flapup")
13 {
14 llSetPrimitiveParams([ PRIM_FLEXIBLE, 1, 2, 2, 2.0, 0.0, 10.0, <0,0,0>] );
15 }
16 else if(str == "flapdown")
17 {
18 llSetPrimitiveParams([ PRIM_FLEXIBLE, 1, 2, -2, 2.0, 0.0, 10.0, <0,0,0>] );
19 }
20 else if(str == "fly")
21 {
22 llSleep(2);
24 }
25 else if(str == "land")
26 {
28 }
29
30 }
31
33 {
35 }
36 }

Gwenette

for the bent wing

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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 {
7 }
8
9 link_message(integer s, integer num, string str, key id)
10 {
11
12 if(str == "fly")
13 {
15 llSleep(2);
17 }
18 else if(str == "land")
19 {
21 llSleep(2);
23 }
24
25 }
26 }

Gwenette

flight script

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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 and that modifications to it must be provided to anyone upon request. Pets made with this script may be sold. ~ Ferd Frederix
6
7
8 // land, fly, peck, walk1 walk2 walk3
9
10 integer _debug = FALSE;
11 float SPACE = 1; // twice the amount of slop in flight
12 float SPEED = 2.0; // how fast to fly, large = faster, in meters per second.
13 float RANGE = 8; // how far to sense avatars
14 float TIMEOUT = 2; // how long to stay on ground after flight, and to scan for avatars
15 float MIN = 2; // walk timers
16 float MAX = 7; // MAX + MIN is the random time for actions
17
18 string WINGSOUND = "silence"; // UUID of a sound of wings flapping
19 string PECK = "pecking"; // peck sound
20 string FLY = "silence"; // flying sound
21
22 float totalTime; // the total time it takes to fly around once.
23 list lCoordinate; // a list of coordinates, rotations, and times from the notecard
24
25 integer moving = FALSE; // true if we are flying.
26 integer starting = FALSE; // true once the timer is set up
27
28 // notecard reading
29 integer iIndexLines; // the current line
30 string NOTECARD = "Route"; // the notecard for configuring
31 integer initted; // set TRUE when notecard is read.
32 key kNoteCardLines; // the key of the notecard
33 key kGetIndexLines; // the key of the current line
34 integer linecounter;
35
36
37 // movement
38 integer started = FALSE; // true once someone has clicked Start
39 integer sensorON ; // true if sensor is running
40 integer master = FALSE; // treu if we are the last bird
41 vector startPos; // Home pos
42 vector lastPos; // last position we read
43 rotation lastRot; // last rotation
44 rotation startRot; // initial rotation
45
46 integer first; // first time flag
47 integer channel = -32523874; // the only listener
48 integer listener; // listener int
49
50 rotation NormRot(rotation Q)
51 {
52 float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
53 return <Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
54 }
55
56
57 restart()
58 {
59 SetupListens();
60
61 startPos = llGetPos();
62 startRot = llGetRot();
63
64 moving = FALSE;
65
66 if(started)
67 {
68 llSensorRepeat("", "", AGENT, RANGE, PI, TIMEOUT);
69 llSetTimerEvent(llFrand(MAX)+MIN); // movement channel
70 }
71 }
72
73 menu()
74 {
75 llDialog(llGetOwner(),"Bird Controls:",["Start","Reset","Stop","Set Pos","Sensor"],channel);
76 }
77
78 string strip( string str)
79 {
80 string out;
81 integer i;
82
83 for (; i < llStringLength(str); i++)
84 {
85 out += llGetSubString(str,i,i);
86 out = llStringTrim(out, STRING_TRIM);
87 }
88 return out;
89
90 }
91
92 string Getline(list Input, integer line)
93 {
94 return strip(llList2String(Input, line));
95 }
96
97 startFlight()
98 {
99
100 if(_debug) llOwnerSay("flying");
101 // tell the others
102 if(master)
103 llSay(channel,"Start");
104
106 llMessageLinked(LINK_SET,1,"fly","");
107
108 llLoopSound(FLY,1.0);
109
110 starting = TRUE;
111 llSetTimerEvent(0.1);
112 }
113
114 init()
115 {
116 kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD);
117 kGetIndexLines = llGetNotecardLine(NOTECARD,0);
118 }
119
120 SetupListens()
121 {
122 if(listener)
123 llListenRemove(listener);
124
125 listener = llListen(channel,"","","");
126 }
127
128 default
129 {
130
132 {
134 }
135
136
138 {
140
141 llSetKeyframedMotion([],[KFM_COMMAND,KFM_CMD_STOP]);
142 llMessageLinked(LINK_SET,1,"land","");
143
144 //if(_debug) llSetRegionPos(<114.332, 187.276, 20.8566>);
145
146 if(initted == FALSE)
147 {
148 llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]); // needed for older clients
149 init();
150 }
151 }
152
153
154
155
156 // read notecard on reset
157 dataserver(key queryid, string data)
158 {
159 if(queryid == kNoteCardLines)
160 {
161 iIndexLines = (integer) data;
162 }
163
164 if(queryid == kGetIndexLines)
165 {
166 if(data != EOF)
167 {
168 queryid = llGetNotecardLine(NOTECARD, linecounter);
169 list lLine = (llParseString2List(data, ["|"], []));
170
171 float ctr = (float) Getline(lLine,1);
172 if(ctr >= 0)
173 {
174 vector pos = (vector)Getline(lLine,2);
175
176 if(pos != ZERO_VECTOR)
177 {
178 rotation rot = (rotation) Getline(lLine,3);
179 float distance = llVecDist(pos,lastPos);
180
181 float time = distance / SPEED;
182 time += llFrand(.2);
183
184 if(time < .2)
185 time = 0.2;
186
187 rotation newRot = NormRot(rot );
188
189 integer newtime = (integer) (time * 45);
190
191 time = (float) newtime /45;
192
193 lCoordinate += pos * newRot;
194 //lCoordinate += newRot;
195
196 lCoordinate += NormRot(newRot);
197 lCoordinate += time;
198 totalTime += time;
199
200 lastPos = pos;
201 lastRot = rot;
202 }
203 integer locationLength = (llGetListLength(lCoordinate))/3; // 3 strided list
204
205 integer InitPerCent = (integer) llRound(((float) locationLength / (float) iIndexLines) * 100);
206 llSetText("Initialising... \n" + (string) InitPerCent + "%" , <1,1,1>, 1.0);
207
208 }
209 else
210 {
211 llOwnerSay("Something is wrong in the notecard");
212 }
213 linecounter++;
214 }
215 else
216 {
217 llOwnerSay("Flight time is " + (string) totalTime + " seconds.");
218 llSetText("", <1,1,1>, 1.0);
219 initted = TRUE;
220 state movement;
221 }
222 kGetIndexLines = llGetNotecardLine(NOTECARD,linecounter);
223 }
224 }
225 }
226
227
228
229 state movement
230 {
232 {
233 restart();
234 }
235
236
237
238
239 sensor(integer number)
240 {
241 llSensorRemove(); // an avatar is here, we will turn it on after we fly.
242 if(master && ! moving)
243 {
244 startFlight();
245 }
246 }
247
249 {
251 {
252 menu();
253 }
254 }
255
256 timer()
257 {
258
259 if(starting)
260 {
261
262 llSleep(3.0); // let anims finish, if any
263 llMessageLinked(LINK_SET,1,"close","");
264 llSetKeyframedMotion(lCoordinate, [KFM_DATA, KFM_TRANSLATION|KFM_ROTATION, KFM_MODE, KFM_FORWARD]);
265 moving = TRUE;
266 starting = FALSE;
267
268 llSetTimerEvent(totalTime); // wake us up at end of the trip.
269 if(_debug) llOwnerSay("start flying");
270 }
271 else if(moving )
272 {
273 if(_debug) llOwnerSay("stopping");
274
275 llSetKeyframedMotion([],[KFM_COMMAND,KFM_CMD_STOP]);
276 llSleep(1); // time to land, flapping motion
277 llSetPos(startPos);
278 llMessageLinked(LINK_SET,1,"land","");
279 llSetRot(startRot);
281 moving = FALSE;
282
283 if(sensorON && master)
284 llSensorRepeat("", "", AGENT, RANGE, PI, TIMEOUT);
285
286 llSetTimerEvent(llFrand(MAX)+MIN);
287 }
288 else
289 {
290 if(_debug) llOwnerSay("peck");
291
292
294 float rand = llFrand(4);
295 if(rand < 1.0) // 25 % chance of a peck
296 {
297
298 llMessageLinked(LINK_ROOT,1,"peck","");
299 llPlaySound(PECK,1);
300 llSleep(5);
301 llMessageLinked(LINK_ROOT,1,"close","");
302
303 }
304 else if(rand < 2) // 25% chance of a flap
305 {
306 llPlaySound(FLY,1.0);
307 llMessageLinked(LINK_SET,1,"fly","");
308 llSleep(2);
309 llMessageLinked(LINK_SET,1,"land","");
310 llSleep(2.0);
311 }
312 else // 50% chance of a motion
313 {
314 integer walknum = llCeil(llFrand(2)) +1; // from 1 to 3
315 llMessageLinked(LINK_ROOT,1,"walk" + (string) walknum,"");
316 }
317 llSetTimerEvent(llFrand(MAX)+MIN);
318 }
319
320 }
321
322
323 listen(integer channel, string name, key id, string message)
324 {
325 if(message == "Sensor")
326 {
327 if(sensorON) {
328 sensorON = FALSE;
330 llOwnerSay("Avatar sensor is Off");
331 llSay(channel,"master");
332 }
333 else
334 {
335 sensorON = TRUE;
336 llSensorRepeat("", "", AGENT, RANGE, PI, TIMEOUT);
337 llOwnerSay("Avatar sensor is On");
338 llSay(channel,"master");
339 }
340 }
341 else if(message == "master")
342 {
343 sensorON = FALSE;
345 }
346 else if( message == "Reset")
347 {
349 }
350 else if(message == "Stop")
351 {
352 moving = FALSE;
355 llSay(channel,"master");
356 }
357 else if(message == "Start")
358 {
359 started = TRUE;
360 llSay(channel,"master");
361 if(moving)
362 return;
363
364 llSleep(llFrand(1.0));
365 startFlight();
366 }
367 else if(message == "Set Pos")
368 {
369 startPos = llGetPos();
370 startRot = llGetRot();
371 llOwnerSay("Position set");
372 }
373 }
374
375
377 {
378 llSay(channel,"master");
379 master = TRUE;
380
381 restart();
382 }
383
384
385 }
386
387
388
389
390
391
392
393
394

Gwenette

prim animator

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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
3
4 //You can now animate any object, with just one script!  Setup is very simple. Just drop the script and a blank notecard into the object, click the object, and give your animation a name.  Move all the prims around, and click Record. When done, click the Animation Name, and watch it play back every move!
5
6 // Downloaded from : http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1519
7
8 // This program is free software; you can redistribute it and/or modify it.
9 // Additional Licenes may apply that prevent you from selling this code
10 // and these licenses may require you to publish any changes you make on request.
11 //
12 // There are literally thousands of hours of work in these scripts. Please respect
13 // the creators wishes and follow their license requirements.
14 //
15 // Any License information included herein must be included in any script you give out or use.
16 // Licenses are included in the script or comments by the original author, in which case
17 // the authors license must be followed.
18
19 // A GNU license, if attached by the author, means the original code must be FREE.
20 // Modifications can be made and products sold with the scripts in them.
21 // You cannot attach a license to make this GNU License
22 // more or less restrictive. see http://www.gnu.org/copyleft/gpl.html
23
24 // Creative Commons licenses apply to all scripts from the Second Life
25 // wiki and script library and are Copyrighted by Linden Lab. See
26 // http://creativecommons.org/licenses/
27
28 // Please leave any author credits and headers intact in any script you use or publish.
29 // If you don't like these restrictions, then don't use these scripts.
30 //////////////////////// ORIGINAL AUTHORS CODE BEGINS ////////////////////////////////////////////
31 // One Script Prim Animation
32
33 // Original Script by: Ferd Frederix
34 // No Spam version by: Gino Rascon
35
36 integer runtime = TRUE; // set to TRUE after making the notecard
37
38 string NOTECARD = "Movement"; // the notecard for this script, you can add more than 1 script and notecard, just change this line to match
39 integer playchannel = 1; // the playback channel, this is the channel you use in LinkMessages
40
41
42 integer debug = FALSE; // if set to TRUE, debug info appears
43
44
45 // notecard reading
46 string priorname; // the prior animation name so we can spot differences as we read them in
47 integer iIndexLines; // lines in a card
48 integer inotecardIndex = 0; // notecard counter;
49 integer move = 0; // N movements rea from the notecard
50
51 key kNoteCardLines; // the key of the notecard
52 key kGetIndexLines; // the key of the current line
53
54 //communications
55 integer dialogchannel ; // dialog boxes
56
57 integer nPrims; // total number of prims
58 integer PrimsCounter = 0; // how many have checked in
59 integer timercounter = 0; // how many seconds have gone by
60 integer wantname; // flag indicating we are waiting for a name to be chatted
61
62
63 // the list of coords
64 list masterlist; // master list of all positions
65 list llastPrimList; // storage of the last prim position we learned
66 string curranimation; // what we are playing
67
68 integer STRIDE = 5; // size of the master list
69 integer lastSTRIDE = 4; // size of the last prim list
70
71 integer listener; // temp listener when we are waiting for them to give us a name
72
73 vector InitSize; // the initial size when the prims were recorded
74 list LoadedAnims; // animations read from the notecard added to the Menu display
75
76 // in case of hand editing, we wupe out extra stuff at end
77 string Getline(list Input, integer line)
78 {
79 return llStringTrim(llList2String(Input, line),STRING_TRIM);
80 }
81
82 Record()
83 {
84 if(llStringLength(curranimation) > 0)
85 {
86 integer foundmovement = 0; // will be set if any child moved
87 integer PrimCounter ; // skip past the root prim
88 for (PrimCounter =2; PrimCounter <= nPrims; PrimCounter++ )
89 {
90 list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]);
91 // position is always in region coordinates, even if the prim is a child or the root prim of an attachment.
92 // rot is always the global rotation, even if the prim is a child or the root prim of an attachment.
93
94 // get current prim pos, rot and size
95 vector vrealPrimPos = llList2Vector(my_list,0) - llGetPos(); // position subtract Global Pos
96 vrealPrimPos /= llGetRot();
97 rotation rrealPrimRot = llList2Rot(my_list,1) / llGetRot(); // rotation subtract Global Rot
98 vector vrealPrimSize = llList2Vector(my_list,2); // size
99
100 // compare it to the last one we had, stride of list is a 4, and it is already sorted
101 integer iindex = (PrimCounter - 2) * lastSTRIDE; // zeroth position is PrimCounter - start, or 2
102
103 // get the last thing we remembered about this prim
104 float fprimNum = llList2Integer(llastPrimList, iindex); // must be 0,1,2, in order
105 vector vlastPrimPos = llList2Vector(llastPrimList, iindex+1);
106 rotation rlastPrimRot = llList2Rot(llastPrimList, iindex+2);
107 vector vlastPrimSize = llList2Vector(llastPrimList, iindex+3);
108
109 // if anything changed on this prim, we must record it.
110 if(vlastPrimPos != vrealPrimPos ||
111 rlastPrimRot != rrealPrimRot ||
112 vlastPrimSize!= vrealPrimSize
113 )
114 {
115 foundmovement++;
116
117 // show owner any changes they mnade
118 if(debug)
119 {
120 llOwnerSay("prim:" + (string) PrimCounter);
121
122 if(vlastPrimPos != vrealPrimPos)
123 llOwnerSay("pos delta :" + (string) (vrealPrimPos - vlastPrimPos));
124
125 if(rlastPrimRot != rrealPrimRot)
126 llOwnerSay("rot delta:" + (string) (llRot2Euler(rrealPrimRot - rlastPrimRot) * RAD_TO_DEG));
127
128 if(vlastPrimSize != vrealPrimSize)
129 llOwnerSay("size delta:" + (string) (vrealPrimSize - vlastPrimSize));
130 }
131
132 //Save them in the master list of all animations
133 masterlist += curranimation;
134 masterlist += PrimCounter;
135 masterlist += vrealPrimPos;
136 masterlist += rrealPrimRot;
137 masterlist += vrealPrimSize;
138
139 // save them in the last movement list
140 integer saved = FALSE;
141 integer i;
142 integer imax = llGetListLength(llastPrimList);
143 // save the changes in the last prim list so we can keep our lists smaller
144 for ( i=0; i < imax; i += lastSTRIDE )
145 {
146 if(llList2Float(llastPrimList,i) == PrimCounter)
147 {
148 llastPrimList = llListReplaceList(llastPrimList,[vrealPrimPos],i+1,i+1);
149 llastPrimList = llListReplaceList(llastPrimList,[rrealPrimRot],i+2,i+2);
150 llastPrimList = llListReplaceList(llastPrimList,[vrealPrimSize],i+3,i+3);
151 if(debug) llOwnerSay("In history at position " + (string) (i/lastSTRIDE));
152 saved++;
153 }
154 }
155
156 // never moved before? add it then
157 if(! saved)
158 {
159 if(debug) llOwnerSay("Someone added a new prim and then clicked Record");
160 llastPrimList += PrimCounter;
161 llastPrimList += vrealPrimPos;
162 llastPrimList += rrealPrimRot;
163 llastPrimList += vrealPrimSize;
164 }
165 } // if
166 } // for
167 if(debug) llOwnerSay("history:" + llDumpList2String(llastPrimList,":"));
168
169 if(!foundmovement)
170 llOwnerSay("You must move at least one child prim.");
171 }
172 else
173 {
174 llOwnerSay("You must name your animation.");
175 llOwnerSay("Type the new animation name on channel /" + (string) dialogchannel);
176 wantname++;
177 }
178 }
179
180 // on reset, record the base position in history so we can see changes
181 Clear()
182 {
183 LoadedAnims = []; // wipe out Menu
184 masterlist = []; // wipe all recordings
185 llastPrimList = []; // wipe last animations
186 integer PrimCounter ; // skip 1, which is the root prim
187 integer counter = 0;
188 // save all the current settings in memory
189 for (PrimCounter=2; PrimCounter <= nPrims; PrimCounter++ )
190 {
191 list my_list = llGetLinkPrimitiveParams(PrimCounter,[PRIM_POSITION,PRIM_ROTATION, PRIM_SIZE ]);
192
193 // save the local pos and rot, since llGetLinkPrimitiveParams returns global pos and rot
194 vector primpos = llList2Vector(my_list,0) - llGetPos();
195 rotation primrot = llList2Rot(my_list,1) / llGetRot();
196 vector primsize = llList2Vector(my_list,2) ;
197
198 llastPrimList += PrimCounter;
199 llastPrimList += primpos;
200 llastPrimList += primrot;
201 llastPrimList += primsize;
202 counter++;
203 }
204 if(debug) llOwnerSay("Saved " + (string) counter + " prims initial position in history");
205 }
206
207 DumpBack ()
208 {
209 integer i;
210 integer imax = llGetListLength(masterlist);
211 integer howmany = imax / STRIDE ;
212 llOwnerSay((string) howmany + " movements recorded - copy these and paste them into the notecard");
213
214 integer flag = 0;
215 for (i = 0; i < imax; i+= STRIDE)
216 {
217 if( i == 0 )
218 llOwnerSay( "|start|" + (string) llGetScale());
219
220 string saniName = llList2String(masterlist,i);
221 curranimation = saniName;
222
223 float fprimNum = llList2Integer(masterlist, i+1);
224 integer iprimNum = (integer) fprimNum;
225 vector vprimPos = llList2Vector(masterlist, i+2);
226 rotation rprimRot = llList2Rot(masterlist, i+3) ;
227 vector vprimSize = llList2Vector(masterlist, i+4);
228
229 llOwnerSay("|"+ saniName + "|" + (string) iprimNum + "|" + (string) vprimPos + "|" + (string) rprimRot + "|" + (string) vprimSize );
230 flag++;
231 }
232 if(! flag)
233 llOwnerSay("No recording was made, nothing to play back." );
234 }
235
236
237 rotation calcChildRot(rotation rdeltaRot)
238 {
239
241 return rdeltaRot/llGetLocalRot();
242 else
243 return rdeltaRot/llGetRootRotation();
244
245 }
246
247
248 PlayBack (string name)
249 {
250 integer i;
251 integer imax = llGetListLength(masterlist);
252
253 integer linknum = 0;
254
255 for (i = 0; i < imax; i+= STRIDE)
256 {
257 string saniName = llList2String(masterlist,i);
258 if(saniName == name)
259 {
260 float fprimNum = llList2Float(masterlist,i+1);
261 vector vPos = llList2Vector(masterlist,i+2);
262 rotation rRot = llList2Rot(masterlist,i+3) ;
263 vector vprimSize = llList2Vector(masterlist,i+4) ;
264
265 vector scale = llGetScale();
266 float delta = scale.x / InitSize.x ; // see if the root prim has grown or shrunk as a percentage
267
268 vPos *= delta; // add any difference in size to it positions there
269 vprimSize *= delta; // grow the child prim, too
270
271
272 // support negative prim numbers as a delay
273 if(fprimNum < 0)
274 {
275 if(debug) llOwnerSay("Sleeping " + (string) (fprimNum * -1));
276 llSleep((float) fprimNum * -1);
277 }
278 else
279 {
280 if(fprimNum > 1 )
281 {
282 // set the local pos and locat rot to the prims orientation and position
283 rRot = calcChildRot(rRot);
284
285 list actions = [PRIM_POSITION,vPos,PRIM_ROTATION,rRot,PRIM_SIZE,vprimSize];
286 if(debug) llOwnerSay("Moving prim :" + (string) fprimNum + ":" + llDumpList2String(actions,":"));
287
288 llSetLinkPrimitiveParamsFast((integer) fprimNum,actions);
289 }
290 }
291 }
292 }
293 }
294
295 MakeMenu()
296 {
297 list amenu = ["Reset","Record","Help","Name","Notecard","Pause"] + LoadedAnims;
298
299 llListenRemove(listener);
300 listener = llListen(dialogchannel,"","","");
301
302 amenu = llDeleteSubList(amenu,12,99);
303
304 llDialog(llGetOwner(), "Pick a command",amenu,dialogchannel);
305 }
306
307
308
309 default
310 {
312 {
313 InitSize = llGetScale(); // save the size when we recorded the prims
314 nPrims = llGetNumberOfPrims(); // how many we are recording
315 if(debug) llOwnerSay(" Total Prims = " + (string) nPrims);
316 Clear();
317
319
320 if(llStringLength(notecardname) > 0)
321 {
322 kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD);
323 kGetIndexLines = llGetNotecardLine(NOTECARD,0);
324 }
325 else
326 {
327 llOwnerSay("If you add a notecard, you can save your animations permanently in a notecard named " + NOTECARD);
328 }
329 dialogchannel = (integer) (llFrand(100) +600);
330
331 }
332
333 // read notecard on bootup
334 dataserver(key queryid, string data)
335 {
336 if(queryid == kNoteCardLines)
337 {
338 iIndexLines = (integer) data;
339 }
340
341 if(queryid == kGetIndexLines)
342 {
343 if(data != EOF)
344 {
345 queryid = llGetNotecardLine(NOTECARD, inotecardIndex);
346 list lLine = (llParseString2List(data, ["|"], []));
347
348 string junk = llList2String(lLine,0);
349 string aniname = llList2String(lLine,1);
350 string aNum = (string) Getline(lLine,2);
351
352 // check for the prim size,and save it, the fiorst line will look like this:
353 // [18:06] prim position 1.2: |start|<1.02306, 1.02306, 1.02306>
354
355 if(inotecardIndex == 0 && aniname == "start")
356 {
357 InitSize = (vector) aNum;
358 }
359 else if(inotecardIndex == 0 && aniname != "start")
360 {
361 llOwnerSay("The notecard " + NOTECARD + " is incorrect, it must begin with 'start|<x,y,z>' with the size of the original prim");
362 }
363 else
364 {
365
366 float Num = (float) aNum;
367
368 vector vPos = (vector) Getline(lLine,3); // global for calcChild()
369 rotation rRot = (rotation) Getline(lLine,4); // global for calcChild()
370 vector Size = (vector) Getline(lLine,5);
371
372 vector scale = llGetScale();
373 float delta = scale.x / InitSize.x ; // see if the root prim has grown or shrunk as a percentage
374
375
376 if(aniname != priorname)
377 {
378 llOwnerSay("Loading animation " + aniname);
379 priorname = aniname;
380 LoadedAnims += aniname;
381 }
382
383 if(Num != 1) // skip root prim
384 {
385 masterlist += [aniname];
386 masterlist += [Num];
387 masterlist += [vPos];
388 masterlist += [rRot];
389 masterlist += [Size];
390
391 if(Num > 1) // not the pauses
392 {
393 rRot = calcChildRot(rRot);
394 vPos *= delta; // add any difference in size to it positions there
395 Size *= delta; // grow the child prim, too
396
397 llSetLinkPrimitiveParamsFast((integer) Num,[PRIM_POSITION,vPos,PRIM_ROTATION,rRot,PRIM_SIZE,Size]);
398 move++;
399 }
400
401 }
402 }
403 inotecardIndex++;
404 integer InitPerCent = (integer) llRound(( (inotecardIndex+1) / (float) iIndexLines) * 100);
405 llSetText("Initialising... \n" + (string) InitPerCent + "%" , <1,1,1>, 1.0);
406 if(InitPerCent >= 100)
407 llSetText("" , <1,1,1>, 1.0);
408 kGetIndexLines = llGetNotecardLine(NOTECARD,inotecardIndex);
409
410 }
411 else
412 {
413 llOwnerSay("initialized with " + (string) move + " movements");
414 llSetText("" , <1,1,1>, 1.0);
415 }
416 }
417 }
418
419
420 touch_start(integer total_number)
421 {
422 if(llDetectedKey(0) == llGetOwner() && ! runtime)
423 {
424 MakeMenu();
425 }
426
427 // add any control code here
428 // example:
429 // llMessageLinked(LINK_SET,playchannel,"All",""); // will play Animation named "All"
430
431 }
432
433 listen( integer channel, string name, key id, string message )
434 {
435
436 if(channel == dialogchannel)
437 {
438 if(message == "Reset")
439 {
440 Clear();
441 if(debug) llOwnerSay("Reset = " + llDumpList2String(llastPrimList,":"));
442 MakeMenu();
443 }
444 else if(message =="Pause")
445 {
446 masterlist += curranimation;
447 masterlist += -1;
448 masterlist += <0,0,0>; // pos
449 masterlist += <0,0,0,1>;// rot
450 masterlist += <0,0,0>; // size
451 MakeMenu();
452 }
453 else if(message == "Record")
454 {
455 Record();
456
457 MakeMenu();
458 }
459 else if(message == "Name")
460 {
461 llOwnerSay("Type the current animation name on channel /" + (string) dialogchannel);
462 wantname++;
463 MakeMenu();
464 }
465 else if(message =="Menu")
466 {
467 MakeMenu();
468 }
469 else if(message == "Notecard")
470 {
471 DumpBack();
472 MakeMenu();
473 }
474 else if(message == "Help")
475 {
476 llLoadURL(llGetOwner(),"View online help", "http://secondlife.mitsi.com/secondlife/Posts/Prim-Animator");
477 }
478 else if(wantname)
479 {
480 curranimation = message;
481
482 LoadedAnims += message;
483
484 MakeMenu();
485 llOwnerSay("Recording is ready for animation '" + curranimation + "'");
486 llOwnerSay("Position all child prims, then select the Menu item 'Record', and repeat as necessary. When finished, click 'PlayBack' to play back the animation, or click the animation name. Click 'Name' to start a new animation sequence");
487 wantname = 0;
488 PrimsCounter = 0;
489 timercounter = 0;
490 llSetTimerEvent(1.0);
491 }
492 else
493 {
494 if(llListFindList(LoadedAnims,[message]) != -1)
495 {
496 PlayBack(message);
497 MakeMenu();
498 }
499 }
500
501
502 }
503 }
504
505
506
507 link_message(integer sender_num, integer num, string message, key id)
508 {
509 if(num == playchannel)
510 {
511 if(debug) llOwnerSay("playback animation " + message);
512 PlayBack(message);
513 }
514 }
515
516
517
518
519 }

Gwenette

test

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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 integer counter;
3
4 default
5 {
6
8 {
9
10 }
11
13 {
14 llMessageLinked(LINK_SET,0,"fly","");
16 }
17
18
19 timer()
20 {
21 llMessageLinked(LINK_SET,0,"flapup","");
22 llSleep(1);
23 llMessageLinked(LINK_SET,0,"flapdown","");
24
25 if(counter++ > 5) {
26 llMessageLinked(LINK_SET,0,"land","");
28 }
29
30 }
31
32
33 }

Gwenette

Notecard for the bird route

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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 : |0|<0.00000, -1.24699, 0.84260>|<0.00000, 0.00000, 0.00000, 1.00000>
2 : |1|<0.08361, -0.69025, 0.01135>|<-0.04793, -0.17709, -0.41566, 0.89083>
3 : |2|<-1.23370, -0.34850, 0.36846>|<-0.16412, -0.02857, -0.43067, 0.88700>
4 : |3|<-1.42419, 0.47388, 0.40915>|<-0.15303, -0.02663, -0.40154, 0.90257>
5 : |4|<-0.03326, 1.41461, 0.41585>|<0.14456, 0.02515, 0.37936, -0.91354>
6 : |5|<0.53952, 1.64468, 0.20764>|<-0.05868, -0.01019, -0.15393, 0.98629>
7 : |6|<1.57553, 1.62582, 0.15324>|<-0.19877, -0.03456, -0.52154, 0.82903>
8 : |7|<1.16501, -0.47020, 0.53946>|<-0.20071, -0.20161, -0.19036, 0.93959>
9 : |8|<0.78075, -0.79489, 0.35505>|<-0.18907, 0.24230, -0.21587, 0.92679>
10 : |9|<0.69041, -1.36583, 0.78107>|<0.00000, 0.00000, 0.00000, 1.00000>
11 : |10|<0.15798, -2.13773, 0.46152>|<-0.06539, 0.18235, -0.03351, 0.98049>
12 : |11|<0.31504, -2.97763, 1.00293>|<0.10293, 0.06504, -0.16103, 0.97941>
13 : |12|<0.11244, -1.12279, 0.30347>|<0.06477, -0.25050, -0.14256, 0.95537>
14 : |13|<-1.07137, -0.72195, 0.44894>|<-0.14474, -0.03393, -0.30805, 0.93968>
15 : |14|<-0.97548, -0.38579, 0.00000>|<-0.09880, -0.02316, -0.21026, 0.97237>
16 : |15|<-1.33490, -0.00536, 0.24338>|<-0.05889, -0.01382, -0.12537, 0.99026>
17 : |16|<-1.04804, 0.01944, 0.04413>|<0.01160, -0.16601, -0.27851, 0.94591>
18 : |17|<-0.74387, 1.08505, -0.23370>|<0.02795, 0.15389, -0.26856, 0.95048>
19 : |18|<-0.18124, 0.81171, 0.00000>|<0.00066, 0.01614, 0.02056, 0.99966>
20 : |19|<-1.45926, 3.84450, -1.60544>|<0.00385, 0.09659, 0.12301, -0.98769>
21 : |20|<0.17680, 2.01257, -0.41652>|<-0.18196, -0.11330, -0.07660, 0.97375>
22 : |21|<0.39259, 1.37759, 0.23296>|<0.02562, -0.16916, -0.09528, 0.98064>
23 : |22|<1.97547, 1.67798, -0.15705>|<-0.10031, -0.10549, -0.21401, 0.96592>
24 : |23|<0.01665, 0.04193, 0.00000>|<-0.06730, -0.07076, -0.14359, 0.98481>
25 : |24|<1.46920, 0.26268, 0.00000>|<0.00000, 0.00000, 0.00000, 1.00000>
26 : |25|<1.70033, -0.24384, 0.00000>|<-0.11331, -0.11914, -0.24176, 0.95631>
27 : |26|<1.70462, -2.80653, -0.69473>|<-0.12709, -0.02618, -0.53444, 0.83519>
28 : |27|<0.07200, -1.71495, -0.43633>|<0.04628, -0.15628, -0.08589, 0.98288>
29 : |28|<-0.35403, -0.81065, -0.07504>|<-0.02655, -0.07096, -0.13688, 0.98769>
30 : |29|<-1.00322, -1.69304, 0.19937>|<-0.04676, -0.12502, -0.24118, 0.96126>
31 : |30|<-1.86394, -0.49165, 0.00000>|<-0.04536, -0.12121, -0.23388, 0.96361>
32 : |31|<-1.78540, 0.33679, 0.00000>|<-0.04961, -0.13259, -0.25584, 0.95630>
33 : |32|<-0.95681, 1.32210, -0.05853>|<0.07305, 0.19524, 0.37671, -0.90257>
34 : |33|<-0.13725, 1.98795, -0.59022>|<-0.02012, 0.07687, -0.03589, 0.99619>
35 : |34|<0.33107, 1.43611, 0.32743>|<0.00000, 0.00000, 0.00000, 1.00000>
36 : |35|<0.33054, 1.56149, -0.00922>|<-0.11602, -0.26043, -0.30529, 0.90858>
37 : |36|<1.00977, 0.46696, 0.00303>|<-0.07612, -0.09844, -0.30133, 0.94537>
38 : |37|<0.91977, -0.22517, -0.40467>|<-0.20975, -0.23960, -0.67789, 0.66262>
39 : |38|<0.12777, -0.53047, -0.12495>|<0.11082, 0.19371, -0.07220, 0.97210>

Gwenette

Movement notecard with coordinates for the child prims.

Category: Egret
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
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 notecard

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