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
Sphere World Walk-On-the-moon  

Walk-On-the-moon

Sphere script for walking on a planet or moon
put these three scripts in a sphere and put the Poseball script in a pose ball.
touch the sphere to train them, then sit on the pose ball. You can have multiple pose balls.

Category: Sphere World
By : Ferd Frederix
Created: 2013-11-19 Edited: 2017-03-11
Worlds: Second Life

the Zip file

Download all files for Walk-On-the-moon
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. license.txt
Get file # 2. [53546 bytes] earth texture 1.png
Get file # 3. [267076 bytes] marsmap.png
Get file # 4. Moon Home.lsl
Get file # 5. moon script.lsl
Get file # 6. Slow rotation.lsl
Get file # 7. avatar_stand.bvh
Get file # 8. avatar_walk.bvh
Get file # 9. poseball 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 // Sphere script for walking on a planet or moon
3 // global listeners
4
5 integer To_Pose_CHANNEL = 9879877;
6 integer To_Planet_CHANNEL = 6583586;
7
8
9
10 Say()
11 {
12 vector size = llGetScale();
13
14 vector pos = llGetPos();
15 string place = "SPHERE^" + (string)pos + "^" + (string)size.x ;
16 llRegionSay(To_Pose_CHANNEL, place);
17 // llOwnerSay("Sending " + place);
18
19
20 }
21 default
22 {
24 {
25 llListen(To_Planet_CHANNEL, "", "", ""); // listen for a pet to say XSPET_PING_HOME - Mod by Ferd to listen to HOME_CHANNEL, not -237918
26 Say();
27 }
28
29 touch_start(integer total_number)
30 {
31 if(llDetectedKey(0) == llGetOwner()) {
32
33 Say();
34 }
35
36 }
37
38 listen(integer channel, string name, key id, string msg)
39 {
40 // llOwnerSay("Sphere Heard :" + msg);
41 vector size = llGetScale();
42 vector pos = llGetPos();
43
44 //pos.z = pos.z - size.z / 2;
45
46 Say();
47 }
48 }
49

Walk-On-the-moon

Controlled Walk Pose ball - put this in a small sphere and set it at ground level.
Add a walk animation named "avatar_walk" to the prim, and an animation named "avatar_stand".
You can change these to your preferred walk, and rename them in the script.
When you click it, it will let you walk on your sphere world

Category: Sphere World
By : Ferd Frederix
Created: 2013-11-19 Edited: 2017-03-11
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 string Text = "Live on Mars"; // the hovertext when no one is stting
3 string WALK = "avatar_walk";
4 string STAND = "avatar_stand";
5
6 // Requires there to be one walk animation in the inventory of the pose ball.
7
8 integer debug = FALSE;
9 DEBUG(string msg)
10 {
11 if(debug)
12 llSay(0,llGetScriptName() + ":" + msg);
13
14 }
15
16 // global listeners
17
18 integer To_Pose_CHANNEL = 9879877;
19 integer To_Planet_CHANNEL = 6583586;
20
21 // walk on a sphere
22
23
24 string ANIMATION ; // change to a walk animation
25
26
27 vector gSphereLocation; // location of the walkable sphere
28 vector Home; // pose ball home
29 rotation gOrient;
30 rotation sphereRot;
31 key avatarKey;
32 float x ;
33 float y ;
34 float z ;
35 float gRADIUS = 0.0;
36 float aRADIUS;
37 string controls ;
38
39
40 spin()
41 {
42 llTargetOmega(<0.5,0.0,0.0>*llGetRot(),0.1,0.01); // start spin
43 }
44
45 stopSpin()
46 {
47 llTargetOmega(<0.0,0.0,0.0>*llGetRot(),0.1,0.01); // start spin
48 }
49
50
51 //uSteppedLookAt( vector vPosTarget, float vFltRate ){
52 // rotation vRotTarget = llRotBetween( <1.0, 0.0, 0.0>, vPosTarget );
53 // if((integer)(vFltRate = llAcos(
54 // (vPosTarget = llVecNorm( vPosTarget )) *
55 // (<1.0, 0.0, 0.0> * llGetLocalRot())
56 // ) / (vFltRate / 5.0)
57 //
58
59 // )){
60 // rotation vRotStep = llAxisAngle2Rot( llRot2Axis( vRotTarget / llGetLocalRot() ),
61 // (1.0 / vFltRate) * llRot2Angle( vRotTarget / llGetLocalRot() ) );
62 // vFltRate = (integer)vFltRate;
63 // do{
64 // llSetLocalRot( vRotStep * llGetLocalRot() );
65 // }while( --vFltRate );
66 // }
67 // llSetLocalRot( vRotTarget );
68 //} //-- for fi
69
70
71 uSteppedLookAt( vector vPosTarget, float vFltRate ){
72
73 rotation vRotTarget = llRotBetween( <1.0, 0.0, 0.0>, vPosTarget );
74
75 vFltRate = llAcos((vPosTarget = llVecNorm( vPosTarget )) *(<1.0, 0.0, 0.0> * llGetLocalRot())) / (vFltRate / 5.0);
76
77 if((integer) vFltRate) {
78 rotation vRotStep = llAxisAngle2Rot( llRot2Axis( vRotTarget / llGetLocalRot() ),
79 (1.0 / vFltRate) * llRot2Angle( vRotTarget / llGetLocalRot() ) );
80 vFltRate = (integer)vFltRate;
81 do{
82 llSetLocalRot( vRotStep * llGetLocalRot() );
83 }while( --vFltRate );
84 }
85 llSetLocalRot( vRotTarget );
86 } //-- for fixed time on any rotation try llKeyframeMotion
87
88
89 face_target(vector lookat) {
90
91 rotation rot = llGetRot() * llRotBetween(<0.0 ,0.0 ,1.0 > * llGetRot(), gSphereLocation - llGetPos());
92 llSetRot(rot);
93 }
94
95 key avatar;
96
97
98 warpPos( vector destpos )
99 {
100 llOwnerSay("tp to: " + (string) destpos);
101
102 llSetRegionPos(destpos);
103
104 }
105
106 Fetch(key id, string message)
107 {
108 if(llGetOwnerKey(id) == llGetOwner())
109 {
110 DEBUG("walk script Heard " + message);
111
112 list data = llParseString2List(message, ["^"], []);
113
114 if(llList2String(data, 0) == "SPHERE")
115 {
116 gSphereLocation = (vector) llList2String(data, 1);
117 float dia = llList2Float(data, 2);
118 gRADIUS = dia/2;
119 llOwnerSay("Sphere located at " + (string) gSphereLocation);
120 Home = llGetPos();
121 }
122 }
123 }
124
125 default
126 {
127
129 {
131 }
132
134 {
135
136
137 ANIMATION = llGetInventoryName(INVENTORY_ANIMATION,0); // get the first animation we can find
138
139 llSetAlpha(1,ALL_SIDES); // visible
140 llSetText(Text,<1,1,1>,1); // set hover text
141
142 // sitting
143 vector rot = <0,90,180>; // 0, 90, 180 for avatar position
144 rotation sitrot = llEuler2Rot(rot * DEG_TO_RAD);
145 llSitTarget(<0,0,0.01>,sitrot);
146
147 // position
148 vector arot = <270,0,270>; // 0, 90, 180 for avatar position
149 sphereRot = llEuler2Rot(arot * DEG_TO_RAD);
150 llSetRot(sphereRot);
151
152 spin();
153
154 // listen for world position and size
155 llListen(To_Pose_CHANNEL, "", "", "");
156 llRegionSay(To_Planet_CHANNEL, "PING");
157
158 // camera
159 llSetCameraEyeOffset(<-4, 0, 3> * sitrot);
160 llSetCameraAtOffset(<2, 0, 1> * sitrot);
161 }
162
163
164 listen(integer channel, string name, key id, string message)
165 {
166 DEBUG("Heard:" + message);
167 Fetch(id,message);
168 state running;
169 }
170
171
172 }
173
174 state running
175 {
177 {
178 gOrient = ZERO_ROTATION;
179 Home = llGetPos();
180 llListen(To_Pose_CHANNEL, "", "", "");
181 }
182
183 listen(integer channel, string name, key id, string message)
184 {
185 Fetch(id,message);
186 }
187
188 changed(integer change)
189 {
190 if(change & CHANGED_LINK)
191 {
192 avatar = llAvatarOnSitTarget();
193 if(avatar != NULL_KEY){
194
195 if(gSphereLocation == <0,0,0>) {
196 llOwnerSay("World not located yet, please click the sphere world and make sure it is within 100 meters");
197 return;
198 }
199
200 //SOMEONE SAT DOWN
201 avatarKey = avatar;
203
204 }else{
205 //SOMEONE STOOD UP
207 {
208 llStopAnimation(ANIMATION);
209 }
210
212 llSetText(Text,<1,1,1>,1);
214 warpPos(Home);
215 llSetRot(sphereRot);
216 spin();
217 }
218 }
219 }
220
222 {
224 {
225
226 vector height = llGetAgentSize(avatarKey);
227 aRADIUS = gRADIUS + height.z * 0.50 ; // adjust for the agent size
228
229 vector unitpos = llRot2Fwd( gOrient );
230 vector pos = gSphereLocation + unitpos * aRADIUS;
231
232 warpPos(pos);
233
234 llStartAnimation(STAND);
235 llStopAnimation("sit");
236
237 llSetTimerEvent(.5); // look for walking
238 llSetText("",<1,0,0>,1); // no text
239 llSetAlpha(0,ALL_SIDES); // invisible
240 stopSpin();
241 }
243 {
244 //llOwnerSay("Controls Ready");
249 controls = "U";
250 }
251 }
252
253 timer()
254 {
255
256 if(llStringLength(controls) == 0)
257 {
258 llStartAnimation(STAND);
259 llStopAnimation(WALK);
260 return;
261 }
262
263 //llOwnerSay(controls);
264 controls = "";
265 llStartAnimation(WALK);
266 llStopAnimation(STAND);
267
268 rotation delta = llEuler2Rot(<x,y,z> * DEG_TO_RAD);
269
270 vector unitpos = llRot2Fwd( gOrient );
271 vector pos = gSphereLocation + unitpos * aRADIUS;
272
273 //llOwnerSay((string) llVecDist(gSphereLocation,llGetPos()));
274
275 // face_target(pos);
276
277 //llLookAt( pos, 1.0, 0.1);
278
279 // if(pos != priorpos)
280 // {
281 // llOwnerSay("rotating");
282 // uSteppedLookAt(pos,2.0);
283 // priorpos = pos;
284 // }
285 llSetRot(gOrient);
286
287 //llRezObject("Pointer",pos,<0,0,0>,gOrient,1);
288 //llOwnerSay("Pos:" + ( string) pos);
289
290 llSetPos(pos);
291
292 gOrient = gOrient * delta;
293 }
294
295
296 control(key driver, integer levels, integer edge)
297 {
298
299 // integer start = levels & edge;
300 // integer end = ~levels & edge;
301 // integer held = levels & ~edge;
302 //integer untouched = ~(levels | edge);
303 //llOwnerSay(llList2CSV([levels, edge, start, end, held, untouched]));
304
305 //z = L/R
306 //y = U/d
307 x = 0;
308 y = 0;
309 z = 0;
310
311 float bump = 10;
312
313 if(levels & CONTROL_FWD)
314 {
315 y = -bump;
316 controls = "U";
317 }
318 if(levels & CONTROL_BACK)
319 {
320 y = bump;
321 controls = "D";
322 }
323 if(levels & CONTROL_ROT_LEFT)
324 {
325 z = bump ;
326 controls = "L";
327 }
328 if(levels & CONTROL_ROT_RIGHT)
329 {
330 z = -bump;
331 controls = "R";
332 }
333
334
335
336
337 }
338
340 {
342 }
343
344
345 }

Walk-On-the-moon

Sphere script for XS pets to walk on a p...

Category: Sphere World
By : Ferd Frederix
Created: 2013-11-19 Edited: 2017-03-11
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 // :CATEGORY:World
2 // :NAME:Walk-On-the-moon
3 // :AUTHOR:Ferd Frederix
4 // :CREATED:2013-11-19 16:49:18
5 // :ID:1003
6 // :REV:2
7 // :WORLD:Second Life, OPensim
8 // :DESCRIPTION:
9 // Sphere script for XS pets to walk on a planet or moon
10 // Optionall put this script in a sphere and put the Poseball script in a pose ball.
11 // XS pets using ther same secret key and channels can then walk and live on this little moon.
12
13
14 // Version 2
15
16 // original script by Xundra Snowpaw
17 // mods by Ferd Frederix
18 // revisions:
19 // 10-3-2011 Mod by Ferd to listen to HOME_CHANNEL, not -237918, the original src has no other reference to that channel.
20 // 11-16-2011 Use latest globals from GLobal Constants
21 //
22 // New BSD License: http://www.opensource.org/licenses/bsd-license.php
23 // Copyright (c) 2010, Xundra Snowpaw
24 // All rights reserved.
25 //
26 // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
27
28 //* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
29 //* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
30
31 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ////////////////////////////////////////////////////////////////////
33
34
35
36 ///////////////////////////////////////////////
37 // COPY FROM GLOBAL CONSTANTS FILE LOCATED IN Debug Folder
38 // INCLUDE THESE IN ALL SCRIPTS //
39 // XS_pet constants and names
40
41 ///// GLOBAL CONSTANTS extracted from original source //////
42 //
43 // if you change any of these constants, change it everywhere and in a list in XS_Debug so it can print them
44 //
45 // 0.24 is the original Pet Quail
46 // 0.25 is the modified Pet Quail
47 // 0.26 is the Robot code, which is generic
48
49 float VERSION = 0.28;
50 integer ENCRYPT = FALSE;
51 key YOUR_UUID = ""; // if you add a UUID for your avatar here, you can change it later
52 // and other alts or feruiends can edit and make these pets
53 // If you leave it blank, only the creator can work on them
54 string Animal = "Troubot"; // was 'Quail', must be the name of your animal
55 string Egg = "Nut and Bolt"; // was 'XS Egg', must be the name of your egg
56 string Crate = "Transport UFO"; // was XS-Cryocrate
57 string HomeObject = "Home Flag"; // was "XS Home Object
58 string sound = "robot_sound";
59 string SECRET_PASSWORD = "top secret robot"; // must use one unique to any animal
60 integer SECRET_NUMBER = 99999; // any number thats a secret
61
62 integer MaxAge = 7; // can get prggers in 7 days
63 integer UNITS_OF_FOOD = 168; // food bowl food
64 float secs_to_grow = 86400; // grow daily = 86400
65
66 // global listeners
67
68 integer FOOD_CHANNEL = -999191;
69 integer ANIMAL_CHANNEL = -999192;
70 integer EGG_CHANNEL = -999193;
71 integer HOME_CHANNEL = -999194;
72 integer BOX_CHANNEL = -999195;
73 integer ACC_CHANNEL = -999196;
74 integer UPDATE_CHANNEL = -999197;
75 integer API_CHANNEL = -999198;
76
77 // global prim animation linkmessages on channel 1
78 // these are the prim animations played for each type of possible animation
79
80 string ANI_STAND = "stand"; // default standing animation
81 string ANI_WALKL = "left"; // triggers Left foot and righrt arm walk animation
82 string ANI_WALKR = "right"; // triggers Right foot and left arm walk animation
83 string ANI_SLEEP = "sleep"; // Sleeping
84 string ANI_WAVE = "wave"; // Calling for sex, needs help with food, etc.
85
86
87
88 // global link messages to control the animal
89 integer LINK_AGE_START = 800; // when quail is rezzed and secret_number, is sent by brain to breeder, eater and informatic get booted up
90 integer LINK_FOOD_CONSUME = 900; // from movement to brain when close to food, brain then consumes a random amount up to 10000
91 integer LINK_FOODMINUS = 901; // xs_brain receives FOOD_CONSUME, decrement hunger (eat)
92 integer LINK_HUNGRY = 903; // sent by eater (string)hunger_amount, checks each hour
93 integer LINK_HAMOUNT = 904; // hunger_amount = (integer)str,m updates the hunger amount in scripts
94 integer LINK_SET_HOME = 910; // loc ^ dist
95 integer LINK_MOVER = 911; // tell mover to rest for str seconds
96 integer LINK_FOODIE_CLR = 920; // clear all food_bowl_keys and contents
97 integer LINK_FOODIE = 921; // send FOOD_LOCATION coordinates to movement
98 integer LINK_COLOR1 = 930; // colour1
99 integer LINK_COLOR2 = 931; // colour2
100 integer LINK_SEX = 932; // sex
101 integer LINK_SHINE = 933; // shine
102 integer LINK_GLOW = 934; // glow
103 integer LINK_GEN = 935; // generation
104 integer LINK_RESET_SIZE = 936; // reset size to 1
105 integer LINK_MAGE = 940; // xs_brain sends, xs_ager consumes, adds str to age, if older than 7 days, will grow the animal
106 integer LINK_DAYTIME = 941; // xs_ager consumes, starts a timer of 86,400 seconds in xs_ager
107 integer LINK_GET_AGE = 942; // get age from xs_ager and sent it on channel 943
108 integer LINK_PUT_AGE = 943; // print age from xs_ager
109 integer LINK_PACKAGE = 950; // look for a cryo_crate
110 integer LINK_SEEK_FEMALE = 960; // MALE_BREED_CALL
111 integer LINK_MALE_BREED_CALL = 961; // triggered by LINK_SEEK_FEMALE
112 integer LINK_SIGNAL_ELIGIBLE = 962; // sent by female when hears LINK_MALE_BREED_CALL
113 integer LINK_FEMALE_ELIGIBLE = 963; // sent when it hears in chat FEMALE_ELIGIBLE
114 integer LINK_CALL_MALE = 964; // if LINK_FEMALE_ELIGIBLE && looking_for_female
115 integer LINK_MALE_ON_THE_WAY = 965; // triggered by LINK_CALL_MALE
116 integer LINK_FEMALE_LOCATION = 966; // female location, sends coordinates of a female
117 integer LINK_RQST_BREED = 967; // sent when close enough to male/female
118 integer LINK_CALL_MALE_INFO = 968; // sent by xs_breeding, this line of code was in error in v.24 of xs_breeding see line 557 and 636 of xs_brain which make calls and also xs_breeding which receives LINK_MALE_INFO.
119 integer LINK_MALE_INFO = 969;
120 integer LINK_LAY_EGG = 970; // llRezObject("XS Egg"
121 integer LINK_BREED_FAIL = 971; // key = father, failed, timed out
122 integer LINK_PREGNANT = 972; // chick is preggers
123 integer LINK_SOUND_ON= 973; // sound is on
124 integer LINK_SOUND_OFF= 974; // sound is off
125 integer LINK_SLEEPING = 990; // close eyes
126 integer LINK_UNSLEEPING = 991; // open eyes
127 integer LINK_SOUND = 1001; // plays a sound if enabled
128 integer LINK_SPECIAL = 1010; // xs_special, is str = "Normal", removes script
129 integer LINK_PREGNANCY_TIME = 5000; // in seconds as str
130 integer LINK_SLEEP = 7999; // disable sleep by parameter
131 integer LINK_TIMER = 8000; // scan for food bowl about every 1800 seconds
132 integer LINK_DIE = 9999; // death
133
134
135 ///////// end global Link constants ////////
136
137
138 ///////////// END OF COPIED CODE ////////////
139
140
141 /////// DON'T CHANGE THE FOLLOWING! (Unless you know what you are doing!)
142
143 integer XTEA_DELTA = 0x9E3779B9; // (sqrt(5) - 1) * 2^31
144 integer xtea_num_rounds = 6;
145 list xtea_key = [0, 0, 0, 0];
146
147 integer hex2int(string hex) {
148 if(llGetSubString(hex,0,1) == "0x")
149 return (integer)hex;
150 if(llGetSubString(hex,0,0) == "x")
151 return (integer)("0"+hex);
152 return(integer)("0x"+hex);
153 }
154
155
156 // Convers any string to a 32 char MD5 string and then to a list of
157 // 4 * 32 bit integers = 128 bit Key. MD5 ensures always a specific
158 // 128 bit key is generated for any string passed.
159 list xtea_key_from_string( string str )
160 {
161 str = llMD5String(str,0); // Use Nonce = 0
162 return [ hex2int(llGetSubString( str, 0, 7)),
163 hex2int(llGetSubString( str, 8, 15)),
164 hex2int(llGetSubString( str, 16, 23)),
165 hex2int(llGetSubString( str, 24, 31))];
166 }
167
168 // Encipher two integers and return the result as a 12-byte string
169 // containing two base64-encoded integers.
170 string xtea_encipher( integer v0, integer v1 )
171 {
172 integer num_rounds = xtea_num_rounds;
173 integer sum = 0;
174 do {
175 // LSL does not have unsigned integers, so when shifting right we
176 // have to mask out sign-extension bits.
177 v0 += (((v1 << 4) ^ ((v1 >> 5) & 0x07FFFFFF)) + v1) ^ (sum + llList2Integer(xtea_key, sum & 3));
178 sum += XTEA_DELTA;
179 v1 += (((v0 << 4) ^ ((v0 >> 5) & 0x07FFFFFF)) + v0) ^ (sum + llList2Integer(xtea_key, (sum >> 11) & 3));
180
181 } while( num_rounds = ~-num_rounds );
182 //return only first 6 chars to remove "=="'s and compact encrypted text.
183 return llGetSubString(llIntegerToBase64(v0),0,5) +
185 }
186
187 // Decipher two base64-encoded integers and return the FIRST 30 BITS of
188 // each as one 10-byte base64-encoded string.
189 string xtea_decipher( integer v0, integer v1 )
190 {
191 integer num_rounds = xtea_num_rounds;
192 integer sum = XTEA_DELTA*xtea_num_rounds;
193 do {
194 // LSL does not have unsigned integers, so when shifting right we
195 // have to mask out sign-extension bits.
196 v1 -= (((v0 << 4) ^ ((v0 >> 5) & 0x07FFFFFF)) + v0) ^ (sum + llList2Integer(xtea_key, (sum>>11) & 3));
197 sum -= XTEA_DELTA;
198 v0 -= (((v1 << 4) ^ ((v1 >> 5) & 0x07FFFFFF)) + v1) ^ (sum + llList2Integer(xtea_key, sum & 3));
199 } while( num_rounds = ~-num_rounds );
200
201 return llGetSubString(llIntegerToBase64(v0), 0, 4) +
203 }
204
205 // Encrypt a full string using XTEA.
206 string xtea_encrypt_string( string str )
207 {
208 if(! ENCRYPT)
209 return str;
210 // encode string
211 str = llStringToBase64(str);
212 // remove trailing =s so we can do our own 0 padding
213 integer i = llSubStringIndex( str, "=" );
214 if( i != -1 )
215 str = llDeleteSubString( str, i, -1 );
216
217 // we don't want to process padding, so get length before adding it
218 integer len = llStringLength(str);
219
220 // zero pad
221 str += "AAAAAAAAAA=";
222
223 string result;
224 i = 0;
225
226 do {
227 // encipher 30 (5*6) bits at a time.
228 result += xtea_encipher(llBase64ToInteger(llGetSubString(str, i, i + 4) + "A="), llBase64ToInteger(llGetSubString(str, i+5, i + 9) + "A="));
229 i+=10;
230 } while( i < len );
231
232 return result;
233 }
234
235 // Decrypt a full string using XTEA
236 string xtea_decrypt_string( string str ) {
237 if(! ENCRYPT)
238 return str;
239 integer len = llStringLength(str);
240 integer i=0;
241 string result;
242 //llOwnerSay(str);
243 do {
244 integer v0;
245 integer v1;
246
247 v0 = llBase64ToInteger(llGetSubString(str, i, i + 5) + "==");
248 i+= 6;
249 v1 = llBase64ToInteger(llGetSubString(str, i, i + 5) + "==");
250 i+= 6;
251
252 result += xtea_decipher(v0, v1);
253 } while( i < len );
254
255 // Replace multiple trailing zeroes with a single one
256
257 i = llStringLength(result) - 1;
258 while( llGetSubString(result, i - 1, i) == "AA" ){
259 result = llDeleteSubString(result, i, i);
260 i--;
261 }
262 i = llStringLength(result) - 1;
263 // while(llGetSubString(result, i, i + 1) == "A" ) {
264 // i--;
265 // }
266 result = llGetSubString(result, 0, i+1);
267 i = llStringLength(result);
268 integer mod = i%4; //Depending on encoded length diffrent appends are needed
269 if(mod == 1) result += "A==";
270 else if(mod == 2 ) result += "==";
271 else if(mod == 3) result += "=";
272
273 return llBase64ToString(result);
274 }
275
276 string base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
277
278 //tunables
279 integer world = TRUE;
280
281 default
282 {
284 {
285 xtea_key = xtea_key_from_string(SECRET_PASSWORD);
286 llListen(HOME_CHANNEL, "", "", "XSPET_PING_HOME"); // listen for a pet to say XSPET_PING_HOME - Mod by Ferd to listen to HOME_CHANNEL, not -237918
287
288 }
289
290 touch_start(integer total_number)
291 {
292 if(llDetectedKey(0) == llGetOwner()) {
293 vector size = llGetScale();
294 vector pos = llGetPos();
295 if(!world)
296 pos.z = pos.z - size.z / 2;
297
298 llRegionSay(ANIMAL_CHANNEL, xtea_encrypt_string("XSPET^HOME_LOCATION^" + (string)pos + "^" + llGetObjectDesc()));
299 }
300 llOwnerSay("Setting Home Location");
301 }
302
303 listen(integer channel, string name, key id, string msg)
304 {
305 vector size = llGetScale();
306 vector pos = llGetPos();
307 if(!world)
308 pos.z = pos.z - size.z / 2;
309
310 llRegionSay(ANIMAL_CHANNEL, xtea_encrypt_string("XSPET^HOME_LOCATION^" + (string)pos + "^" + llGetObjectDesc()));
311 }
312 }

Walk-On-the-moon

an optional script to slowly rotate the moon

Category: Sphere World
By : Ferd Frederix
Created: 2013-11-19 Edited: 2017-03-11
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 default
4 {
6 {
7 llTargetOmega(<.5,0.0,0.0>*llGetRot(),0.1,0.01);
8 }
9
10 }

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