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
Blue Whale BlueWhale  

BlueWhale

pose ball

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

the Zip file

Download all files for BlueWhale
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Movement.txt
Get file # 2. new.lsl
Get file # 3. Pose Ball.lsl
Get file # 4. prim position child script.lsl
Get file # 5. Prim teaching script.lsl
Get file # 6. spout script.lsl
Get file # 7. water splash scriptt.lsl
Get file # 8. Whale global movement script.lsl
Get file # 9. Whale prim Movement script.lsl

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

1
2 // pose ball script
3 // position to sit on the ball e.g <0.0, 0.0, 0.1>
4 // sit 0.1 meter above the ball.
5 // NOTE: if all these are 0, then the sit location is removed
6
7 // position to sit on the ball e.g <0.0, 0.0, 0.43>
8 // sit 0.5 meter above the ball
9 vector POSITION=<0.0, 0.0, 0.1>;
10
11 // hovertext above ball. "" for none.
12 // add '\n ' at the end to move text up i.e.
13 // string HOVERTEXT="Sit Here\n ";
14 string HOVERTEXT="";
15
16 // Pie Menu Sit Text. Will only work for the
17 // main prim but included it anyway. If no text
18 // is entered between "" it won't be used.
19 string SIT_TEXT="";
20
21
22
23
24
25 list rgb;
26 string animation;
27 integer listener;
28 default
29 {
31 {
32
33 if(llStringLength(SIT_TEXT)>0)
34 llSetSitText(SIT_TEXT);
35 llSitTarget(POSITION, ZERO_ROTATION);
36
37
38 }
39
41 {
43 }
44
45
46 changed(integer change)
47 {
48 if(change & CHANGED_LINK)
49 {
50
52 {
54 }
55 else
56 {
58 if((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(animation)>0)
59 llStopAnimation(animation);
60
61 animation="";
62 }
63 }
64 }
66 {
68 {
69 llStopAnimation("sit");
71 llStartAnimation(animation);
72 }
73
75 {
76 llClearCameraParams(); // reset camera to default
78 CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
79 CAMERA_BEHINDNESS_ANGLE, 15.0, // (0 to 180) degrees
80 CAMERA_BEHINDNESS_LAG, 1.0, // (0 to 3) seconds
81 CAMERA_DISTANCE, 10.0, // ( 0.5 to 10) meters
82 CAMERA_FOCUS_LAG, 0.05 , // (0 to 3) seconds
83 CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
84 CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
85 PITCH" title="View Definition" class="tooltip">CAMERA_PITCH, 10.0, // (-45 to 80) degrees
86 CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds
87 CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
88 CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
89 CAMERA_FOCUS_OFFSET, <-2.0, 0.0, -3.0> // <-10,-10,-10> to <10,10,10> meters
90 ]);
91
92
93
94
95 }
96 }
97
98
99 }

BlueWhale

prim position child script

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

BlueWhale

learning script

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

BlueWhale

spout script

Category: Blue Whale
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 updateParticles()
4 {
6
11
15 PSYS_SRC_ACCEL, <0.0,0.0,-1.>,
16
19 PSYS_SRC_OMEGA, <0.,0.0,0.0>,
20
22
23 PSYS_PART_START_COLOR, <1,1,1>,
24 PSYS_PART_END_COLOR, <1,1,1>,
25
28
29 PSYS_PART_START_SCALE, <.08,.8,0>,
31
32 }
33
34 default
35 {
37 {
39
40 }
41 link_message(integer sender, integer num, string str, key id)
42 {
43 if(str == "on") {
44 updateParticles();
45
46 } else if(str == "off") {
47
49 }
50 }
51
52
53 }

BlueWhale

water splash

Category: Blue Whale
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 float maxsysage = 0.0;
3 float maxspeed = 0.3;
4 float minspeed = 0.15;
5 float burstrad = 0.0;
6 integer burstcount = 20;
7 float burstrate = 0.01;
8 float outangle = 0.075;
9 float inangle = 0;
10 vector omega = <0.0,0.0,0.0>;
11 float startalph = 0.75;
12 float endalph = 0.015;
13 vector startscale = <2.0,2.0,2.0>;
14 vector endscale = <4.0,4.0,4.0>;
15 float maxage = 1.7;
16 vector accel = <0.0, 0.0, 1.0>;
17 string texture = "";
18
19 vector pos;
20 vector vel;
21 vector up;
22 float ground = 0.0;
23 float water = 0.0;
24 float height = 0.0;
25 float occilation = 1.25;
26 float start_mult = 0.1;
27 float rad;
28 integer occilate = TRUE;
29 integer started = FALSE;
30
31 Particles(integer part_on)
32 {
33 maxage = 0.001;
34 if(!part_on) jump particles;
35 vel = llGetVel() * 0.2;
36 ground = llGround(vel);
37 water = llWater(vel);
38 if(ground < water) {
39 maxspeed = 2.5;
40 minspeed = 1.25;
41 occilation = 2.0;
42 endscale = <3.0,3.0,3.0>;
43 maxage = 2.0;
44 ground = water;
45 texture = "7f70a931-6300-8dbc-caca-8b09a9c2cf11";
46 } else {
47 maxspeed = 1.75;
48 minspeed = 0.875;
49 occilation = 1.25;
50 endscale = <4.0,4.0,4.0>;
51 maxage = 1.75;
52 texture = "Water Particle - Mist";
53 }
54 pos = llGetPos() + vel;
55 up = llRot2Up(llGetRot());
56 height = pos.z - ground - 0.5;
57 height += (1.0 - up.z) * height;
58 if(height < 6.0 && height > -1.0) {
59 rad = 1.5 + (occilate * occilation);
60 outangle = PI - llAtan2(rad, height);
61 inangle = outangle + 0.15;
62 burstrad = rad / llSin(outangle);
63 startalph = ((llFabs(height) / -8.57) + 0.8 - (!occilate * 0.15)) * start_mult;
64 endalph = ((llFabs(height) / -200.0) + 0.04) * start_mult;
65 maxsysage = 0.0;
66 part_on = TRUE;
67 } else {
68 maxsysage = 0.01;
69 part_on = FALSE;
70 }
71
72 @particles;
73 //llParticleSystem([]);
80 PSYS_SRC_PATTERN_ANGLE_CONE,
81 PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,
82 PSYS_PART_START_ALPHA, startalph,
83 PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,
84 PSYS_PART_END_ALPHA, endalph,
85 PSYS_PART_START_SCALE, startscale,
86 PSYS_PART_END_SCALE, endscale,
87 PSYS_PART_MAX_AGE, maxage,
88 PSYS_SRC_ACCEL, accel,
89 PSYS_SRC_TEXTURE, texture,
90 PSYS_SRC_BURST_RATE, burstrate,
91 PSYS_SRC_ANGLE_BEGIN, inangle,
92 PSYS_SRC_ANGLE_END, outangle,
93 PSYS_SRC_BURST_PART_COUNT, burstcount,
94 PSYS_SRC_BURST_RADIUS, burstrad,
97 PSYS_SRC_MAX_AGE, maxsysage,
98 PSYS_SRC_OMEGA, omega
99 ]);
100
101 if(!part_on) {
103 } else {
104 if(started) {
105 if(start_mult < 1.0) {
106 start_mult += 0.075;
107 }
108 } else {
109 if(start_mult > 0.0) {
110 start_mult -= 0.05;
111 } else {
112 llSetTimerEvent(0.0);
114 }
115 }
116 occilate = !occilate;
117 }
118 }
119
120 default
121 {
123 {
124
125 llSetTimerEvent(0.0);
126 Particles(FALSE);
127 }
128
130 {
131 started = TRUE;
132 start_mult = 0.1;
133 llSetTimerEvent(0.01);
134
135 }
136 link_message(integer sender, integer num, string str, key id)
137 {
138 if(str == "on") {
139 started = TRUE;
140 start_mult = 0.1;
141 llSetTimerEvent(0.01);
142 } else if(str == "off") {
143 started = FALSE;
145 Particles(FALSE);
146 }
147 }
148
149 timer()
150 {
151 Particles(TRUE);
152 }
153 }

BlueWhale

global move

Category: Blue Whale
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 integer running;
5
6 rotation myrot ;
7 integer up = FALSE;
8
9 string FWD_DIRECTION = "-y";
10
11 float INTERVAL = 0.4;
12
13 vector Destination;
14 float gTau;
15
16 float DAMPING = .4; // the damping rate we turn at
17 list coords = [<193.8728,92.04382,23.0>,
18 <171.5811,62.16372,23.0>,
19 <148.1316,61.04683,23.0>,
20 <131.8011,72.83285,23.0>,
21 <131.0652,93.61875,23.0>,
22 <144.7105,105.3626,23.0>,
23 <153.7658,76.02143,23.0>,
24 <156.0498,48.00506,23.0>,
25 <150.5392,30.20997,23.0>,
26 <132.014,23.05155,23.0>,
27 <101.8122,40.96667,23.0>,
28 <50.86587,108.4027,23.0>,
29 <52.58804,123.5606,23.0>,
30 <79.25145,161.9644,23.0>,
31 <107.1218,173.8963,23.0>,
32 <145.8562,178.8377,23.0>,
33 <178.8875,159.3154,23.0>,
34 <193.4482,147.1552,23.0>,
35 <196.4373,116.8217,23.0>
36 ];
37
38 integer swim = 0;
39 float calc (float i)
40 {
41 float val = llSin((i-20)*40 / PI) * 4;
42 return val;
43
44 }
45
46 run()
47 {
48
51 }
52
53 stop()
54 {
55
58 }
59 default
60 {
62 {
63 counter = 0;
64 Destination = llList2Vector(coords,counter);
65 // llOwnerSay((string) Destination);
66 llSetStatus(STATUS_PHANTOM, TRUE);
68 llSetAlpha( 1.0, ALL_SIDES);
69 gTau = 10.0;
70
72
73 }
74
75
76 timer()
77 {
78
79 vector newdest = (llVecNorm(Destination - llGetPos()) * 3) + llGetPos();
80 swim++ ;
81 if(swim == 20)
83
84
85 if(swim == 27)
87
88
89 if(swim == 35)
91
92
93 if(swim > 37)
95
96 if(swim > 20 && swim < 40)
97 newdest.z = calc((float) swim) + 20;
98 else
99 newdest.z = 20;
100
101
102 llLookAt(newdest, 1, 1.);
103
104
105
106
107 if(swim == 80)
108 {
109 swim = 0;
110 }
111
112
113 float dist = llVecDist(Destination,llGetPos());
114
115
116
117
118 if(dist > 5.0)
119 llMoveToTarget(newdest, DAMPING);
120 else
121 {
122 llMoveToTarget(newdest, DAMPING);
123 counter++;
124 if(counter >= llGetListLength(coords))
125 counter = 0;
126
127 Destination = llList2Vector(coords,counter);
128
129 //llMoveToTarget(Destination, DAMPING);
130
131 // llOwnerSay((string) Destination);
132 }
133
134
135 }
136
138 {
139 key x = llDetectedKey(0);
140
141 if(x == llGetOwner())
142 {
143 if(running)
144 {
145 llOwnerSay("Orca stopped");
146 running = FALSE;
147 llSetAlpha( 1.0, ALL_SIDES);
148 stop();
149 llSetTimerEvent(0.0);
151 }
152 else
153 {
154 llOwnerSay("Orca running");
155 myrot = llGetRot();
156 llSetAlpha( 0.0, ALL_SIDES);
157 running = TRUE;
158 llSetTimerEvent(INTERVAL);
161 run();
162 }
163
164 }
165
166
167 }
168
169
171 {
173 }
174
175 }

BlueWhale

prim mover

Category: Blue Whale
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 // User settable parameters:
4 float FLIPTIME = 1.5; // how often the tail moves, floating point.
5 string NOTECARD = "Movement"; // the notecard name, you can add any nuimber of Notecards and eitherchange this to play them, or rename one of them to this string
6
7 // global variables below - no need to modify
8
9 // These are for notecard reading
10 integer iIndexLines;
11 integer i = 0;
12 integer iMove; // N movements rea from the notecard
13 key kNoteCardLines; // the key of the notecard
14 key kGetIndexLines; // the key of the current line
15
16 // misc
17 list masterlist; // the list of coords, filled in by a notecard reader
18 integer tailcounter = 0; // this counter flips the tail up and down
19 integer STRIDE = 6; // the list we record contains 6 pieces of info
20
21 // subroutine to remove any white space before or after a string
22 string strip(string str)
23 {
24 return llStringTrim(str, STRING_TRIM);
25 }
26
27 // subroutine to get a line at index 'line' from list Input, and strip white space b4 or after
28 string Getline(list Input, integer line)
29 {
30 return strip(llList2String(Input, line));
31 }
32
33 // subroutine to Play Back a named animation
34 PlayBack (string name)
35 {
36 integer i;
37 integer iMax = llGetListLength(masterlist); // how many are in the list? we need this to know when to stop
38 // scan the entire array for the named animation
39 for (i = 0; i < iMax; i+= STRIDE)
40 {
41 string aniname2 = llList2String(masterlist,i);
42 if(aniname2 == name)
43 {
44 // convert each list element into a loal variable
45 float fPrimnum = llList2Float(masterlist,i+1);
46 vector vPrimpos = llList2Vector(masterlist,i+2);
47 rotation rPrimrot = llList2Rot(masterlist,i+3) ;
48 string sMsg = llList2String(masterlist,i+4);
49 string sUUID = llList2String(masterlist,i+5);
50
51 if(llStringLength(sMsg) > 0)
52 llSay(0,sMsg); // chat any text we find
53 if(llStringLength(sUUID) > 0)
54 llPlaySound(sUUID,1.0); // play any sound we find
55
56 if(fPrimnum < 0)
57 {
58 llSleep(-fPrimnum); // sleep the interval in the notecard
59 }
60 else
61 {
62 rPrimrot /= llGetRot(); // Add in the local rot
63
64 if(fPrimnum != 0)
65 // The new way llSetLinkPrimitiveParamsFast((integer) fPrimnum,[PRIM_POSITION,vPrimpos,PRIM_ROTATION,rPrimrot]);
66 llSetLinkPrimitiveParamsFast((integer) fPrimnum,[PRIM_POSITION,vPrimpos,PRIM_ROTATION,rPrimrot]);
67
68 }
69 }
70 }
71 }
72
73
74 default
75 {
77 {
78 kNoteCardLines = llGetNumberOfNotecardLines(NOTECARD);
79 kGetIndexLines = llGetNotecardLine(NOTECARD,0);
80 }
81
82 // read notecard on reset, once. We store this in RAM and never reset again
83 dataserver(key kQueryid, string sData)
84 {
85 if(kQueryid == kNoteCardLines)
86 iIndexLines = (integer) sData;
87
88 if(kQueryid == kGetIndexLines)
89 {
90 if(sData != EOF)
91 {
92 // read and parse the notecard line into a list of items
93 kQueryid = llGetNotecardLine(NOTECARD, i);
94 list lLine = (llParseString2List(sData, ["|"], []));
95
96 // pull each element from the notecard list so we can store it in the proper format
97 string junk = llList2String(lLine,0); // this is the time/date field and object name that was chatted into the notecard
98 string sAniname = llList2String(lLine,1); // the name of the animation
99 integer iNum = (integer)Getline(lLine,2); // the prim link number
100 vector vPos = (vector) Getline(lLine,3); // the position
101 rotation rRot = (rotation) Getline(lLine,4); // the rotation
102 string sMsg = llList2String(lLine,5); // optional chat string
103 string sUUID = llList2String(lLine,6); // option sound name or UUID
104
105 if(iNum > 1) // skip the root prim! we don't want to move it
106 {
107 if(llStringLength(sMsg) > 0)
108 llSay(0,sMsg); // chat any text in this notecard
109 if(llStringLength(sUUID) > 0)
110 llPlaySound(sUUID,1.0); // play any sound we find in the notecard
111
112 masterlist += [sAniname];
113 masterlist += [iNum];
114 masterlist += [vPos];
115 masterlist += [rRot];
116 masterlist += [sMsg];
117 masterlist += [sUUID];
118 rRot /= llGetRot(); // remove our current rotation, by subtracting.. yes, a divide is a subtract in vector math
119
120 //llSetLinkPrimitiveParamsFast(Num,[PRIM_POSITION,Pos,PRIM_ROTATION,Rot]);
121 llSetLinkPrimitiveParamsFast(iNum,[PRIM_POSITION,vPos,PRIM_ROTATION,rRot]);
122 iMove++; // count the real movement
123 }
124 i++;
125 integer iInitPerCent = (integer) llRound(( (i+1) / (float) iIndexLines) * 100);
126 llSetText("Initialising... \n" + (string) iInitPerCent + "%" , <1,1,1>, 1.0);
127 if(iInitPerCent == 100)
128 llSetText("" , <1,1,1>, 1.0);
129 kGetIndexLines = llGetNotecardLine(NOTECARD,i);
130 }
131 else
132 {
133 llOwnerSay("initialized with " + (string) iMove + " movements");
134 llSetText("" , <1,1,1>, 1.0);
135 // start the whale flipping the tail every so often
136 llSetTimerEvent(FLIPTIME);
137 }
138 }
139 }
140
141
142 // The timer code moves the prim up and down
143 timer()
144 {
145 if(tailcounter ++ %2 == 0)
146 PlayBack("up");
147 else
148 PlayBack("down");
149
150 }
151
152 }

BlueWhale

Novecard that holds the coordinates - make sure there is no blank line

Category: Blue Whale
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 [21:01] Object: |up|9|<-2.24379, -1.58608, -8.90106>|<-0.47732, -0.23147, 0.70642, 0.46857>
2 [21:01] Object: |up|10|<-2.46843, 1.23117, -8.86807>|<-0.13555, -0.43806, 0.53353, 0.71069>
3 [21:01] Object: |up|5|<2.14173, 2.28669, -0.23297>|<-0.50629, -0.74574, 0.40425, 0.15534>
4 [21:01] Object: |up|8|<-0.41418, -0.06402, -6.60302>|<-0.67216, -0.09802, -0.00190, 0.73389>
5 [21:01] Object: |up|3|<2.64672, -2.30473, -0.27345>|<-0.09997, 0.32190, -0.73566, 0.58754>
6 [21:15] Object: |down|5|<1.66083, 2.25339, -0.09779>|<-0.29498, -0.65648, 0.54421, 0.43110>
7 [21:15] Object: |down|3|<1.81784, -2.28761, -0.08042>|<-0.46646, 0.35550, -0.79111, 0.17374>
8 [21:15] Object: |down|8|<-0.31811, -0.06601, -6.62540>|<-0.66142, -0.17270, -0.02317, 0.72949>
9 [21:15] Object: |down|9|<-1.37734, -1.60963, -8.93874>|<-0.53122, -0.33893, 0.67351, 0.38642>
10 [21:15] Object: |down|10|<-1.39820, 1.20907, -9.11732>|<-0.37999, -0.53015, 0.40654, 0.63974>

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