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
Fish Free-Swimming-Fish  

Free-Swimming-Fish

This project makes free-swimming fish appear from a rezzer

Category: Fish
By : Ferd Frederix
Created: 2013-09-25 Edited: 2013-09-25
Worlds: Second Life

the Zip file

Download all files for Free-Swimming-Fish
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Fish-Swim-Script.lsl
Get file # 2. RezzerScript.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
3
4
5 // Be sure you set the Fish to Temporary!
6
7 ////////////////////////////////////////////
8 // Follow Me Script segment
9 //
10 // Written by Ferd Frederix
11 ///////////////////////////////////////// ///
12 float RADIUS = 2.0;
13
14 /////////////// CONSTANTS ///////////////////
15 string FWD_DIRECTION = "-x";
16 vector POSITION_OFFSET ;
17 vector START;
18 float distance = 5;
19 float MOVEfTO_INCREMENT = 1;
20 float timerval = .5;
21 rotation gFwdRot;
22 float gTau = .2; // move
23 float rTau = 1; // rotation
24 vector Pos;
25 integer height = 1;
26 /////////// END GLOBAL VARIABLES /////////////
27
28
29 NewPos()
30 {
31 Pos.x = START.x + llFrand(distance*2)- distance;
32 Pos.y = START.y + llFrand(distance*2)- distance;
33 Pos.z = START.z + llFrand(height);
34 }
35
36 default
37 {
39 {
41 llCollisionSound("",0.0);
42 }
43
44
45 on_rez(integer startparam)
46 {
48 distance = (startparam >> 4) & 0xff;
49 height = (startparam >> 16) & 0xff;
50
52
53 START = llGetPos();
54 Pos = START;
55
56 NewPos();
57 llSetTimerEvent(timerval);
58 }
59
60 timer()
61 {
62 vector up = llRot2Up( llGetRot() );
63 llLookAt(Pos, gTau * 5.0, gTau);
64 if(llVecDist(llGetPos(),Pos) < 0.5)
65 NewPos();
66
67 vector Dest = llGetPos() + llVecNorm(Pos - llGetPos()) * (llFrand(0.5) + .2);
68 llMoveToTarget(Dest, gTau);
69 }
70 }

Free-Swimming-Fish

This project makes free-swimming fish appear from a rezzer. This is the rezzer. Put a copy of your fish in this box and touch it to get the menu

Category: Fish
By : Ferd Frederix
Created: 2013-09-25 Edited: 2013-09-25
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 integer startup = 0x050; // 10 meters, color 0
5 integer counter = 0;
6 integer selected = 0;
7 float range = 20; // sensor range
8 integer distance = 5; // roaming range
9 integer timetick = 5;
10 integer listener;
11 integer wanted;
12 integer asensor = FALSE;
13 integer on_off;
14 integer bcolor = 0;
15 integer color = -1; // =1 = all
16 integer height = 1;
17 integer sound = 0;
18 Rez()
19 {
20 if(color == -1)
21 {
22 bcolor++;
23 if(bcolor > 9)
24 bcolor = 0;
25 }
26 else
27 bcolor = color;
28
29 startup = (height << 16) + (distance << 4) + bcolor;
30
31 //llOwnerSay("Distance:" + (string) distance);
32 //llOwnerSay("Color:" + (string) color);
33
34 llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos() + <0.0,0.0,0.5>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, startup);
35 }
36
37 MakeMenu()
38 {
39 integer channel = llCeil(llFrand(1000) + 9000);
40 string msg = "Select an item:\nOn|Off - enable or disable\nSensor = Only run when Avatars are in range\nDistance - Set roaming and range\nMore - Increase the number of fish\nLess - decrease the number of Fish\nColor - pick a color\nHeight - How hi they fly";
41 list menu = ["Off","Sensor Off","Less","On","Sensor On","More","Distance","-","Height"];
42 listener = llListen(channel,"","","");
43 llDialog(llGetOwner(),msg,menu,channel);
44
45 }
46
47
48 MenuDistance(string msg)
49 {
50 integer channel = llCeil(llFrand(1000) + 9000);
51 list menu = ["1","3","10","15","20","25","30","45","96"];
52 listener = llListen(channel,"","","");
53 llDialog(llGetOwner(),msg,menu,channel);
54 }
55
56 MenuColor(string msg)
57 {
58 integer channel = llCeil(llFrand(1000) + 9000);
59 list menu = ["0","1","2","3","4","5","6","7","8","9","All"];
60 listener = llListen(channel,"","","");
61 llDialog(llGetOwner(),msg,menu,channel);
62 }
63
64 MenuHeight(string msg)
65 {
66 integer channel = llCeil(llFrand(1000) + 9000);
67 list menu = ["0","1","2","3","4","5","6","7","8","9","10","15"];
68 listener = llListen(channel,"","","");
69 llDialog(llGetOwner(),msg,menu,channel);
70 }
71
72 default
73 {
74
75 listen(integer channel,string name,key id, string msg)
76 {
77
78 llListenRemove(listener);
79 if(msg == "On")
80 {
81 llSetTimerEvent(1.0);
82 on_off= TRUE;
84 }
85 else if(msg == "Off")
86 {
88 on_off= FALSE;
90 llOwnerSay("Fish are stopped");
92 }
93 else if(msg == "Sensor On")
94 {
96 wanted = 1;
97 MenuDistance("Pick how far to detect avatars");
98 }
99 else if(msg == "Sensor Off")
100 {
101 MakeMenu();
103 llOwnerSay("Fish are stopped");
104 asensor = FALSE;
106 }
107 else if(msg == "Distance")
108 {
109 wanted = 2;
110 MenuDistance("Pick the distance that the Fish will roam");
111 }
112 else if(msg == "Color")
113 {
114 wanted = 3;
115 MenuColor("Pick a color number");
116 }
117 else if(msg == "Height")
118 {
119 wanted = 4;
120 MenuHeight("Pick a maximum height for flight");
121 }
122 else if(msg == "More")
123 {
124 timetick -=1;
125 if(timetick <= 0)
126 timetick = 1;
127 integer count = llCeil(60/timetick);
128 llOwnerSay((string) count + " Fish");;
129 MakeMenu();
130 }
131 else if(msg == "Less")
132 {
133 timetick +=1;
134 integer count = (integer) (60/timetick);
135 llOwnerSay((string) count + " FIsh");
136 MakeMenu();
137 }
138 else
139 {
140 if(wanted == 4 )
141 {
142 height = (integer) msg;
143 llOwnerSay("Fish height is " + (string) height+ " meters");
144 MakeMenu();
145 }
146 if(wanted == 3 )
147 {
148 if(msg == "All")
149 {
150 color = -1;
151 llOwnerSay("Fish color is is all colors");
152 }
153 else
154 {
155 color = (integer) msg;
156 llOwnerSay("Fish color is is " + (string) color );
157 }
158
159 MakeMenu();
160 }
161 if(wanted == 2 )
162 {
163 distance = (integer) msg;
164 llOwnerSay("Fish roaming range is " + (string) distance + " meters");
165 integer count = (integer) (60/timetick);
166 MakeMenu();
167 }
168 else if(wanted == 1 )
169 {
170 range = (integer) msg;
171 llOwnerSay("Avatar detection range is " + (string) range + " meters");
172 asensor = TRUE;
173 llSensorRepeat("","",AGENT,range,PI,timetick);
174 llOwnerSay("Fish should appear every " + (string) timetick + " seconds");
175 integer count = (integer) (60/timetick);
176 MakeMenu();
178 }
179 }
180
181
182
183 }
184
186 {
187 MakeMenu();
189 }
190
191 touch_start(integer total_number)
192 {
194 {
195 return;
196 }
197 if(asensor)
198 {
199 llOwnerSay("Avatar detection range is " + (string) range + " meters");
200 }
201 if(on_off)
202 {
203 llOwnerSay("Fishs are on" );
204 }
205 else
206 {
207 llOwnerSay("Fishs are off" );
208 }
209
210 llOwnerSay("Fish roaming range is " + (string) distance + " meters");
211 integer count = (integer) (60/timetick);
212 llOwnerSay("About " + (string) count + " Fish a minute");
214 MakeMenu();
215 }
216
217
218 timer()
219 {
220 llSetTimerEvent(timetick);
221 Rez();
222 }
223
224 sensor(integer num_detected)
225 {
226 if(! sound++)
227 llPlaySound("a758554b-add3-37d3-1c71-7f24a474d013",1);
228 Rez();
229 }
230
231 no_sensor()
232 {
233 sound = FALSE;
234 }
235
236 on_rez(integer startparam)
237 {
239 }
240 }

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