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
Flying Bee Flying Bee and Hive  

Flying Bee and Hive

A free flying bee that gathers pollen and takes it to his hive

Category: Flying Bee
By : Ferd Frederix
Created: 2013-09-08 Edited: 2016-07-10
Worlds: Second Life

the Zip file

Download all files for Flying Bee and Hive
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. [32246 bytes] bee box art.jpg
Get file # 2. [1230942 bytes] bee sign.png
Get file # 3. Bee wings.lsl
Get file # 4. Bee.lsl
Get file # 5. buzz2.wav
Get file # 6. Opensim Bee.lsl
Get file # 7. [2896 bytes] bee body sculpt.png
Get file # 8. [85896 bytes] bee body texture.jpg
Get file # 9. bee body.ac
Get file # 10. [2611 bytes] bee leg sculpt.png
Get file # 11. Bee legs.ac
Get file # 12. bee.dae
Get file # 13. [59810 bytes] beewing0.png
Get file # 14. buzz1.wav
Get file # 15. [2686 bytes] eyeballs_blinking.jpg
Get file # 16. [8911 bytes] eyeballs_blinking;2;2;10.jpg
Get file # 17. [28004 bytes] Smily Bee Body Texture.png
Get file # 18. [837 bytes] wing sculpt.png
Get file # 19. [9581 bytes] beehive texture.jpg
Get file # 20. beehive.ac
Get file # 21. beehive.dae
Get file # 22. [11373 bytes] beehive.png
Get file # 23. [180532 bytes] Img_0145.jpg
Get file # 24. mushroom.ac

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 default
2 {
4 {
7
8 list data = llParseString2List(texture1,[";"],[]);
9 string X = llList2String(data,1);
10 string Y = llList2String(data,2);
11 string Z = llList2String(data,3);
12
13 integer sideX = (integer) X;
14 integer sideY = (integer) Y;
15 float speed = (float) Z;
16
17
18 llSetTextureAnim(ANIM_ON|LOOP,ALL_SIDES,sideX,sideY,1,1,speed);
19 llSetTexture(texture1,ALL_SIDES);
20 }
21 }

Flying Bee and Hive

A free flying bee that gathers pollen and takes it to his hive

Category: Flying Bee
By : Ferd Frederix
Created: 2013-09-08 Edited: 2016-07-10
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 // Simple Bee script to locate and gather pollen from all prims named "Flower" then returns to the Beehive"
2 // Requires 2 sounds buzz1 and buzz2
3
4 string FLOWER_NAME = "Flower";
5 string HIVE_NAME = "Beehive";
6 vector offset = <0,.10,.1>;
7 vector hive_offset = <0,.5,0>;
8
9
10 // This is an OpenSim compatible llLookAt()
11
12 face_target(vector lookat)
13 {
14 rotation rot = llGetRot() * llRotBetween(<0.0 ,0.0 ,1.0 > * llGetRot(), lookat - llGetPos());
15 llSetRot(rot);
16 }
17
18
19 default
20 {
22 {
23 llSetTimerEvent(5); // move every 5 seconds
24 }
25
27 {
28 llSetTimerEvent(5); // move every 5 seconds
29 }
30
31 timer()
32 {
33 llSensor(FLOWER_NAME, NULL_KEY, ACTIVE|PASSIVE, 15.0,PI);
35 }
36
37 sensor(integer numDetected)
38 {
39 //llOwnerSay((string) numDetected);
40 integer i;
41 string name = llDetectedName(0);
42
43
44 if(name == FLOWER_NAME)
45 {
46 for (i = 0; i < numDetected; i++)
47 {
48 llPlaySound("buzz1",1.0);
49
50 vector new = <90,0,0> * DEG_TO_RAD;
51 rotation r = llEuler2Rot(new);
52
53 face_target(llDetectedPos(i));
54
55 llSetPos(llDetectedPos(i) + <0,0.1,0>);
56 llSetRot(llDetectedRot(i) * r);
57 llSleep(4);
58 }
59 llSensor(HIVE_NAME,NULL_KEY,ACTIVE|PASSIVE,15.0,PI);
60
61 } else {
62 llPlaySound("buzz1",1.0);
63 vector pos = llDetectedPos(0);
64 face_target(llDetectedPos(0)); // face beehive
65
66 llSetPos(pos + hive_offset);
67 vector new = <90,0,0> * DEG_TO_RAD;
68 rotation r = llEuler2Rot(new);
69
70 llSetRot(llDetectedRot(0) * r); // orient to it
71 llSleep(1);
72 llSetPos(pos ); // move in
73
74 llSleep(10);
76 llSetPos(pos + hive_offset); //move out
77 llSleep(1);
78 }
79 }
80
81 no_sensor()
82 {
84 }
85 }

Flying Bee and Hive

A free flying bee that gathers pollen and takes it to his hive for either OpenSim or Second Life

Category: Flying Bee
By : Ferd Frederix
Created: 2013-09-08 Edited: 2016-07-10
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 // Simple Bee script to locate and gather pollen from all prims named "Flower" then returns to the "Beehive"
2 // Requires 2 sounds buzz1 and buzz2
3 // !!!!!!!!!!!!!!
4 // Mods by Donjr Spiegelblatt for Opensim to remove chance of thread locking on 3/7/2015
5 // Thank YOU very much, DonJr !
6 // 03-17-2015 fixed up a problem reported by DonJr where the bees visited to flowers in the wrong sequence.
7 // Note: For Opensim, make sure to set the prim to PHYSICS type = NONE manually
8 //======================================================================
9 // Note: Inworldz Revisions - 7/9/2016
10 // RadioRoy Wattz (Inworldz)
11 //======================================================================
12 // Tunable items
13
14 integer debug = FALSE; // enablefor chattiness
15 integer PHYSICAL = TRUE; // for smooth movemenents enable physical.
16 // For less lag, set this to false, but the motion willl be very quick and jerky.
17
18 string FLOWER_NAME = "Flower"; // the name of the thing we seek
19 string HIVE_NAME = "Beehive Box-1";
20 float DIST = 25.0; // gow far to fly, max
21 float SPEED = 1; // move in this number of seconds from place to place
22
23 // code bits
24 vector vInitROT = <90,0,0> ; // due to the sculpted body, this bee gets rotated 90 degrees.
25 vector vFlowerOffset = <0,.10,0.1>;// due to the rotation on the sculpted body, this is back and up a bit.
26 vector vHiveOffset = <0,.5,0>;
27 rotation r90; // a calculated 90 degree rotation ends up here
28 integer iCount = 0; // hive counter
29 string sLocatedName = "Beehive Box-1"; // located name of item
30 list lGlist; // This is used as a first in first out stack with 2 entries per element
31
32 DEBUG(string str)
33 {
34 if(debug) llOwnerSay(llGetScriptName() + ":" + str);
35 }
36
37
38 // pop the top entry off the stack
39 poplGlist() {
40 lGlist = llDeleteSubList(lGlist,0,1);
41 }
42
43 // Get the top Position
44 vector Gpos() {
45 return llList2Vector(lGlist,0);
46 }
47
48 // Get the top Rotation
49 rotation Grot() {
50 return llList2Rot(lGlist,1);
51 }
52
53 SetRotPos(rotation rot, vector dest)
54 {
55 DEBUG("moveto:" + (string) dest);
56 if(PHYSICAL) {
57 llMoveToTarget(dest,SPEED);
58 llLookAt(dest+ <1,0,0>,SPEED,1); // 0.1 is a good compromise for SPEED > 1
59 } else {
60 llSetRegionPos(dest);
61 llSetRot(rot);
62 llSetStatus(STATUS_PHANTOM,TRUE);
63 }
64 }
65
66 default
67 {
69 {
70 llStopMoveToTarget(); // new inworldz
71 sLocatedName = "";
72 llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE]); //new inworldz
73 llSleep(2); //new Inworldz
74 // set rotation for this sculpted bee - remove this if yiou use a base prim| saved-> PRIM_PHYSICS_SHAPE_TYPE
75 vector new = vInitROT * DEG_TO_RAD;
76 r90 = llEuler2Rot(new);
77
78 llSetTimerEvent(.2); // let's go!// move time up from .1 to .2
79
80 if(PHYSICAL) {
81 llSetStatus(STATUS_PHYSICS,FALSE); // disable, then enable to get it to engage
83 } else{
85 }
86 }
87
89 {
90 llSetStatus(STATUS_PHYSICS,FALSE); //new Inworldz
91 llStopMoveToTarget( ); // new - inworldz - I Know Overkill!
93 }
94
95 timer()
96 {
98 if(sLocatedName == FLOWER_NAME)
99 {
100 if( lGlist != [] )
101 {
102 llPlaySound("buzz1",1.0);
103
104 SetRotPos(Grot() * r90 , Gpos() + vFlowerOffset); // orient to it
106 poplGlist(); // pop the top entry off the stack
107 }
108 else
109 {
110 DEBUG("Look for Hive");
111 llSensor(HIVE_NAME,NULL_KEY,ACTIVE|PASSIVE,DIST,PI); // Hive can be scripted, or not
112 }
113 }
114 else if(sLocatedName == HIVE_NAME)
115 {
116 if( iCount == 0 )
117 {
118 SetRotPos(llGetRot(), Gpos()); // move in
120 }
121 else if( iCount == 1 )
122 {
124 SetRotPos(llGetRot(),Gpos() + vHiveOffset); // move out
125 }
126 else {
127 sLocatedName = ""; // fall into llSensor FLOWER_NAME
128 llSetTimerEvent(2); // adjust pause here
129 }
130 iCount++;
131 } else { // fixed here
132 // as you don't want to "fall" into here until after a 1 second pause
133
134 DEBUG("Look for Flower");
135 llSensor(FLOWER_NAME, NULL_KEY, ACTIVE|PASSIVE, DIST,PI); // flowers can be scripted, or not
136 }
137 }
138
139
140 sensor(integer numDetected)
141 {
142 DEBUG("detected:" + (string) numDetected);
143 sLocatedName = llDetectedName(0);
144 // Clear the stack and place the first entry on it
145 lGlist = [ llDetectedPos(0), llDetectedRot(0) ];
146 if(sLocatedName == FLOWER_NAME)
147 {
148 // Append any additional Flowers entries onto the stack
149 integer i;
150 for (i = 1; i < numDetected; i++)
151 {
152 lGlist += [ llDetectedPos(i), llDetectedRot(i) ];
153 }
154 } else {
155 iCount = 0;
156 llPlaySound("buzz1",1.0);
157 // start moving towards the Hive
158 SetRotPos(Grot() * r90,Gpos() + vHiveOffset); // orient to it
159 }
160 // next step is always timer event
162 }
163
164 no_sensor()
165 {
166 sLocatedName = "";
167 llSetTimerEvent(15); // try again
168 }
169
170 changed(integer change)
171 {
172 if(change & CHANGED_REGION_START)
174 }
175 }
176 // end of code

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