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 Sphere World  

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
Worlds: Second Life

the Zip file

Download all files for Sphere World
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.

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 // Author: Ferd Frederix
4 // Sphere World by Ferd Frederix is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
5
6 // This is the menu script to add people to your world, it goes in the globe
7 // when rezzed, the globe asks how many people you want
8
9 string OBJECT = "Elve";
10
11 integer listener;
12 integer channel = -768542;
13 rez(integer howmany)
14 {
15 integer i;
16 for (i = 0; i < howmany; i++)
17 {
18 llRezObject(OBJECT,llGetPos(), <0,0,0>,<0,0,0,1>,0);
19 }
20 llSleep(5); // hack to let them have some time to appear
21 llMessageLinked(LINK_SET,-999,"rez","");
22 }
23
24 default
25 {
27 {
28 listener = llListen(channel,"",llGetOwner(),"");
29 llDialog(llGetOwner(),"How many residents on your sphere?",["1","2","3","4","5","6","7","8","9"],channel);
30 }
31
32 listen(integer channel, string name, key id, string msg)
33 {
34 integer howmany = (integer) msg;
35 rez(howmany);
36 llListenRemove(listener);
37 }
38
40 {
42 }
43 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Add this script, then delete the script, it will no longer be needed
3 // makes the world slowly rotate about the X axis
4
5 default
6 {
8 {
9 llTargetOmega((<0.5,0,0.0>*llGetRot()),0.1,0.03);
10 }
11
12
13 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Version 0.32
3 // 05-29-2012
4
5 // Author: Ferd Frederix
6 // Sphere World by Ferd Frederix is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
7 // Permission is granted to use this script in commercial projects where it is a part of a pet
8
9
10 ///////////////////////////////////////////////
11 // COPY FROM GLOBAL CONSTANTS FILE LOCATED IN Debug Folder
12 // INCLUDE THESE IN ALL SCRIPTS //
13 // XS_pet constants and names
14
15 ///// GLOBAL CONSTANTS extracted from original source //////
16 //
17 // if you change any of these constants, change it everywhere and in a list in XS_Debug so it can print them
18 //
19 // 0.24 is the original Pet Quail
20 // 0.25 is the modified Pet Quail
21 // 0.26 is the Robot code, which is generic
22
23 float VERSION = 0.26;
24 integer ENCRYPT = FALSE;
25 key YOUR_UUID = ""; // if you add a UUID for your avatar here, you can change it later
26 // and other alts or friends can edit and make these pets
27 // If you leave it blank, only the creator can work on them
28 string Animal = "Troubot"; // was 'Quail', must be the name of your animal
29 string Egg = "Nut and Bolt"; // was 'XS Egg', must be the name of your egg
30 string Crate = "Transport UFO"; // was XS-Cryocrate
31 string HomeObject = "Home Flag"; // was "XS Home Object
32 string sound = "robot_sound";
33 string SECRET_PASSWORD = "moonlet"; // must use one unique to any animal
34 integer SECRET_NUMBER = 99999; // any number thats a secret
35
36 integer MaxAge = 7; // can get prggers in 7 days
37 integer UNITS_OF_FOOD = 168; // food bowl food
38 float secs_to_grow = 86400; // grow daily = 86400
39
40 // global listeners
41
42 integer FOOD_CHANNEL = -999191;
43 integer ANIMAL_CHANNEL = -999192;
44 integer EGG_CHANNEL = -999193;
45 integer HOME_CHANNEL = -999194;
46 integer BOX_CHANNEL = -999195;
47 integer ACC_CHANNEL = -999196;
48 integer UPDATE_CHANNEL = -999197;
49 integer API_CHANNEL = -999198;
50
51 // global prim animation linkmessages on channel 1
52 // these are the prim animations played for each type of possible animation
53
54 string ANI_STAND = "stand"; // default standing animation
55 string ANI_WALKL = "left"; // triggers Left foot and righrt arm walk animation
56 string ANI_WALKR = "right"; // triggers Right foot and left arm walk animation
57 string ANI_SLEEP = "sleep"; // Sleeping
58 string ANI_WAVE = "wave"; // Calling for sex, needs help with food, etc.
59
60
61
62 // global link messages to control the animal
63 integer LINK_AGE_START = 800; // when quail is rezzed and secret_number, is sent by brain to breeder, eater and informatic get booted up
64 integer LINK_FOOD_CONSUME = 900; // from movement to brain when close to food, brain then consumes a random amount up to 10000
65 integer LINK_FOODMINUS = 901; // xs_brain receives FOOD_CONSUME, decrement hunger (eat)
66 integer LINK_HUNGRY = 903; // sent by eater (string)hunger_amount, checks each hour
67 integer LINK_HAMOUNT = 904; // hunger_amount = (integer)str,m updates the hunger amount in scripts
68 integer LINK_SET_HOME = 910; // loc ^ dist
69 integer LINK_MOVER = 911; // tell mover to rest for str seconds
70 integer LINK_FOODIE_CLR = 920; // clear all food_bowl_keys and contents
71 integer LINK_FOODIE = 921; // send FOOD_LOCATION coordinates to movement
72 integer LINK_COLOR1 = 930; // colour1
73 integer LINK_COLOR2 = 931; // colour2
74 integer LINK_SEX = 932; // sex
75 integer LINK_SHINE = 933; // shine
76 integer LINK_GLOW = 934; // glow
77 integer LINK_GEN = 935; // generation
78 integer LINK_RESET_SIZE = 936; // reset size to 1
79 integer LINK_MAGE = 940; // xs_brain sends, xs_ager consumes, adds str to age, if older than 7 days, will grow the animal
80 integer LINK_DAYTIME = 941; // xs_ager consumes, starts a timer of 86,400 seconds in xs_ager
81 integer LINK_GET_AGE = 942; // get age from xs_ager and sent it on channel 943
82 integer LINK_PUT_AGE = 943; // print age from xs_ager
83 integer LINK_PACKAGE = 950; // look for a cryo_crate
84 integer LINK_SEEK_FEMALE = 960; // MALE_BREED_CALL
85 integer LINK_MALE_BREED_CALL = 961; // triggered by LINK_SEEK_FEMALE
86 integer LINK_SIGNAL_ELIGIBLE = 962; // sent by female when hears LINK_MALE_BREED_CALL
87 integer LINK_FEMALE_ELIGIBLE = 963; // sent when it hears in chat FEMALE_ELIGIBLE
88 integer LINK_CALL_MALE = 964; // if LINK_FEMALE_ELIGIBLE && looking_for_female
89 integer LINK_MALE_ON_THE_WAY = 965; // triggered by LINK_CALL_MALE
90 integer LINK_FEMALE_LOCATION = 966; // female location, sends coordinates of a female
91 integer LINK_RQST_BREED = 967; // sent when close enough to male/female
92 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.
93 integer LINK_MALE_INFO = 969;
94 integer LINK_LAY_EGG = 970; // llRezObject("XS Egg"
95 integer LINK_BREED_FAIL = 971; // key = father, failed, timed out
96 integer LINK_PREGNANT = 972; // chick is preggers
97 integer LINK_SOUND_ON= 973; // sound is on
98 integer LINK_SOUND_OFF= 974; // sound is off
99 integer LINK_SLEEPING = 990; // close eyes
100 integer LINK_UNSLEEPING = 991; // open eyes
101 integer LINK_SOUND = 1001; // plays a sound if enabled
102 integer LINK_SPECIAL = 1010; // xs_special, is str = "Normal", removes script
103 integer LINK_PREGNANCY_TIME = 5000; // in seconds as str
104 integer LINK_SLEEP = 7999; // disable sleep by parameter
105 integer LINK_TIMER = 8000; // scan for food bowl about every 1800 seconds
106 integer LINK_DIE = 9999; // death
107
108
109 ///////// end global Link constants ////////
110
111
112 ///////////// END OF COPIED CODE ////////////
113
114
115 /////// DON'T CHANGE THE FOLLOWING! (Unless you know what you are doing!)
116
117 integer XTEA_DELTA = 0x9E3779B9; // (sqrt(5) - 1) * 2^31
118 integer xtea_num_rounds = 6;
119 list xtea_key = [0, 0, 0, 0];
120
121 integer hex2int(string hex) {
122 if(llGetSubString(hex,0,1) == "0x")
123 return (integer)hex;
124 if(llGetSubString(hex,0,0) == "x")
125 return (integer)("0"+hex);
126 return(integer)("0x"+hex);
127 }
128
129
130 // Convers any string to a 32 char MD5 string and then to a list of
131 // 4 * 32 bit integers = 128 bit Key. MD5 ensures always a specific
132 // 128 bit key is generated for any string passed.
133 list xtea_key_from_string( string str )
134 {
135 str = llMD5String(str,0); // Use Nonce = 0
136 return [ hex2int(llGetSubString( str, 0, 7)),
137 hex2int(llGetSubString( str, 8, 15)),
138 hex2int(llGetSubString( str, 16, 23)),
139 hex2int(llGetSubString( str, 24, 31))];
140 }
141
142 // Encipher two integers and return the result as a 12-byte string
143 // containing two base64-encoded integers.
144 string xtea_encipher( integer v0, integer v1 )
145 {
146 integer num_rounds = xtea_num_rounds;
147 integer sum = 0;
148 do {
149 // LSL does not have unsigned integers, so when shifting right we
150 // have to mask out sign-extension bits.
151 v0 += (((v1 << 4) ^ ((v1 >> 5) & 0x07FFFFFF)) + v1) ^ (sum + llList2Integer(xtea_key, sum & 3));
152 sum += XTEA_DELTA;
153 v1 += (((v0 << 4) ^ ((v0 >> 5) & 0x07FFFFFF)) + v0) ^ (sum + llList2Integer(xtea_key, (sum >> 11) & 3));
154
155 } while( num_rounds = ~-num_rounds );
156 //return only first 6 chars to remove "=="'s and compact encrypted text.
157 return llGetSubString(llIntegerToBase64(v0),0,5) +
159 }
160
161 // Decipher two base64-encoded integers and return the FIRST 30 BITS of
162 // each as one 10-byte base64-encoded string.
163 string xtea_decipher( integer v0, integer v1 )
164 {
165 integer num_rounds = xtea_num_rounds;
166 integer sum = XTEA_DELTA*xtea_num_rounds;
167 do {
168 // LSL does not have unsigned integers, so when shifting right we
169 // have to mask out sign-extension bits.
170 v1 -= (((v0 << 4) ^ ((v0 >> 5) & 0x07FFFFFF)) + v0) ^ (sum + llList2Integer(xtea_key, (sum>>11) & 3));
171 sum -= XTEA_DELTA;
172 v0 -= (((v1 << 4) ^ ((v1 >> 5) & 0x07FFFFFF)) + v1) ^ (sum + llList2Integer(xtea_key, sum & 3));
173 } while( num_rounds = ~-num_rounds );
174
175 return llGetSubString(llIntegerToBase64(v0), 0, 4) +
177 }
178
179 // Encrypt a full string using XTEA.
180 string xtea_encrypt_string( string str )
181 {
182 if(! ENCRYPT)
183 return str;
184 // encode string
185 str = llStringToBase64(str);
186 // remove trailing =s so we can do our own 0 padding
187 integer i = llSubStringIndex( str, "=" );
188 if( i != -1 )
189 str = llDeleteSubString( str, i, -1 );
190
191 // we don't want to process padding, so get length before adding it
192 integer len = llStringLength(str);
193
194 // zero pad
195 str += "AAAAAAAAAA=";
196
197 string result;
198 i = 0;
199
200 do {
201 // encipher 30 (5*6) bits at a time.
202 result += xtea_encipher(llBase64ToInteger(llGetSubString(str, i, i + 4) + "A="), llBase64ToInteger(llGetSubString(str, i+5, i + 9) + "A="));
203 i+=10;
204 } while( i < len );
205
206 return result;
207 }
208
209 // Decrypt a full string using XTEA
210 string xtea_decrypt_string( string str ) {
211 if(! ENCRYPT)
212 return str;
213 integer len = llStringLength(str);
214 integer i=0;
215 string result;
216 //llOwnerSay(str);
217 do {
218 integer v0;
219 integer v1;
220
221 v0 = llBase64ToInteger(llGetSubString(str, i, i + 5) + "==");
222 i+= 6;
223 v1 = llBase64ToInteger(llGetSubString(str, i, i + 5) + "==");
224 i+= 6;
225
226 result += xtea_decipher(v0, v1);
227 } while( i < len );
228
229 // Replace multiple trailing zeroes with a single one
230
231 i = llStringLength(result) - 1;
232 while( llGetSubString(result, i - 1, i) == "AA" ){
233 result = llDeleteSubString(result, i, i);
234 i--;
235 }
236 i = llStringLength(result) - 1;
237 // while(llGetSubString(result, i, i + 1) == "A" ) {
238 // i--;
239 // }
240 result = llGetSubString(result, 0, i+1);
241 i = llStringLength(result);
242 integer mod = i%4; //Depending on encoded length diffrent appends are needed
243 if(mod == 1) result += "A==";
244 else if(mod == 2 ) result += "==";
245 else if(mod == 3) result += "=";
246
247 return llBase64ToString(result);
248 }
249
250 string base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
251
252 //tunables
253 integer world = TRUE;
254
255
256 talkback()
257 {
258 vector pos = llGetPos();
259 vector size = llGetScale();
260
261 llShout(ANIMAL_CHANNEL, xtea_encrypt_string("XSPET^HOME_LOCATION^" + (string)pos + "^" + (string) size.x ) );
262 }
263
264
265 default
266 {
268 {
269 xtea_key = xtea_key_from_string(SECRET_PASSWORD);
270 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
271
272 }
273
274 touch_start(integer total_number)
275 {
276 if(llDetectedKey(0) == llGetOwner()) {
277 talkback();
278 llOwnerSay("Setting Home Location");
279 }
280
281 }
282
283 listen(integer channel, string name, key id, string msg)
284 {
285 talkback();
286 }
287
288
289 link_message(integer sender_num, integer num, string str, key id)
290 {
291 if(num == -999)
292 talkback();
293 }
294
295 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Version 0.32
3 // 05-29-2012
4
5
6 // xs_movement ( for walking on a globe )
7 // this replaces xs_movement, must be named 'xs_movement"
8
9 /////////////////////////////////////////////////////////////////////
10
11 // Based on code from Xundra Snowpaw
12 // New BSD License: http://www.opensource.org/licenses/bsd-license.php
13 // Copyright (c) 2010, Xundra Snowpaw
14 // All rights reserved.
15 //
16 // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17
18 //* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19 //* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
20 // in the documentationand/or other materials provided with the distribution.
21
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
24 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ////////////////////////////////////////////////////////////////////
29
30 ///////////////////////////////////////////////
31 // COPY FROM GLOBAL CONSTANTS FILE LOCATED IN Debug Folder
32 // INCLUDE THESE IN ALL SCRIPTS //
33 // XS_pet constants and names
34
35 ///// GLOBAL CONSTANTS extracted from original source //////
36 //
37 // if you change any of these constants, change it everywhere and in a list in XS_Debug so it can print them
38 //
39
40 float VERSION = 0.28;
41 integer ENCRYPT = FALSE; // set to TRUE to encrypt all data, Opensim prefers FALSE
42 key YOUR_UUID = ""; // if you add a UUID for your avatar here, you can change it later
43 // and other alts or friends can edit and make these pets
44 // If you leave it blank, only the creator can work on them
45 string Animal = "Troubot"; // was 'Quail', must be the name of your animal
46 string Egg = "Nut and Bolt"; // was 'XS Egg', must be the name of your egg
47 string Crate = "Transport UFO"; // was XS-Cryocrate
48 string HomeObject = "Home Flag"; // was "XS Home Object
49 string sound = "robot_sound";
50 string SECRET_PASSWORD = "top secret robot"; // must use one unique to any animal
51 integer SECRET_NUMBER = 99999; // any number thats a secret
52
53 integer MaxAge = 7; // can get prggers in 7 days
54 integer UNITS_OF_FOOD = 168; // food bowl food
55 float secs_to_grow = 86400; // grow daily = 86400
56
57 // global listeners
58
59 integer FOOD_CHANNEL = -999191;
60 integer ANIMAL_CHANNEL = -999192;
61 integer EGG_CHANNEL = -999193;
62 integer HOME_CHANNEL = -999194;
63 integer BOX_CHANNEL = -999195;
64 integer ACC_CHANNEL = -999196;
65 integer UPDATE_CHANNEL = -999197;
66 integer API_CHANNEL = -999198;
67
68 // global prim animation linkmessages on channel 1
69 // these are the prim animations played for each type of possible animation
70
71 string ANI_STAND = "stand"; // default standing animation
72 string ANI_WALKL = "left"; // triggers Left foot and righrt arm walk animation
73 string ANI_WALKR = "right"; // triggers Right foot and left arm walk animation
74 string ANI_SLEEP = "sleep"; // Sleeping
75 string ANI_WAVE = "wave"; // Calling for sex, needs help with food, etc.
76
77
78
79 // global link messages to control the animal
80 integer LINK_AGE_START = 800; // when quail is rezzed and secret_number, is sent by brain to breeder, eater and informatic get booted up
81 integer LINK_FOOD_CONSUME = 900; // from movement to brain when close to food, brain then consumes a random amount up to 10000
82 integer LINK_FOODMINUS = 901; // xs_brain receives FOOD_CONSUME, decrement hunger (eat)
83 integer LINK_HUNGRY = 903; // sent by eater (string)hunger_amount, checks each hour
84 integer LINK_HAMOUNT = 904; // hunger_amount = (integer)str,m updates the hunger amount in scripts
85 integer LINK_SET_HOME = 910; // loc ^ dist
86 integer LINK_MOVER = 911; // tell mover to rest for str seconds
87 integer LINK_FOODIE_CLR = 920; // clear all food_bowl_keys and contents
88 integer LINK_FOODIE = 921; // send FOOD_LOCATION coordinates to movement
89 integer LINK_COLOR1 = 930; // colour1
90 integer LINK_COLOR2 = 931; // colour2
91 integer LINK_SEX = 932; // sex
92 integer LINK_SHINE = 933; // shine
93 integer LINK_GLOW = 934; // glow
94 integer LINK_GEN = 935; // generation
95 integer LINK_RESET_SIZE = 936; // reset size to 1
96 integer LINK_MAGE = 940; // xs_brain sends, xs_ager consumes, adds str to age, if older than 7 days, will grow the animal
97 integer LINK_DAYTIME = 941; // xs_ager consumes, starts a timer of 86,400 seconds in xs_ager
98 integer LINK_GET_AGE = 942; // get age from xs_ager and sent it on channel 943
99 integer LINK_PUT_AGE = 943; // print age from xs_ager
100 integer LINK_PACKAGE = 950; // look for a cryo_crate
101 integer LINK_SEEK_FEMALE = 960; // MALE_BREED_CALL
102 integer LINK_MALE_BREED_CALL = 961; // triggered by LINK_SEEK_FEMALE
103 integer LINK_SIGNAL_ELIGIBLE = 962; // sent by female when hears LINK_MALE_BREED_CALL
104 integer LINK_FEMALE_ELIGIBLE = 963; // sent when it hears in chat FEMALE_ELIGIBLE
105 integer LINK_CALL_MALE = 964; // if LINK_FEMALE_ELIGIBLE && looking_for_female
106 integer LINK_MALE_ON_THE_WAY = 965; // triggered by LINK_CALL_MALE
107 integer LINK_FEMALE_LOCATION = 966; // female location, sends coordinates of a female
108 integer LINK_RQST_BREED = 967; // sent when close enough to male/female
109 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.
110 integer LINK_MALE_INFO = 969;
111 integer LINK_LAY_EGG = 970; // llRezObject("XS Egg"
112 integer LINK_BREED_FAIL = 971; // key = father, failed, timed out
113 integer LINK_PREGNANT = 972; // chick is preggers
114 integer LINK_SOUND_OFF= 974; // sound is off
115 integer LINK_SOUND_ON= 973; // sound is on
116 integer LINK_SLEEPING = 990; // close eyes
117 integer LINK_UNSLEEPING = 991; // open eyes
118 integer LINK_SOUND = 1001; // plays a sound if enabled
119 integer LINK_SPECIAL = 1010; // xs_special, is str = "Normal", removes script
120 integer LINK_PREGNANCY_TIME = 5000; // in seconds as str
121 integer LINK_SLEEP = 7999; // disable sleep by parameter
122 integer LINK_TIMER = 8000; // scan for food bowl about every 1800 seconds
123 integer LINK_DIE = 9999; // death
124
125
126 ///////// end global Link constants ////////
127
128
129 ///////////// END OF COPIED CODE ////////////
130
131
132
133
134 float GROWTH_AMOUNT = 0.10;
135
136 vector home_location;
137 float roam_distance;
138 list food_bowls;
139 list food_bowl_keys;
140 list food_bowl_time;
141
142 vector destination;
143
144 integer sex_dest = 0;
145 integer food_dest = 0;
146 float tolerance = 0.15;
147 float increment = 0.1;
148 integer rest;
149 integer age;
150 float zoffset;
151 integer sleep_last_check ;
152 integer sound_on;
153 integer sleep_disabled;
154
155
156 //new mover on a sphere
157 float RADIUS = 1.0;
158 rotation gOrient;
159 list gSilly_walks;
160 integer gCounter;
161
162
163
164 GetNewPos()
165 {
166 // start over and calc a new walk
167
168 gSilly_walks = [];
169
170
171 float x = llFrand(5) + 5;
172
173 float y = llFrand(5) + 5;
174
175 float z = llFrand(5) + 5;
176
177 if(llFrand(2) > 1)
178 x = 1-x;
179 if(llFrand(2) > 1)
180 y = 1-z;
181 if(llFrand(2) > 1)
182 z = 1-z;
183
184
185 rotation delta = llEuler2Rot(<x,y,z> * DEG_TO_RAD);
186
187 integer STEPS = llCeil( llFrand(10)) + 1;
188 integer i;
189 for (i = 0; i < STEPS; i++)
190 {
191 vector unitpos = llRot2Fwd( gOrient );
192 vector pos = home_location + unitpos * RADIUS;
193
194 gSilly_walks += pos;
195 gSilly_walks += gOrient;
196
197 gOrient = gOrient * delta;
198 }
199 }
200
201
202
203
204 face_target(vector lookat) {
205
206 rotation rot = llGetRot() * llRotBetween(<1.0 ,0.0 ,0.0 > * llGetRot(), lookat - llGetPos());
207
208
209 llMessageLinked(LINK_SET, 1, ANI_WALKL, "");
210 llMessageLinked(LINK_SET, 1, ANI_WALKR, "");
211
212 llSetRot(rot);
213 llSleep(.1);
214
215 rot = llGetRot() * llRotBetween(<0.0 ,0.0 ,1.0 > * llGetRot(), home_location - llGetPos());
216 llSetRot(rot);
217 }
218
219 integer sleeping()
220 {
222 if(!sleep_disabled) {
223 if(sun.z < 0) {
224 if(sleep_last_check == 0) {
225 // close eyes
226 llMessageLinked(LINK_SET, LINK_SLEEPING, "", "");
227 llMessageLinked(LINK_SET, 1, ANI_SLEEP, "");
228 }
229 sleep_last_check = 1;
230 } else {
231 if(sleep_last_check == 1) {
232 // open eyes
233 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
234 llMessageLinked(LINK_SET, LINK_UNSLEEPING, "", "");
235 }
236 sleep_last_check = 0;
237 }
238 return sleep_last_check;
239 } else {
240 if(sleep_last_check == 1) {
241 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
242 llMessageLinked(LINK_SET, LINK_UNSLEEPING, "", "");
243 sleep_last_check = 0;
244 }
245 return 0;
246 }
247 }
248
249 default
250 {
251 link_message(integer sender, integer num, string str, key id)
252 {
253 //llOwnerSay((string)num + "^" + (string)str);
254 if(num == LINK_AGE_START) {
255 state running;
256 }
257 }
258 }
259
260 state running
261 {
263 {
264 gOrient = ZERO_ROTATION;
265 home_location = <0,0,0>;
266 roam_distance = 0;
267 destination = <0,0,0>;
268 age = 0;
269 sleep_last_check = 0;
270 sound_on = 1;
271 }
272
273
274 timer()
275 {
276
277
278 if(!sleeping())
279 {
280 if(sound_on) {
281 llMessageLinked(LINK_SET, LINK_SOUND, "", "");
282 }
283 sound_on = !sound_on;
284
285 if(rest > 0) {
286 // llSetText((string) rest,<1,0,0>,1);
287 rest--;
288 return;
289 }
290
291 if(llVecDist( destination, llGetPos()) <= tolerance || destination == <0,0,0>)
292 {
293 // if at food_destination send 900 msg
294 if(food_dest > 0) {
295 llMessageLinked(LINK_SET, LINK_FOOD_CONSUME, (string)food_dest, llList2Key(food_bowl_keys, 0));
296 }
297
298 if(sex_dest > 0) {
299
300 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
301 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
302 llMessageLinked(LINK_SET, LINK_RQST_BREED, "", "");
303
304 }
305 // pick a new destination
306 sex_dest = 0;
307 food_dest = 0;
308
309 }
310
311
312 integer walkLength = llGetListLength(gSilly_walks);
313 if( walkLength > 0)
314 {
315 vector pos = llList2Vector(gSilly_walks,0);
316 rotation orient = llList2Rot(gSilly_walks,1);
317
318 gCounter++;
319 face_target(pos);
320 llSetPos(pos);
321
322
323
324 //llSetRot(orient);
325
326 gSilly_walks = llDeleteSubList(gSilly_walks,0,1); // we have walked in those shoes
327 }
328 else
329 {
330 GetNewPos();
331
332 rest = (integer)llFrand(12.0); // 1 minute rest
333 //llOwnerSay("resting for " + (string) rest);
334 }
335
336 llMessageLinked(LINK_SET, 1, ANI_WALKL, "");
337 llMessageLinked(LINK_SET, 1, ANI_WALKR, "");
338 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
339
340 }
341 }
342
343 link_message(integer sender, integer num, string str, key id)
344 {
345
346
347 // llOwnerSay((string)num + "^" + (string)str);
348
349
350
351 if(num == LINK_HUNGRY) {
352 if(sex_dest == 0) {
353 // move to food bowl, then send 900
354 if(llGetListLength(food_bowl_keys) > 0) {
355 if(roam_distance == 0 || home_location == <0,0,0>) {
356 llOwnerSay("I'm hungry, but I'm not homed so I can not move! Attempting to use Jedi Mind Powers to teleport food to my belly.");
357 llMessageLinked(LINK_SET, LINK_FOOD_CONSUME, str, llList2Key(food_bowl_keys, 0));
358 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
359 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
360 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
361 } else {
362 // find nearest food bowl
363 integer i;
364 destination = (vector)llList2String(food_bowls, 0);
365 for (i=1;i<llGetListLength(food_bowls);i++) {
366 if(llVecDist(destination, llGetPos()) > llVecDist((vector)llList2String(food_bowls, i), llGetPos())) {
367 destination = (vector)llList2String(food_bowls, i);
368 }
369 }
370 destination.z = home_location.z + zoffset;
371 // set destination,
372 // face it
373 face_target(destination);
374 food_dest = (integer)str;
375 rest = 0;
376 //llMessageLinked(LINK_SET, LINK_FOOD_CONSUME, str, llList2Key(food_bowl_keys, 0));
377 }
378 } else {
379 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
380 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
381 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
382 llOwnerSay("I'm hungry, but I can't seem to find any food bowls at present.");
383 }
384 }
385 } else
386 if(num == LINK_SET_HOME) {
387 list values = llParseString2List(str, ["^"], []);
388 home_location = (vector)llList2String(values, 0);
389 RADIUS = llList2Float(values, 1)/2;
390
391 //llOwnerSay("location:" + (string) home_location + " " + "distance:" + (string) roam_distance);
392
393
394 vector current_loc = llGetPos();
395
396 food_bowls = [];
397 food_bowl_keys = [];
398 food_bowl_time = [];
399
400 destination = <0,0,0>;
401 food_dest = 0;
402 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
403 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
404 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
405
406 GetNewPos();
407 llSetTimerEvent(4.0);
408
409 llOwnerSay("Homed");
410
411 } else
412 if(num == LINK_MOVER) {
413 if(rest < (integer)str) {
414 rest = (integer)str;
415 }
416 } else
417 if(num == LINK_FOODIE_CLR) {
418 food_bowls = [];
419 food_bowl_keys = [];
420 food_bowl_time = [];
421 } else
422 if(num == LINK_FOODIE) {
423 vector food_loc = (vector)str;
424
425 if(llVecDist(home_location, food_loc) <= roam_distance && llFabs(llFabs(home_location.z) - llFabs(food_loc.z)) < 2) {
426 if(llListFindList(food_bowls, (list)str) == -1) {
427 integer id_pos = llListFindList(food_bowl_keys, (list)id);
428 if(id_pos == -1) {
429 food_bowls += str;
430 food_bowl_keys += id;
431 food_bowl_time += llGetUnixTime();
432 } else {
433 food_bowls = llListReplaceList(food_bowls, [str], id_pos, id_pos);
434 food_bowl_time = llListReplaceList(food_bowl_time, [llGetUnixTime()], id_pos, id_pos);
435 }
436 }
437
438 integer iter;
439
440 iter = 0;
441
442 while(iter<llGetListLength(food_bowls)) {
443 if(llGetUnixTime() - llList2Integer(food_bowl_time, iter) > 3600) {//3600
444 food_bowls = llDeleteSubList(food_bowls, iter, iter);
445 food_bowl_keys = llDeleteSubList(food_bowl_keys, iter, iter);
446 food_bowl_time = llDeleteSubList(food_bowl_time, iter, iter);
447 } else {
448 iter++;
449 }
450 }
451
452 if(llGetListLength(food_bowls) > 0) {
453 llMessageLinked(LINK_SET, LINK_TIMER, "", "");
454 }
455 }
456 } else
457 if(num == LINK_FEMALE_LOCATION) {
458 destination = (vector)str;
459 face_target(destination);
460 rest = 0;
461 food_dest = 0;
462 sex_dest = 1;
463 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
464 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
465 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
466 } else
467 if(num == LINK_MAGE) {
468 integer heightm;
469 age += (integer)str;
470 heightm = age;
471
472 if(heightm > MaxAge)
473 heightm = MaxAge;
474 float new_scale = (GROWTH_AMOUNT * heightm) + 1.0;
475
476 float legsz = 0.064 * new_scale; /// !!! does this need scaling?
477 float legso = 0.052399 * new_scale;
478
479 zoffset = 0 ;// no offset
480 } else
481 if(num == LINK_SLEEP) {
482 sleep_disabled = (integer)str;
483 }
484 }
485 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Version 0.32
3 // 05-29-2012
4
5 // Script to hear the home post
6 // This script goes in the Pet
7
8 // Author: Ferd Frederix
9 // Sphere World by Ferd Frederix is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
10 // Permission is granted to use this script in commercial projects where it is a part of a pet
11
12
13 integer ANIMAL_CHANNEL = -999192;
14 integer LINK_AGE_START = 800;
15 integer LINK_SET_HOME = 910; // loc ^ dist
16
17
18 default
19 {
21 {
22 llListen(ANIMAL_CHANNEL,"","","");
23 }
24
26 {
28 }
29
30 listen(integer channel, string name, key id, string message)
31 {
32
33 list data = llParseString2List(message,["^"],[]);
34 if(llList2String(data, 1) == "HOME_LOCATION") {
35
36 llMessageLinked(LINK_SET, LINK_AGE_START, "", "");
37
38 llSleep(1);
39
40 vector n_home_loc = (vector)llList2String(data, 2);
41 float home_dis = llList2Float(data, 3);
42 vector my_loc = llGetPos();
43
44 if(llGetOwnerKey(id) == llGetOwner()) {
45
46 llMessageLinked(LINK_SET, LINK_SET_HOME , (string)n_home_loc + "^" + (string)home_dis, "");
47 }
48 }
49 }
50
51 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Author: Ferd Frederix
4 // Sphere World by Ferd Frederix is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
5
6 // This is the menu script to add people to your world, it goes in the globe
7 // when rezzed, the globe asks how many people you want
8
9 string OBJECT = "Elve";
10
11 integer listener;
12 integer channel = -768542;
13 rez(integer howmany)
14 {
15 integer i;
16 for (i = 0; i < howmany; i++)
17 {
18 llRezObject(OBJECT,llGetPos(), <0,0,0>,<0,0,0,1>,0);
19 }
20 llSleep(5); // hack to let them have some time to appear
21 llMessageLinked(LINK_SET,-999,"rez","");
22 }
23
24 default
25 {
27 {
28 listener = llListen(channel,"",llGetOwner(),"");
29 llDialog(llGetOwner(),"How many residents on your sphere?",["1","2","3","4","5","6","7","8","9"],channel);
30 }
31
32 listen(integer channel, string name, key id, string msg)
33 {
34 integer howmany = (integer) msg;
35 rez(howmany);
36 llListenRemove(listener);
37 }
38
40 {
42 }
43 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Add this script, then delete the script, it will no longer be needed
3 // makes the world slowly rotate about the X axis
4
5 default
6 {
8 {
9 llTargetOmega((<0.5,0,0.0>*llGetRot()),0.1,0.03);
10 }
11
12
13 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Version 0.32
3 // 05-29-2012
4
5 // Author: Ferd Frederix
6 // Sphere World by Ferd Frederix is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
7 // Permission is granted to use this script in commercial projects where it is a part of a pet
8
9
10 ///////////////////////////////////////////////
11 // COPY FROM GLOBAL CONSTANTS FILE LOCATED IN Debug Folder
12 // INCLUDE THESE IN ALL SCRIPTS //
13 // XS_pet constants and names
14
15 ///// GLOBAL CONSTANTS extracted from original source //////
16 //
17 // if you change any of these constants, change it everywhere and in a list in XS_Debug so it can print them
18 //
19 // 0.24 is the original Pet Quail
20 // 0.25 is the modified Pet Quail
21 // 0.26 is the Robot code, which is generic
22
23 float VERSION = 0.26;
24 integer ENCRYPT = FALSE;
25 key YOUR_UUID = ""; // if you add a UUID for your avatar here, you can change it later
26 // and other alts or friends can edit and make these pets
27 // If you leave it blank, only the creator can work on them
28 string Animal = "Troubot"; // was 'Quail', must be the name of your animal
29 string Egg = "Nut and Bolt"; // was 'XS Egg', must be the name of your egg
30 string Crate = "Transport UFO"; // was XS-Cryocrate
31 string HomeObject = "Home Flag"; // was "XS Home Object
32 string sound = "robot_sound";
33 string SECRET_PASSWORD = "moonlet"; // must use one unique to any animal
34 integer SECRET_NUMBER = 99999; // any number thats a secret
35
36 integer MaxAge = 7; // can get prggers in 7 days
37 integer UNITS_OF_FOOD = 168; // food bowl food
38 float secs_to_grow = 86400; // grow daily = 86400
39
40 // global listeners
41
42 integer FOOD_CHANNEL = -999191;
43 integer ANIMAL_CHANNEL = -999192;
44 integer EGG_CHANNEL = -999193;
45 integer HOME_CHANNEL = -999194;
46 integer BOX_CHANNEL = -999195;
47 integer ACC_CHANNEL = -999196;
48 integer UPDATE_CHANNEL = -999197;
49 integer API_CHANNEL = -999198;
50
51 // global prim animation linkmessages on channel 1
52 // these are the prim animations played for each type of possible animation
53
54 string ANI_STAND = "stand"; // default standing animation
55 string ANI_WALKL = "left"; // triggers Left foot and righrt arm walk animation
56 string ANI_WALKR = "right"; // triggers Right foot and left arm walk animation
57 string ANI_SLEEP = "sleep"; // Sleeping
58 string ANI_WAVE = "wave"; // Calling for sex, needs help with food, etc.
59
60
61
62 // global link messages to control the animal
63 integer LINK_AGE_START = 800; // when quail is rezzed and secret_number, is sent by brain to breeder, eater and informatic get booted up
64 integer LINK_FOOD_CONSUME = 900; // from movement to brain when close to food, brain then consumes a random amount up to 10000
65 integer LINK_FOODMINUS = 901; // xs_brain receives FOOD_CONSUME, decrement hunger (eat)
66 integer LINK_HUNGRY = 903; // sent by eater (string)hunger_amount, checks each hour
67 integer LINK_HAMOUNT = 904; // hunger_amount = (integer)str,m updates the hunger amount in scripts
68 integer LINK_SET_HOME = 910; // loc ^ dist
69 integer LINK_MOVER = 911; // tell mover to rest for str seconds
70 integer LINK_FOODIE_CLR = 920; // clear all food_bowl_keys and contents
71 integer LINK_FOODIE = 921; // send FOOD_LOCATION coordinates to movement
72 integer LINK_COLOR1 = 930; // colour1
73 integer LINK_COLOR2 = 931; // colour2
74 integer LINK_SEX = 932; // sex
75 integer LINK_SHINE = 933; // shine
76 integer LINK_GLOW = 934; // glow
77 integer LINK_GEN = 935; // generation
78 integer LINK_RESET_SIZE = 936; // reset size to 1
79 integer LINK_MAGE = 940; // xs_brain sends, xs_ager consumes, adds str to age, if older than 7 days, will grow the animal
80 integer LINK_DAYTIME = 941; // xs_ager consumes, starts a timer of 86,400 seconds in xs_ager
81 integer LINK_GET_AGE = 942; // get age from xs_ager and sent it on channel 943
82 integer LINK_PUT_AGE = 943; // print age from xs_ager
83 integer LINK_PACKAGE = 950; // look for a cryo_crate
84 integer LINK_SEEK_FEMALE = 960; // MALE_BREED_CALL
85 integer LINK_MALE_BREED_CALL = 961; // triggered by LINK_SEEK_FEMALE
86 integer LINK_SIGNAL_ELIGIBLE = 962; // sent by female when hears LINK_MALE_BREED_CALL
87 integer LINK_FEMALE_ELIGIBLE = 963; // sent when it hears in chat FEMALE_ELIGIBLE
88 integer LINK_CALL_MALE = 964; // if LINK_FEMALE_ELIGIBLE && looking_for_female
89 integer LINK_MALE_ON_THE_WAY = 965; // triggered by LINK_CALL_MALE
90 integer LINK_FEMALE_LOCATION = 966; // female location, sends coordinates of a female
91 integer LINK_RQST_BREED = 967; // sent when close enough to male/female
92 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.
93 integer LINK_MALE_INFO = 969;
94 integer LINK_LAY_EGG = 970; // llRezObject("XS Egg"
95 integer LINK_BREED_FAIL = 971; // key = father, failed, timed out
96 integer LINK_PREGNANT = 972; // chick is preggers
97 integer LINK_SOUND_ON= 973; // sound is on
98 integer LINK_SOUND_OFF= 974; // sound is off
99 integer LINK_SLEEPING = 990; // close eyes
100 integer LINK_UNSLEEPING = 991; // open eyes
101 integer LINK_SOUND = 1001; // plays a sound if enabled
102 integer LINK_SPECIAL = 1010; // xs_special, is str = "Normal", removes script
103 integer LINK_PREGNANCY_TIME = 5000; // in seconds as str
104 integer LINK_SLEEP = 7999; // disable sleep by parameter
105 integer LINK_TIMER = 8000; // scan for food bowl about every 1800 seconds
106 integer LINK_DIE = 9999; // death
107
108
109 ///////// end global Link constants ////////
110
111
112 ///////////// END OF COPIED CODE ////////////
113
114
115 /////// DON'T CHANGE THE FOLLOWING! (Unless you know what you are doing!)
116
117 integer XTEA_DELTA = 0x9E3779B9; // (sqrt(5) - 1) * 2^31
118 integer xtea_num_rounds = 6;
119 list xtea_key = [0, 0, 0, 0];
120
121 integer hex2int(string hex) {
122 if(llGetSubString(hex,0,1) == "0x")
123 return (integer)hex;
124 if(llGetSubString(hex,0,0) == "x")
125 return (integer)("0"+hex);
126 return(integer)("0x"+hex);
127 }
128
129
130 // Convers any string to a 32 char MD5 string and then to a list of
131 // 4 * 32 bit integers = 128 bit Key. MD5 ensures always a specific
132 // 128 bit key is generated for any string passed.
133 list xtea_key_from_string( string str )
134 {
135 str = llMD5String(str,0); // Use Nonce = 0
136 return [ hex2int(llGetSubString( str, 0, 7)),
137 hex2int(llGetSubString( str, 8, 15)),
138 hex2int(llGetSubString( str, 16, 23)),
139 hex2int(llGetSubString( str, 24, 31))];
140 }
141
142 // Encipher two integers and return the result as a 12-byte string
143 // containing two base64-encoded integers.
144 string xtea_encipher( integer v0, integer v1 )
145 {
146 integer num_rounds = xtea_num_rounds;
147 integer sum = 0;
148 do {
149 // LSL does not have unsigned integers, so when shifting right we
150 // have to mask out sign-extension bits.
151 v0 += (((v1 << 4) ^ ((v1 >> 5) & 0x07FFFFFF)) + v1) ^ (sum + llList2Integer(xtea_key, sum & 3));
152 sum += XTEA_DELTA;
153 v1 += (((v0 << 4) ^ ((v0 >> 5) & 0x07FFFFFF)) + v0) ^ (sum + llList2Integer(xtea_key, (sum >> 11) & 3));
154
155 } while( num_rounds = ~-num_rounds );
156 //return only first 6 chars to remove "=="'s and compact encrypted text.
157 return llGetSubString(llIntegerToBase64(v0),0,5) +
159 }
160
161 // Decipher two base64-encoded integers and return the FIRST 30 BITS of
162 // each as one 10-byte base64-encoded string.
163 string xtea_decipher( integer v0, integer v1 )
164 {
165 integer num_rounds = xtea_num_rounds;
166 integer sum = XTEA_DELTA*xtea_num_rounds;
167 do {
168 // LSL does not have unsigned integers, so when shifting right we
169 // have to mask out sign-extension bits.
170 v1 -= (((v0 << 4) ^ ((v0 >> 5) & 0x07FFFFFF)) + v0) ^ (sum + llList2Integer(xtea_key, (sum>>11) & 3));
171 sum -= XTEA_DELTA;
172 v0 -= (((v1 << 4) ^ ((v1 >> 5) & 0x07FFFFFF)) + v1) ^ (sum + llList2Integer(xtea_key, sum & 3));
173 } while( num_rounds = ~-num_rounds );
174
175 return llGetSubString(llIntegerToBase64(v0), 0, 4) +
177 }
178
179 // Encrypt a full string using XTEA.
180 string xtea_encrypt_string( string str )
181 {
182 if(! ENCRYPT)
183 return str;
184 // encode string
185 str = llStringToBase64(str);
186 // remove trailing =s so we can do our own 0 padding
187 integer i = llSubStringIndex( str, "=" );
188 if( i != -1 )
189 str = llDeleteSubString( str, i, -1 );
190
191 // we don't want to process padding, so get length before adding it
192 integer len = llStringLength(str);
193
194 // zero pad
195 str += "AAAAAAAAAA=";
196
197 string result;
198 i = 0;
199
200 do {
201 // encipher 30 (5*6) bits at a time.
202 result += xtea_encipher(llBase64ToInteger(llGetSubString(str, i, i + 4) + "A="), llBase64ToInteger(llGetSubString(str, i+5, i + 9) + "A="));
203 i+=10;
204 } while( i < len );
205
206 return result;
207 }
208
209 // Decrypt a full string using XTEA
210 string xtea_decrypt_string( string str ) {
211 if(! ENCRYPT)
212 return str;
213 integer len = llStringLength(str);
214 integer i=0;
215 string result;
216 //llOwnerSay(str);
217 do {
218 integer v0;
219 integer v1;
220
221 v0 = llBase64ToInteger(llGetSubString(str, i, i + 5) + "==");
222 i+= 6;
223 v1 = llBase64ToInteger(llGetSubString(str, i, i + 5) + "==");
224 i+= 6;
225
226 result += xtea_decipher(v0, v1);
227 } while( i < len );
228
229 // Replace multiple trailing zeroes with a single one
230
231 i = llStringLength(result) - 1;
232 while( llGetSubString(result, i - 1, i) == "AA" ){
233 result = llDeleteSubString(result, i, i);
234 i--;
235 }
236 i = llStringLength(result) - 1;
237 // while(llGetSubString(result, i, i + 1) == "A" ) {
238 // i--;
239 // }
240 result = llGetSubString(result, 0, i+1);
241 i = llStringLength(result);
242 integer mod = i%4; //Depending on encoded length diffrent appends are needed
243 if(mod == 1) result += "A==";
244 else if(mod == 2 ) result += "==";
245 else if(mod == 3) result += "=";
246
247 return llBase64ToString(result);
248 }
249
250 string base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
251
252 //tunables
253 integer world = TRUE;
254
255
256 talkback()
257 {
258 vector pos = llGetPos();
259 vector size = llGetScale();
260
261 llShout(ANIMAL_CHANNEL, xtea_encrypt_string("XSPET^HOME_LOCATION^" + (string)pos + "^" + (string) size.x ) );
262 }
263
264
265 default
266 {
268 {
269 xtea_key = xtea_key_from_string(SECRET_PASSWORD);
270 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
271
272 }
273
274 touch_start(integer total_number)
275 {
276 if(llDetectedKey(0) == llGetOwner()) {
277 talkback();
278 llOwnerSay("Setting Home Location");
279 }
280
281 }
282
283 listen(integer channel, string name, key id, string msg)
284 {
285 talkback();
286 }
287
288
289 link_message(integer sender_num, integer num, string str, key id)
290 {
291 if(num == -999)
292 talkback();
293 }
294
295 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Version 0.32
3 // 05-29-2012
4
5
6 // xs_movement ( for walking on a globe )
7 // this replaces xs_movement, must be named 'xs_movement"
8
9 /////////////////////////////////////////////////////////////////////
10
11 // Based on code from Xundra Snowpaw
12 // New BSD License: http://www.opensource.org/licenses/bsd-license.php
13 // Copyright (c) 2010, Xundra Snowpaw
14 // All rights reserved.
15 //
16 // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17
18 //* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19 //* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
20 // in the documentationand/or other materials provided with the distribution.
21
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
24 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ////////////////////////////////////////////////////////////////////
29
30 ///////////////////////////////////////////////
31 // COPY FROM GLOBAL CONSTANTS FILE LOCATED IN Debug Folder
32 // INCLUDE THESE IN ALL SCRIPTS //
33 // XS_pet constants and names
34
35 ///// GLOBAL CONSTANTS extracted from original source //////
36 //
37 // if you change any of these constants, change it everywhere and in a list in XS_Debug so it can print them
38 //
39
40 float VERSION = 0.28;
41 integer ENCRYPT = FALSE; // set to TRUE to encrypt all data, Opensim prefers FALSE
42 key YOUR_UUID = ""; // if you add a UUID for your avatar here, you can change it later
43 // and other alts or friends can edit and make these pets
44 // If you leave it blank, only the creator can work on them
45 string Animal = "Troubot"; // was 'Quail', must be the name of your animal
46 string Egg = "Nut and Bolt"; // was 'XS Egg', must be the name of your egg
47 string Crate = "Transport UFO"; // was XS-Cryocrate
48 string HomeObject = "Home Flag"; // was "XS Home Object
49 string sound = "robot_sound";
50 string SECRET_PASSWORD = "top secret robot"; // must use one unique to any animal
51 integer SECRET_NUMBER = 99999; // any number thats a secret
52
53 integer MaxAge = 7; // can get prggers in 7 days
54 integer UNITS_OF_FOOD = 168; // food bowl food
55 float secs_to_grow = 86400; // grow daily = 86400
56
57 // global listeners
58
59 integer FOOD_CHANNEL = -999191;
60 integer ANIMAL_CHANNEL = -999192;
61 integer EGG_CHANNEL = -999193;
62 integer HOME_CHANNEL = -999194;
63 integer BOX_CHANNEL = -999195;
64 integer ACC_CHANNEL = -999196;
65 integer UPDATE_CHANNEL = -999197;
66 integer API_CHANNEL = -999198;
67
68 // global prim animation linkmessages on channel 1
69 // these are the prim animations played for each type of possible animation
70
71 string ANI_STAND = "stand"; // default standing animation
72 string ANI_WALKL = "left"; // triggers Left foot and righrt arm walk animation
73 string ANI_WALKR = "right"; // triggers Right foot and left arm walk animation
74 string ANI_SLEEP = "sleep"; // Sleeping
75 string ANI_WAVE = "wave"; // Calling for sex, needs help with food, etc.
76
77
78
79 // global link messages to control the animal
80 integer LINK_AGE_START = 800; // when quail is rezzed and secret_number, is sent by brain to breeder, eater and informatic get booted up
81 integer LINK_FOOD_CONSUME = 900; // from movement to brain when close to food, brain then consumes a random amount up to 10000
82 integer LINK_FOODMINUS = 901; // xs_brain receives FOOD_CONSUME, decrement hunger (eat)
83 integer LINK_HUNGRY = 903; // sent by eater (string)hunger_amount, checks each hour
84 integer LINK_HAMOUNT = 904; // hunger_amount = (integer)str,m updates the hunger amount in scripts
85 integer LINK_SET_HOME = 910; // loc ^ dist
86 integer LINK_MOVER = 911; // tell mover to rest for str seconds
87 integer LINK_FOODIE_CLR = 920; // clear all food_bowl_keys and contents
88 integer LINK_FOODIE = 921; // send FOOD_LOCATION coordinates to movement
89 integer LINK_COLOR1 = 930; // colour1
90 integer LINK_COLOR2 = 931; // colour2
91 integer LINK_SEX = 932; // sex
92 integer LINK_SHINE = 933; // shine
93 integer LINK_GLOW = 934; // glow
94 integer LINK_GEN = 935; // generation
95 integer LINK_RESET_SIZE = 936; // reset size to 1
96 integer LINK_MAGE = 940; // xs_brain sends, xs_ager consumes, adds str to age, if older than 7 days, will grow the animal
97 integer LINK_DAYTIME = 941; // xs_ager consumes, starts a timer of 86,400 seconds in xs_ager
98 integer LINK_GET_AGE = 942; // get age from xs_ager and sent it on channel 943
99 integer LINK_PUT_AGE = 943; // print age from xs_ager
100 integer LINK_PACKAGE = 950; // look for a cryo_crate
101 integer LINK_SEEK_FEMALE = 960; // MALE_BREED_CALL
102 integer LINK_MALE_BREED_CALL = 961; // triggered by LINK_SEEK_FEMALE
103 integer LINK_SIGNAL_ELIGIBLE = 962; // sent by female when hears LINK_MALE_BREED_CALL
104 integer LINK_FEMALE_ELIGIBLE = 963; // sent when it hears in chat FEMALE_ELIGIBLE
105 integer LINK_CALL_MALE = 964; // if LINK_FEMALE_ELIGIBLE && looking_for_female
106 integer LINK_MALE_ON_THE_WAY = 965; // triggered by LINK_CALL_MALE
107 integer LINK_FEMALE_LOCATION = 966; // female location, sends coordinates of a female
108 integer LINK_RQST_BREED = 967; // sent when close enough to male/female
109 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.
110 integer LINK_MALE_INFO = 969;
111 integer LINK_LAY_EGG = 970; // llRezObject("XS Egg"
112 integer LINK_BREED_FAIL = 971; // key = father, failed, timed out
113 integer LINK_PREGNANT = 972; // chick is preggers
114 integer LINK_SOUND_OFF= 974; // sound is off
115 integer LINK_SOUND_ON= 973; // sound is on
116 integer LINK_SLEEPING = 990; // close eyes
117 integer LINK_UNSLEEPING = 991; // open eyes
118 integer LINK_SOUND = 1001; // plays a sound if enabled
119 integer LINK_SPECIAL = 1010; // xs_special, is str = "Normal", removes script
120 integer LINK_PREGNANCY_TIME = 5000; // in seconds as str
121 integer LINK_SLEEP = 7999; // disable sleep by parameter
122 integer LINK_TIMER = 8000; // scan for food bowl about every 1800 seconds
123 integer LINK_DIE = 9999; // death
124
125
126 ///////// end global Link constants ////////
127
128
129 ///////////// END OF COPIED CODE ////////////
130
131
132
133
134 float GROWTH_AMOUNT = 0.10;
135
136 vector home_location;
137 float roam_distance;
138 list food_bowls;
139 list food_bowl_keys;
140 list food_bowl_time;
141
142 vector destination;
143
144 integer sex_dest = 0;
145 integer food_dest = 0;
146 float tolerance = 0.15;
147 float increment = 0.1;
148 integer rest;
149 integer age;
150 float zoffset;
151 integer sleep_last_check ;
152 integer sound_on;
153 integer sleep_disabled;
154
155
156 //new mover on a sphere
157 float RADIUS = 1.0;
158 rotation gOrient;
159 list gSilly_walks;
160 integer gCounter;
161
162
163
164 GetNewPos()
165 {
166 // start over and calc a new walk
167
168 gSilly_walks = [];
169
170
171 float x = llFrand(5) + 5;
172
173 float y = llFrand(5) + 5;
174
175 float z = llFrand(5) + 5;
176
177 if(llFrand(2) > 1)
178 x = 1-x;
179 if(llFrand(2) > 1)
180 y = 1-z;
181 if(llFrand(2) > 1)
182 z = 1-z;
183
184
185 rotation delta = llEuler2Rot(<x,y,z> * DEG_TO_RAD);
186
187 integer STEPS = llCeil( llFrand(10)) + 1;
188 integer i;
189 for (i = 0; i < STEPS; i++)
190 {
191 vector unitpos = llRot2Fwd( gOrient );
192 vector pos = home_location + unitpos * RADIUS;
193
194 gSilly_walks += pos;
195 gSilly_walks += gOrient;
196
197 gOrient = gOrient * delta;
198 }
199 }
200
201
202
203
204 face_target(vector lookat) {
205
206 rotation rot = llGetRot() * llRotBetween(<1.0 ,0.0 ,0.0 > * llGetRot(), lookat - llGetPos());
207
208
209 llMessageLinked(LINK_SET, 1, ANI_WALKL, "");
210 llMessageLinked(LINK_SET, 1, ANI_WALKR, "");
211
212 llSetRot(rot);
213 llSleep(.1);
214
215 rot = llGetRot() * llRotBetween(<0.0 ,0.0 ,1.0 > * llGetRot(), home_location - llGetPos());
216 llSetRot(rot);
217 }
218
219 integer sleeping()
220 {
222 if(!sleep_disabled) {
223 if(sun.z < 0) {
224 if(sleep_last_check == 0) {
225 // close eyes
226 llMessageLinked(LINK_SET, LINK_SLEEPING, "", "");
227 llMessageLinked(LINK_SET, 1, ANI_SLEEP, "");
228 }
229 sleep_last_check = 1;
230 } else {
231 if(sleep_last_check == 1) {
232 // open eyes
233 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
234 llMessageLinked(LINK_SET, LINK_UNSLEEPING, "", "");
235 }
236 sleep_last_check = 0;
237 }
238 return sleep_last_check;
239 } else {
240 if(sleep_last_check == 1) {
241 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
242 llMessageLinked(LINK_SET, LINK_UNSLEEPING, "", "");
243 sleep_last_check = 0;
244 }
245 return 0;
246 }
247 }
248
249 default
250 {
251 link_message(integer sender, integer num, string str, key id)
252 {
253 //llOwnerSay((string)num + "^" + (string)str);
254 if(num == LINK_AGE_START) {
255 state running;
256 }
257 }
258 }
259
260 state running
261 {
263 {
264 gOrient = ZERO_ROTATION;
265 home_location = <0,0,0>;
266 roam_distance = 0;
267 destination = <0,0,0>;
268 age = 0;
269 sleep_last_check = 0;
270 sound_on = 1;
271 }
272
273
274 timer()
275 {
276
277
278 if(!sleeping())
279 {
280 if(sound_on) {
281 llMessageLinked(LINK_SET, LINK_SOUND, "", "");
282 }
283 sound_on = !sound_on;
284
285 if(rest > 0) {
286 // llSetText((string) rest,<1,0,0>,1);
287 rest--;
288 return;
289 }
290
291 if(llVecDist( destination, llGetPos()) <= tolerance || destination == <0,0,0>)
292 {
293 // if at food_destination send 900 msg
294 if(food_dest > 0) {
295 llMessageLinked(LINK_SET, LINK_FOOD_CONSUME, (string)food_dest, llList2Key(food_bowl_keys, 0));
296 }
297
298 if(sex_dest > 0) {
299
300 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
301 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
302 llMessageLinked(LINK_SET, LINK_RQST_BREED, "", "");
303
304 }
305 // pick a new destination
306 sex_dest = 0;
307 food_dest = 0;
308
309 }
310
311
312 integer walkLength = llGetListLength(gSilly_walks);
313 if( walkLength > 0)
314 {
315 vector pos = llList2Vector(gSilly_walks,0);
316 rotation orient = llList2Rot(gSilly_walks,1);
317
318 gCounter++;
319 face_target(pos);
320 llSetPos(pos);
321
322
323
324 //llSetRot(orient);
325
326 gSilly_walks = llDeleteSubList(gSilly_walks,0,1); // we have walked in those shoes
327 }
328 else
329 {
330 GetNewPos();
331
332 rest = (integer)llFrand(12.0); // 1 minute rest
333 //llOwnerSay("resting for " + (string) rest);
334 }
335
336 llMessageLinked(LINK_SET, 1, ANI_WALKL, "");
337 llMessageLinked(LINK_SET, 1, ANI_WALKR, "");
338 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
339
340 }
341 }
342
343 link_message(integer sender, integer num, string str, key id)
344 {
345
346
347 // llOwnerSay((string)num + "^" + (string)str);
348
349
350
351 if(num == LINK_HUNGRY) {
352 if(sex_dest == 0) {
353 // move to food bowl, then send 900
354 if(llGetListLength(food_bowl_keys) > 0) {
355 if(roam_distance == 0 || home_location == <0,0,0>) {
356 llOwnerSay("I'm hungry, but I'm not homed so I can not move! Attempting to use Jedi Mind Powers to teleport food to my belly.");
357 llMessageLinked(LINK_SET, LINK_FOOD_CONSUME, str, llList2Key(food_bowl_keys, 0));
358 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
359 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
360 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
361 } else {
362 // find nearest food bowl
363 integer i;
364 destination = (vector)llList2String(food_bowls, 0);
365 for (i=1;i<llGetListLength(food_bowls);i++) {
366 if(llVecDist(destination, llGetPos()) > llVecDist((vector)llList2String(food_bowls, i), llGetPos())) {
367 destination = (vector)llList2String(food_bowls, i);
368 }
369 }
370 destination.z = home_location.z + zoffset;
371 // set destination,
372 // face it
373 face_target(destination);
374 food_dest = (integer)str;
375 rest = 0;
376 //llMessageLinked(LINK_SET, LINK_FOOD_CONSUME, str, llList2Key(food_bowl_keys, 0));
377 }
378 } else {
379 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
380 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
381 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
382 llOwnerSay("I'm hungry, but I can't seem to find any food bowls at present.");
383 }
384 }
385 } else
386 if(num == LINK_SET_HOME) {
387 list values = llParseString2List(str, ["^"], []);
388 home_location = (vector)llList2String(values, 0);
389 RADIUS = llList2Float(values, 1)/2;
390
391 //llOwnerSay("location:" + (string) home_location + " " + "distance:" + (string) roam_distance);
392
393
394 vector current_loc = llGetPos();
395
396 food_bowls = [];
397 food_bowl_keys = [];
398 food_bowl_time = [];
399
400 destination = <0,0,0>;
401 food_dest = 0;
402 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
403 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
404 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
405
406 GetNewPos();
407 llSetTimerEvent(4.0);
408
409 llOwnerSay("Homed");
410
411 } else
412 if(num == LINK_MOVER) {
413 if(rest < (integer)str) {
414 rest = (integer)str;
415 }
416 } else
417 if(num == LINK_FOODIE_CLR) {
418 food_bowls = [];
419 food_bowl_keys = [];
420 food_bowl_time = [];
421 } else
422 if(num == LINK_FOODIE) {
423 vector food_loc = (vector)str;
424
425 if(llVecDist(home_location, food_loc) <= roam_distance && llFabs(llFabs(home_location.z) - llFabs(food_loc.z)) < 2) {
426 if(llListFindList(food_bowls, (list)str) == -1) {
427 integer id_pos = llListFindList(food_bowl_keys, (list)id);
428 if(id_pos == -1) {
429 food_bowls += str;
430 food_bowl_keys += id;
431 food_bowl_time += llGetUnixTime();
432 } else {
433 food_bowls = llListReplaceList(food_bowls, [str], id_pos, id_pos);
434 food_bowl_time = llListReplaceList(food_bowl_time, [llGetUnixTime()], id_pos, id_pos);
435 }
436 }
437
438 integer iter;
439
440 iter = 0;
441
442 while(iter<llGetListLength(food_bowls)) {
443 if(llGetUnixTime() - llList2Integer(food_bowl_time, iter) > 3600) {//3600
444 food_bowls = llDeleteSubList(food_bowls, iter, iter);
445 food_bowl_keys = llDeleteSubList(food_bowl_keys, iter, iter);
446 food_bowl_time = llDeleteSubList(food_bowl_time, iter, iter);
447 } else {
448 iter++;
449 }
450 }
451
452 if(llGetListLength(food_bowls) > 0) {
453 llMessageLinked(LINK_SET, LINK_TIMER, "", "");
454 }
455 }
456 } else
457 if(num == LINK_FEMALE_LOCATION) {
458 destination = (vector)str;
459 face_target(destination);
460 rest = 0;
461 food_dest = 0;
462 sex_dest = 1;
463 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
464 llMessageLinked(LINK_SET, 1, ANI_WAVE, "");
465 llMessageLinked(LINK_SET, 1, ANI_STAND, "");
466 } else
467 if(num == LINK_MAGE) {
468 integer heightm;
469 age += (integer)str;
470 heightm = age;
471
472 if(heightm > MaxAge)
473 heightm = MaxAge;
474 float new_scale = (GROWTH_AMOUNT * heightm) + 1.0;
475
476 float legsz = 0.064 * new_scale; /// !!! does this need scaling?
477 float legso = 0.052399 * new_scale;
478
479 zoffset = 0 ;// no offset
480 } else
481 if(num == LINK_SLEEP) {
482 sleep_disabled = (integer)str;
483 }
484 }
485 }

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 // Version 0.32
3 // 05-29-2012
4
5 // Script to hear the home post
6 // This script goes in the Pet
7
8 // Author: Ferd Frederix
9 // Sphere World by Ferd Frederix is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
10 // Permission is granted to use this script in commercial projects where it is a part of a pet
11
12
13 integer ANIMAL_CHANNEL = -999192;
14 integer LINK_AGE_START = 800;
15 integer LINK_SET_HOME = 910; // loc ^ dist
16
17
18 default
19 {
21 {
22 llListen(ANIMAL_CHANNEL,"","","");
23 }
24
26 {
28 }
29
30 listen(integer channel, string name, key id, string message)
31 {
32
33 list data = llParseString2List(message,["^"],[]);
34 if(llList2String(data, 1) == "HOME_LOCATION") {
35
36 llMessageLinked(LINK_SET, LINK_AGE_START, "", "");
37
38 llSleep(1);
39
40 vector n_home_loc = (vector)llList2String(data, 2);
41 float home_dis = llList2Float(data, 3);
42 vector my_loc = llGetPos();
43
44 if(llGetOwnerKey(id) == llGetOwner()) {
45
46 llMessageLinked(LINK_SET, LINK_SET_HOME , (string)n_home_loc + "^" + (string)home_dis, "");
47 }
48 }
49 }
50
51 }

Sphere World

F

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 Sphere World
2
3
4 <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Dataset" property="dct:title" rel="dct:type">Sphere World</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Ferd Frederix</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/">Creative Commons Attribution-NonCommercial 3.0 Unported License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://metaverse.mitsi.com" rel="dct:source">metaverse.mitsi.com</a>.

Sphere World

Sphere World

Category: Sphere World
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-18
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 Sphere World
2
3
4 <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Dataset" property="dct:title" rel="dct:type">Sphere World</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Ferd Frederix</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/">Creative Commons Attribution-NonCommercial 3.0 Unported License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://metaverse.mitsi.com" rel="dct:source">metaverse.mitsi.com</a>.

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