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
Easy Animator Easy_Animal_Animator_script_for_mul  

Easy_Animal_Animator_script_for_mul

These scripts are licensed under the GPL and are not to be sold. Objects created with them may be under any license. This script is open source and is not for sale. This first script is the child prim script. Any prims you want to move must have one of these scripts. Instructions are online ain my Blue Whale Project at http://secondlife.mitsi.com/Secondlife/Code/fish/

Category: Easy Animator
By : Ferd Frederix
Created: 2010-06-01 Edited: 2010-06-01
Worlds: Second Life

the Zip file

Download all files for Easy_Animal_Animator_script_for_mul
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Easy_Animal_Animator_script_for_mul_1.lsl
Get file # 2. Easy_Animal_Animator_script_for_mul_2.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, GPL license.
2 // Do not remove the header, do not sell this script.
3 // ______ _ ______ _ _
4 // | ___| | | | ___| | | (_)
5 // | |_ ___ _ __ __| | | |_ _ __ ___ __| | ___ _ __ ___ __
6 // | _/ _ \ '__/ _` | | _| '__/ _ \/ _` |/ _ \ '__| \ \/ /
7 // | || __/ | | (_| | | | | | | __/ (_| | __/ | | |> <
8 // \_| \___|_| \__,_| \_| |_| \___|\__,_|\___|_| |_/_/\_\
9 //
10 // author Ferd Frederix
11
12 // Prim positioner child script.
13 // Put a copy of this script in any prim you wish to move
14
15 integer debug = 0;
16 integer linkchannel = 5001; // for recording purposes
17 vector vLastpos;
18 rotation rLastrot;
19
20 default
21 {
23 {
25 }
26
27 // accept messages from the main script
28 link_message(integer sender_num, integer num, string msg, key id)
29 {
30 if(msg == "Set") // SEt records the current prim rot and pos.
31 {
32 llSleep(llFrand(3.0));
33 vector vPos = llGetLocalPos();
34 rotation rRot = llGetLocalRot();
35
36 if(vPos != vLastpos || rRot != rLastrot)
37 llMessageLinked(LINK_ROOT, linkchannel, (string) vPos + "|" + (string) rRot, "");
38
39 vLastpos = vPos;
40 rLastrot = rRot;
41 }
42 else if(msg == "Remove") // deletes the script from the child to help with lag
43 {
44 if(debug)
46 else
48 }
49 else if(msg == "Reset") // set the coords to some rare value so the prim will have been seen to have moved
50 {
51 vLastpos = <0,0,0>;
52 rLastrot = <0,0,0,1>;
53 }
54 else if(msg == "All") // dump the current pos and rot to the server
55 {
56 vector vPos = llGetLocalPos();
57 rotation rRot = llGetLocalRot();
58 llSleep(llFrand(3.0));
59 llMessageLinked(LINK_ROOT, linkchannel, (string) vPos + "|" + (string) rRot, "");
60 }
61 }
62 }

Easy_Animal_Animator_script_for_mul

Put this script in the root prim. Touch the prim. Click the Name button and type in a name for the animation. Position each prim and click Record. Repeat.

You can click Name at any time to create another animation. Repeat.

Each animation will appear by name in the menu. Click the name to playback. The Playback button will play back the current animation.

When finished, Click DUMP. Copy and paste the chat into a notecard named "Movement". Reset the script, and it wi9ll load the notecard and animate all prims.

When you are satisfied with the results, click "Remove" to delete all child prim scripts.

Send a link message from any script with the name of the animation in it's text field to the channel 5001. The script will play back that animation.

Category: Easy Animator
By : Ferd Frederix
Created: 2010-06-01 Edited: 2010-06-01
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 // Open source, GPL license.
2 // Do not remove the header, do not sell this script.
3 // ______ _ ______ _ _
4 // | ___| | | | ___| | | (_)
5 // | |_ ___ _ __ __| | | |_ _ __ ___ __| | ___ _ __ ___ __
6 // | _/ _ \ '__/ _` | | _| '__/ _ \/ _` |/ _ \ '__| \ \/ /
7 // | || __/ | | (_| | | | | | | __/ (_| | __/ | | |> <
8 // \_| \___|_| \__,_| \_| |_| \___|\__,_|\___|_| |_/_/\_\
9 //
10 // author Ferd Frederix
11
12 // Prim position root script
13 // Put this script in the root prim. Put the child script in all prims you wish to move.
14 // touch the script to start recording
15
16 // Reset - wipe out all recording.
17 // Name - name a new recording
18 // Pause - insert a 1 second pause
19 // PlayBack - play back the current animation
20 // RemoveAll - removel all child scripts
21 // Record - store a new set of child prim positions
22 //
23
24
25 integer debug = 0;
26
27
28 // notecard reading
29 integer iIndexLines;
30 integer i = 0;
31 integer move = 0; // N movements rea from the notecard
32 string NOTECARD = "Movement"; // the notecard
33 key kNoteCardLines; // the key of the notecard
34 key kGetIndexLines; // the key of the current line
35
36 //communications
37 integer linkchannel = 5001; // for recording purposes
38 integer dialogchannel ; // dialog boxes
39 integer playchannel = 50003; // the playback channel
40 integer nPrims; // total number of prims
41 integer PrimsCounter = 0; // how many have checked in
42 integer timercounter = 0; // how many seconds have gone by
43 integer wantname; // flag indicating we are waiting for a name to be chatted
44
45 integer pplcounter =0;
46
47 // last heard prim params
48
49 vector primpos;
50 rotation primrot;
51
52 // the list of coords
53 list masterlist;
54
55 string curranimation;
56
57 list Menu;
58
59 integer STRIDE = 6;
60 integer Runtime; // flag that we are in running mode vs learning mode
61
62 string strip( string str)
63 {
64 return llStringTrim(str, STRING_TRIM);
65 }
66 string Getline(list Input, integer line)
67 {
68 return strip(llList2String(Input, line));
69 }
70 DumpBack ()
71 {
72 integer i;
73 integer max = llGetListLength(masterlist);
74 integer flag = 0;
75 for (i = 0; i < max; i+= STRIDE)
76 {
77 string aniname2 = llList2String(masterlist,i);
78 curranimation = aniname2;
79
80 integer primnum2 = llList2Integer(masterlist,i+1);
81 vector sprimpos2 = llList2Vector(masterlist,i+2);
82 rotation sprimrot2 = llList2Rot(masterlist,i+3) ;
83
84
85 //if(debug) llOwnerSay("aniname:"+ aniname2 + " num:" +(string) primnum2 + " pos:" + (string) sprimpos2 + " rot:" + (string) sprimrot2);
86 llOwnerSay("|"+ aniname2 + "|" + (string) primnum2 + "|" + (string) sprimpos2 + "|" + (string) sprimrot2);
87 flag++;
88 }
89 if(! flag)
90 llOwnerSay("No recording!" );
91 }
92
93
94 PlayBack (string name)
95 {
96 integer i;
97 integer max = llGetListLength(masterlist);
98
99 integer linknum = 0;
100
101 for (i = 0; i < max; i+= STRIDE)
102 {
103 string aniname2 = llList2String(masterlist,i);
104 if(aniname2 == name)
105 {
106 integer primnum2 = llList2Integer(masterlist,i+1);
107 vector sprimpos2 = llList2Vector(masterlist,i+2);
108 rotation sprimrot2 = llList2Rot(masterlist,i+3) ;
109 string msg = llList2String(masterlist,i+4);
110 string UUID = llList2String(masterlist,i+5);
111 if(llStringLength(msg) > 0)
112 llSay(0,msg);
113 if(llStringLength(UUID) > 0)
114 llPlaySound(UUID,1.0);
115
116 if(primnum2 < 0)
117 {
118 llSleep(.5);
119 }
120 else
121 {
122 sprimrot2 /= llGetRot(); // Add in the local rot
123 //if(debug) llOwnerSay("|"+ aniname2 + " num:" +(string) primnum2 + " pos:" + (string) sprimpos2 + " rot:" + (string) sprimrot2);
124
125 if(primnum2 !=0)
126 llSetLinkPrimitiveParamsFast(primnum2,[PRIM_POSITION,sprimpos2,PRIM_ROTATION,sprimrot2]);
127
128
129 }
130 //llOwnerSay((string) primnum2);
131 }
132
133 }
134 }
135 MakeMenu()
136 {
137 list amenu = ["Reset","Record","PlayBack","Name","Dump","RemoveAll","Pause"];
138 amenu += Menu;
139 llDialog(llGetOwner(), "Pick a command",amenu,dialogchannel);
140 }
141 default
142 {
144 {
145
146 nPrims = llGetNumberOfPrims();
147 llOwnerSay(" Total Prims = " + (string) nPrims);
148
149 kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD);
150 kGetIndexLines = llGetNotecardLine(NOTECARD,0);
151 dialogchannel = (integer) (llFrand(100) +600);
152 llListen(dialogchannel,"","","");
153 llMessageLinked(LINK_SET,0,"Reset","");
154 }
155
156 // read notecard on bootup
157 dataserver(key queryid, string data)
158 {
159
160 if(queryid == kNoteCardLines)
161 {
162 iIndexLines = (integer) data;
163 }
164
165 if(queryid == kGetIndexLines)
166 {
167 if(data != EOF)
168 {
169
170 //if(debug) llOwnerSay("Line");
171
172 queryid = llGetNotecardLine(NOTECARD, i);
173 list lLine = (llParseString2List(data, ["|"], []));
174 // if(_debug ) llOwnerSay("Line = " + llDumpList2String(lLine,":"));
175 string junk = llList2String(lLine,0);
176 string aniname = llList2String(lLine,1);
177 integer Num = (integer)Getline(lLine,2);
178 vector Pos = (vector) Getline(lLine,3);
179 rotation Rot = (rotation) Getline(lLine,4);
180 string msg = llList2String(lLine,5);
181 string UUID = llList2String(lLine,6);
182
183
184 if(Num>=0)
185 {
186 if(llStringLength(msg) > 0)
187 llSay(0,msg);
188 if(llStringLength(UUID) > 0)
189 llPlaySound(UUID,1.0);
190
191 masterlist += [aniname];
192 masterlist += [Num];
193 masterlist += [Pos];
194 masterlist += [Rot];
195 masterlist += [msg];
196 masterlist += [UUID];
197 Rot /= llGetRot();
198
199
200 llSetLinkPrimitiveParamsFast(Num,[PRIM_POSITION,Pos,PRIM_ROTATION,Rot]);
201 move++;
202
203 }
204 i++;
205 integer InitPerCent = (integer) llRound(( (i+1) / (float) iIndexLines) * 100);
206 llSetText("Initialising... \n" + (string) InitPerCent + "%" , <1,1,1>, 1.0);
207 if(InitPerCent == 100)
208 llSetText("" , <1,1,1>, 1.0);
209 kGetIndexLines = llGetNotecardLine(NOTECARD,i);
210 }
211 else
212 {
213 llOwnerSay("initialized with " + (string) move + " movements");
214 llSetText("" , <1,1,1>, 1.0);
215 llMessageLinked(LINK_THIS, playchannel, "bird", "");
216 }
217
218
219 }
220 }
221
222
223 touch_start(integer total_number)
224 {
225 if(! Runtime && llDetectedKey(0) == llGetOwner())
226 {
227 MakeMenu();
228 }
229 }
230
231 listen( integer channel, string name, key id, string message )
232 {
233
234 if(channel == dialogchannel)
235 {
236 if(message == "Reset")
237 {
238 masterlist = [];
239 MakeMenu();
240 }
241 else if(message =="Pause")
242 {
243 masterlist += [curranimation];
244 masterlist += [-1];
245 masterlist += [<0,0,0>];
246 masterlist += [<0,0,1>];
247 masterlist += ["Pause"];
248 masterlist += [""];
249 MakeMenu();
250 }
251 else if(message == "RemoveAll")
252 {
253 llMessageLinked(LINK_SET,0,"Remove","");
254 Runtime++;
255 }
256 else if(message == "Record")
257 {
258 PrimsCounter = 0;
259 timercounter = 0;
260 llSetTimerEvent(1.0);
261 llMessageLinked(LINK_SET,0,"Set","");
262 MakeMenu();
263 }
264 else if(message == "Name")
265 {
266 llOwnerSay("Type the current animation name on channel /" + (string) dialogchannel);
267 wantname++;
268 MakeMenu();
269 }
270 else if(message == "PlayBack")
271 {
272 PlayBack(curranimation);
273 MakeMenu();
274 }
275 else if(message == "Dump")
276 {
277 DumpBack();
278 MakeMenu();
279 }
280 else if(wantname)
281 {
282 curranimation = message;
283 MakeMenu();
284 Menu += [message];
285 llOwnerSay("Recording is ready for animation '" + curranimation + "'");
286 llOwnerSay("Position all child prims, then select the Menu item 'Record'. When finished, click 'PlayBack' to play back the animation, or click 'Name' to record a new animation, or click 'RemoveAll' to finish and shut down all child scripts");
287 wantname = 0;
288 PrimsCounter = 0;
289 llMessageLinked(LINK_SET,0,"All","");
290 timercounter = 0;
291 llSetTimerEvent(1.0);
292
293 }
294 else
295 {
296 if(debug) llOwnerSay("Possible Animations:" + llDumpList2String(Menu,","));
297 if(llListFindList(Menu,[message]) > -1)
298 {
299 //if(debug) llOwnerSay("Playing back animation " + message);
300 PlayBack(message);
301 }
302 }
303
304 }
305 }
306
307 on_rez(integer param)
308 {
309 llListen(dialogchannel,"","","");
310 }
311
312 link_message(integer sender_num, integer num, string message, key id)
313 {
314
315
316 //llOwnerSay((string) sender_num);
317 if(num == 1) // They sat
318 {
319 if(debug) llOwnerSay(message);
320 if(message == "R1" || message == "L1")
321 {
322 pplcounter++;
323 llMessageLinked(LINK_THIS, playchannel, "stand", "");
324 llSleep(0.5);
325 llMessageLinked(LINK_THIS, playchannel, "down", "");
326 }
327
328 if(message == "L0"|| message == "R0")
329 {
330 pplcounter--;
331 }
332 if(pplcounter < 0)
333 {
334 llMessageLinked(LINK_THIS, playchannel, "stand", "");
335 llSleep(1.0);
336 llMessageLinked(LINK_THIS, playchannel, "bird", "");
337 pplcounter = 0;
338 }
339 }
340
341 else if(num == playchannel)
342 {
343 if(debug) llOwnerSay("playback animation " + message);
344 PlayBack(message);
345 }
346
347 else if(num == linkchannel)
348 {
349 PrimsCounter++;
350 //if(debug) llOwnerSay("link message :" + message);
351 list my_list = llParseString2List(message,["|"],[""]);
352 if(debug) llOwnerSay(llDumpList2String(my_list,","));
353
354 string sprimpos = llList2String(my_list,0);
355 string sprimrot = llList2String(my_list,1);
356 primpos = (vector) sprimpos;
357 primrot = (rotation) sprimrot;
358 if(llStringLength(curranimation) > 0)
359 {
360
361 //if(debug) llOwnerSay("Adding ani:"+ curranimation + " num:" +(string) sender_num + " pos:" + (string) primpos + " rot:" + (string) primrot);
362 masterlist += curranimation;
363 masterlist += sender_num;
364 masterlist += primpos;
365 masterlist += primrot;
366 masterlist += ""; // sounds
367 masterlist += "";
368 integer count = llGetListLength(masterlist) / STRIDE;
369 //llOwnerSay("Recorded " + (string) count + " coords");
370 }
371
372 }
373 }
374
375
376 timer()
377 {
378 integer left = nPrims - PrimsCounter; // how many left to report in
379 if(left)
380 llOwnerSay((string) left + " remaining of " + (string) nPrims);
381 else
382 {
383 llSetTimerEvent(0.0);
384 llOwnerSay("Ready");
385 }
386
387 if(timercounter++ > 10)
388 {
389 timercounter = 0;
390 PrimsCounter = 0;
391 llOwnerSay("Giving up");
393 }
394 }
395
396 }

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