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
Follower Penguin Follower  

Penguin Follower

Make a pet follow you

Category: Follower
By : Anonymous
Created: 2013-09-06 Edited: 2013-09-04
Worlds: Second Life

the Zip file

Download all files for Penguin Follower
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. evil peng script.lsl
1
2 ////////////////////////////////////////////
3 // Follow Me Script
4 //
5 // Written by Xylor Baysklef
6 // Adapted and added by Garth Fairlight
7 ////////////////////////////////////////////
8
9 /////////////// CONSTANTS ///////////////////
10 string FWD_DIRECTION = "-y";
11 vector POSITION_OFFSET = <0.0, 0.75, -0.8>; // Local coords
12 float SCAN_REFRESH = 0.2;
13 string FOLLOW = "/follow";
14 string STAY = "/stay";
15 integer FOLLOW_STOP = 5000;
16 integer FOLLOW_START = 5001;
17 float MOVETO_INCREMENT = 6.0;
18 ///////////// END CONSTANTS /////////////////
19
20 ///////////// GLOBAL VARIABLES ///////////////
21 key gOwner;
22 rotation gFwdRot;
23 float gTau;
24 float gMass;
25 integer count;
26 integer repeat;
27 /////////// END GLOBAL VARIABLES /////////////
28
29 help()
30 {
31 llWhisper(0,"You can say the following commands:");
32 llWhisper(0,"/follow <-- I will follow you around");
33 llWhisper(0,"/stay <-- I will stay where I am.");
34 llWhisper(0,"/help <-- I will repeat this message.");
35 llWhisper(0,"if I lose you I will IM my position to you unless");
36 llWhisper(0,"I am in a no script area, then I can do nothing.");
37 }
38
39 StartScanning()
40 {
42 llSensorRepeat("", gOwner, AGENT, 96.0, PI, SCAN_REFRESH);
43 llWhisper(0, "Greetings Master !");
44 }
45
46 StopScanning()
47 {
50 llWhisper(0, "Dont leave This one Mistress :(");
51 }
52
53 // Move to a position far away from the current one.
54 MoveTo(vector target)
55 {
56 vector Pos = llGetPos();
57
58 while(llVecDist(Pos, target) > MOVETO_INCREMENT)
59 {
60 Pos += llVecNorm(target - Pos) * MOVETO_INCREMENT;
61 llSetPos(Pos);
62 }
63 llSetPos(target);
64 }
65
66 rotation GetFwdRot()
67 {
68 // Special case... 180 degrees gives a math error
69 if(FWD_DIRECTION == "-x")
70 {
71 return llAxisAngle2Rot(<0, 0, 1>, PI);
72 }
73
74 string Direction = llGetSubString(FWD_DIRECTION, 0, 0);
75 string Axis = llToLower(llGetSubString(FWD_DIRECTION, 1, 1));
76
77 vector Fwd;
78 if(Axis == "x")
79 Fwd = <1, 0, 0>;
80 else if(Axis == "y")
81 Fwd = <0, 1, 0>;
82 else
83 Fwd = <0, 0, 1>;
84
85 if(Direction == "-")
86 Fwd *= -1;
87
88 return llRotBetween(Fwd, <1, 0, 0>);
89 }
90
91 rotation GetRotation(rotation rot)
92 {
93 vector Fwd;
94 Fwd = llRot2Fwd(rot);
95
96 float Angle = llAtan2( Fwd.y, Fwd.x );
97 return gFwdRot * llAxisAngle2Rot(<0, 0, 1>, Angle);
98 }
99
100 default
101 {
103 {
104 llSetStatus(STATUS_PHANTOM, TRUE);
105 gOwner = llGetOwner();
106 gFwdRot = GetFwdRot();
107 gMass = llGetMass();
108 gTau = 0.2;
109 llListen(0, "", "", "");
110 llSetTimerEvent(1.5);
111 StartScanning();
112 llMoveToTarget(llGetPos(), gTau);
113 }
114
115 sensor(integer num_detected)
116 {
117 rotation TargetRot;
118 vector Pos = llDetectedPos(0);
119 rotation Rot = llDetectedRot(0);
121 if((llGetAnimation(gOwner) == "Flying") || (llGetAnimation(gOwner) == "FlyingSlow"))
122 {
123 TargetRot = llEuler2Rot( <80, 0, 10> * DEG_TO_RAD) * GetRotation(Rot);
124 POSITION_OFFSET = <2.0, 0.75, 0.0>;
125 }
126 else
127 {
128 TargetRot = GetRotation(Rot);
129 POSITION_OFFSET = <0.0, 0.75, (-size.z / 2) + 0.1>;
130 }
131 vector Offset = POSITION_OFFSET * Rot;
132 Pos += Offset;
133 llRotLookAt(TargetRot, gTau * 5.0, gTau);
134 llMoveToTarget(Pos, gTau);
135 count=0;
136 repeat=0;
137 }
138
139 no_sensor()
140 {
141 count += 1;
142 if(count > 150)
143 {
144 repeat += 1;
146 string pos = (string)llGetPos();
147 string simName=llGetRegionName();
148 if(repeat < 2)
149 {
150 llInstantMessage(llGetOwner(),name + ", I am lost at:" + simName + pos + ". Please come and get this one Mistress !");
151 }
152 else
153 {
154 llInstantMessage(llGetOwner(),name + ", This one wili go to bed , Mistress !");
155 llSleep(10.0);
156 llDie();
157 }
158 count=0;
159 }
160 }
161
162 listen(integer channel, string name, key id, string mesg)
163 {
164 mesg = llToLower(mesg);
165 if((id == gOwner) && (mesg == FOLLOW))
166 {
167 StartScanning();
168 }
169 else if((id == gOwner) && (mesg == STAY))
170 {
171 StopScanning();
172 }
173 else if((id == gOwner) && (mesg == "/help"))
174 {
175 help();
176 }
177 else
178 {
179 integer stop;
180 string word;
181 integer check = FALSE;
182 if((id==gOwner) || (name == "Evil Pengi")) { check=TRUE;}
183 if(check == FALSE)
184 {
185 do
186 {
187 stop = llSubStringIndex(mesg, " ");
188 if(stop == -1) { stop = 0;}
189 word = llGetSubString(mesg, 0, stop - 1);
190 mesg = llDeleteSubString(mesg, 0, stop);
191 if((word=="brb") || (word=="afk"))
192 {
193 llSay(0,"We wait, hurry back !");
194 stop = 0;
195 }
196 else if((word=="smoke") || (word=="joint"))
197 {
198 llSay(0,"Can this one smoke ?");
199 stop = 0;
200 }
201 else if((word=="cool") || (word=="kewl"))
202 {
203 llSay(0,word + ", yes yes yes ");
204 stop = 0;
205 }
206 else if((word=="hi") || (word=="hello") || (word=="Greetings") || (word=="howdy") || (word=="Gday") || (word=="hej"))
207 {
208 llSay(0,word + " " + name + ", :)");
209 stop = 0;
210 }
211 else if((word=="cya") || (word=="bye") || (word=="goodbye"))
212 {
213 llSay(0,word + " " + name + " :)");
214 stop = 0;
215 }
216 else if((word=="food") || (word=="eat") || (word=="ate"))
217 {
218 float rnd = llFrand(10.0);
219 if(rnd < 5) { llSay(0,"Can this one eat?");}
220 else { llSay(0,name + ", This one is hungry !");}
221 stop = 0;
222 }
223 else if((word=="fuck") || (word=="Fuck") || (word=="FUCK"))
224 {
225 llSay(0,"PISS OFF CHIMP !");
226 stop = 0;
227 }
228 else if(word=="cow")
229 {
230 llSay(0,"you you, Pigdog !");
231 stop = 0;
232 }
233 } while(stop != 0);
234 }
235 }
236 }
237
239 {
240 integer choice = (integer)llFrand(6.0);
241 if(choice == 1) { llSay(0,"ALT+F4 will fix u Lag !");}
242 else if(choice == 2) { llSay(0,"They touch this one !");}
243 else if(choice == 3) { llSay(0,"Piss off !");}
244 else if(choice == 4) { llSay(0,"U not my Master !");}
245 else if(choice == 5) { llSay(0,"Dont touch my dick, plz !");}
246 else { llSay(0,"Go play with u self !");}
247 }
248
249 on_rez(integer start_param)
250 {
252 }
253 }

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