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
Teleport Telepad for Opensim  

Telepad for Opensim

Opensim Teleporter with auto-sync

Category: Teleport
By : Nargus Asturias
Created: 2014-10-21 Edited: 2014-10-20
Worlds: Second Life

the Zip file

Download all files for Telepad for Opensim
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. menu.lsl
Get file # 2. tp script.lsl
1 // ********** SIMPLE DIALOG MODULE ********** //
2 // By Nargus Asturias
3 // Version 1.80
4 //
5 // Support only one dialog at a time. DO NOT request multiple dialog at once!
6 // Use of provided functions are recommented. Instruction here are for hardcore programmers only!
7 //
8 // Request: Send MessageLinked to the script. There are 3 dialog modes:
9 // lnkDialog : Normal dialog with message and buttons
10 // lnkDialogNumericAdjust : A dialog with buttons can be used to adjust numeric value
11 // lnkDialogNotify : Just a simple notification dialog. No return value and no buttons.
12 //
13 // Send MessageLinked with code lnkDialogReshow to force active dialog to reappear.
14 // Send MessageLinked with code lnkDialogCancel to force cancel active dialog
15 //
16 // If a lnkDialog is requested with more than 12 buttons, multi-pages dialog is used to show the buttons.
17 //
18 // [ For lnkDialog ]
19 // MessageLinked Format:
20 // String part: List dumped into string, each entry seperated by '||'
21 // Field 1: Dialog message (512 bytes maximum)
22 // Field 2: Time-out data (integer)
23 // Field 3-4: Button#1 and return value pair
24 // Field 5-6: Button#2 and return value pair
25 // And go on...
26 // Key part: Key of AV who attend this dialog
27 //
28 // Response: MessageLinked to the prim that requested dialog (but no where else)
29 // num == lnkDialogResponse: AV click on a button. The buttons value returned as a string
30 // num == lnkDialogTimeOut: Dialog timeout.
31 //
32 // [ For lnkDialogNumericAdjust ]
33 // MessageLinked Format:
34 // String part: List dumped into string, each entry seperated by '||'
35 // Field 1: Dialog message (512 bytes maximum)
36 // Put {VALUE} where you want the current value to be displayed)
37 // Field 2: Time-out data (integer)
38 // Field 3: Most significant value (ie. 100, for +/-100)
39 // Field 4: String-casted numeric value to be adjusted
40 // Field 5: 2nd most significant value (ie. 10, for +/-10)
41 // Field 6: Use '1' to enable "+/-" button, '0' otherwise.
42 // Field 7: 3nd significant value (ie. 1, for +/-1)
43 // Field 8: Use '1' for integer, or '0' for float
44 // Field 9: Least significant value (ie. 0.1, for +/-0.1)
45 // Field 10: Reserved. Not used.
46 // Key part: Key of AV who attend this dialog
47 //
48 // Response: MessageLinked to the prim that requested dialog (but no where else)
49 // num == lnkDialogResponse: OK or Cancel button is clicked. The final value returned as string.
50 // num == lnkDialogTimeOut: Dialog timeout.
51 //
52 // ******************************************* //
53
54 // Constants
55 integer lnkDialog = 14001;
56 integer lnkDialogNumericAdjust = 14005;
57 integer lnkDialogNotify = 14004;
58
59 integer lnkDialogReshow = 14011;
60 integer lnkDialogCancel = 14012;
61
62 integer lnkDialogResponse = 14002; // A button is hit, or OK is hit for lnkDialogNumericAdjust
63 integer lnkDialogCanceled = 14006; // Cancel is hit for lnkDialogNumericAdjust
64 integer lnkDialogTimeOut = 14003; // No button is hit, or Ignore is hit
65
66 integer lnkMenuClear = 15001;
67 integer lnkMenuAdd = 15002;
68 integer lnkMenuShow = 15003;
69 integer lnkMenuNotFound = 15010;
70
71 string seperator = "||";
72
73 // Menus variables
74 list menuNames = []; // List of names of all menus
75 list menus = []; // List of packed menus command, in order of menuNames
76
77 integer lastMenuIndex = 0; // Latest called menu's index
78
79 // Dialog variables
80 integer dialogChannel; // Channel number used to spawn this dialog
81 string message; // Message to be shown with the dialog
82 integer timerOut; // Dialog time-out
83 key keyId; // Key of user who attending this dialog
84 integer requestedNum; // Link-number of the requested prim
85 list buttons; // List of dialog buttons
86 list returns; // List of results from dialog buttons
87
88 float numericValue;
89 integer useInteger;
90
91 // Other variables
92 integer buttonsCount;
93 integer startItemNo;
94 integer listenId;
95
96 string redirectState;
97
98 integer responseInt = -1;
99 string responseStr;
100 key responseKey;
101
102 list order_buttons(list buttons)
103 {
104 return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
105 + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
106 }
107
108
109 // ********** String Functions **********
110 string replaceString(string pattern, string replace, string source){
111 integer index = llSubStringIndex(source, pattern);
112 if(index < 0) return source;
113
114 source = llDeleteSubString(source, index, (index + llStringLength(pattern) - 1));
115 return llInsertString(source, index, replace);
116 }
117
118 // ********** Dialog Functions **********
119 // Function: createDialog
120 // Create dialog with given message and buttons, direct to user with give id
121 integer createDialog(key id, string message, list buttons){
122 integer channel = -((integer)llFrand(8388608))*(255) - (integer)llFrand(8388608) - 11;
123
124 llListenRemove(listenId);
125 listenId = llListen(channel, "", keyId, "");
126 llDialog(keyId, message, order_buttons(buttons), channel);
127
128 return channel;
129 }
130
131 // Function: createMultiDialog
132 // Create dialog with multiple pages. Each page has Back, Next, and a Close button. Otherwise same functionality as createDialog() function.
133 integer createMultiDialog(key id, string message, list buttons, integer _startItemNo){
134 integer channel = -llRound(llFrand( llFabs(llSin(llGetGMTclock())) * 1000000 )) - 11;
135
136 if(_startItemNo < 0) _startItemNo = 0;
137 if(_startItemNo >= buttonsCount - 1) _startItemNo -= 9;
138 startItemNo = _startItemNo;
139
140 integer vButtonsCount = buttonsCount - 2;
141
142 // Generate list of buttons to be shown
143 string closeButton = llList2String(buttons, buttonsCount - 1);
144
145 integer stopItemNo = startItemNo + 8;
146 if(stopItemNo >= buttonsCount - 1) stopItemNo = vButtonsCount;
147
148 list thisButtons = llList2List(buttons, startItemNo, stopItemNo);
149
150 // Generate dialog navigation buttons
151 integer i = stopItemNo - startItemNo + 1;
152 i = i % 3;
153 if(i > 0)
154 {
155 while(i < 3)
156 {
157 thisButtons += [" "];
158 i++;
159 }
160 }
161
162 if(startItemNo > 0)
163 thisButtons += ["<< BACK"];
164 else thisButtons += [" "];
165
166 thisButtons += [closeButton];
167
168 if(stopItemNo < vButtonsCount)
169 thisButtons += ["NEXT >>"];
170 else thisButtons += [" "];
171
172 // Append page number to the message
173 integer pageNumber = (integer)(stopItemNo / 9) + 1;
174 integer pagesCount = llCeil(vButtonsCount / 9.0);
175 string vMessage = "PAGE: " + (string)pageNumber + " of " + (string)pagesCount + "\n" +
176 message;
177
178 // Display dialog
179 llListenRemove(listenId);
180 listenId = llListen(channel, "", keyId, "");
181 llDialog(keyId, vMessage, order_buttons(thisButtons), channel);
182
183 return channel;
184 }
185
186 // Function: generateNumericAdjustButtons
187 // Generate numeric adjustment dialog which adjustment values are in given list.
188 // If useNegative is TRUE, "+/-" button will be available.
189 list generateNumericAdjustButtons(list adjustValues, integer useNegative){
190 list dialogControlButtons;
191 list positiveButtons;
192 list negativeButtons;
193 list additionButtons;
194
195 dialogControlButtons = ["OK", "Cancel"];
196
197 // Config adjustment buttons
198 integer count = llGetListLength(adjustValues);
199 integer index;
200 for(index = 0; (index < count) && (index < 3); index++){
201 string sValue = llList2String(adjustValues, index);
202
203 if((float)sValue != 0){
204 positiveButtons += ["+" + sValue];
205 negativeButtons += ["-" + sValue];
206 }
207 }
208
209 // Check positive/negative button
210 if(useNegative)
211 additionButtons = ["+/-"];
212 else additionButtons = [];
213
214 // If there is fourth adjustment button
215 if(count > 3){
216 if(llGetListLength(additionButtons) == 0) additionButtons = [" "];
217
218 string sValue = llList2String(adjustValues, index);
219 additionButtons += ["+" + sValue, "-" + sValue];
220 }else if(additionButtons != []) additionButtons += [" ", " "];
221
222 // Return list dialog buttons
223 return additionButtons + negativeButtons + positiveButtons + dialogControlButtons;
224 }
225
226 setResponse(integer int, string str, key id){
227 responseInt = int;
228 responseStr = str;
229 responseKey = id;
230 }
231
232 checkDialogRequest(integer sender_num, integer num, string str, key id){
233 if((num == lnkDialogNotify) || (num == lnkDialogNumericAdjust) || (num == lnkDialog)){
234 list data = llParseStringKeepNulls(str, [seperator], []);
235
236 message = llList2String(data, 0);
237 timerOut = llList2Integer(data, 1);
238 keyId = id;
239 requestedNum = sender_num;
240 buttons = [];
241 returns = [];
242
243 if(message == "") message = " ";
244 if(timerOut > 7200) timerOut = 7200;
245 integer i;
246 integer count;
247 count = llGetListLength(data);
248 for(i=2; i<count; i += 0){
249 buttons += [llList2String(data, i++)];
250 returns += [llList2String(data, i++)];
251 }
252
253 buttonsCount = llGetListLength(buttons);
254
255 if(num == lnkDialogNotify){
256 dialogChannel = -((integer)llFrand(8388608))*(255) - (integer)llFrand(8388608) - 11;
257 llDialog(keyId, message, order_buttons(buttons), dialogChannel);
258 return;
259 }else if(num == lnkDialogNumericAdjust)
260 redirectState = "NumericAdjustDialog";
261 else if(num == lnkDialog){
262 if(buttonsCount > 12)
263 redirectState = "MultiDialog";
264 else redirectState = "Dialog";
265 }
266
267 if(TRUE) state StartDialog;
268 }else checkMenuRequest(sender_num, num, str, id);
269 }
270
271 // ********** Menu Functions **********
272 clearMenusList(){
273 menuNames = [];
274 menus = [];
275
276 lastMenuIndex = 0;
277 }
278
279 addMenu(string name, string message, list buttons, list returns){
280 // Reduced menu request time by packing request commands
281 string packed_message = message + seperator + "0";
282
283 integer i;
284 integer count = llGetListLength(buttons);
285 for(i=0; i<count; i++) packed_message += seperator + llList2String(buttons, i) + seperator + llList2String(returns, i);
286
287 // Add menu to the menus list
288 integer index = llListFindList(menuNames, [name]);
289 if(index >= 0)
290 menus = llListReplaceList(menus, [packed_message], index, index);
291 else{
292 menuNames += [name];
293 menus += [packed_message];
294 }
295 }
296
297 integer showMenu(string name, key id){
298 if(llGetListLength(menuNames) <= 0) return FALSE;
299
300 integer index;
301 if(name != ""){
302 index = llListFindList(menuNames, [name]);
303 if(index < 0) return FALSE;
304 }else index = lastMenuIndex;
305
306 lastMenuIndex = index;
307
308 // Load menu command and execute
309 string packed_message = llList2String(menus, index);
310 llMessageLinked(LINK_THIS, lnkDialog, packed_message, id);
311 return TRUE;
312 }
313
314 checkMenuRequest(integer sender_num, integer num, string str, key id){
315 // Menu response commands
316 if(num == lnkDialogResponse){
317 if(llGetSubString(str, 0, 4) == "MENU_"){
318 str = llDeleteSubString(str, 0, 4);
319 showMenu(str, id);
320 }
321 }
322
323 // Menu management commands
324 else if(num == lnkMenuClear)
325 clearMenusList();
326 else if(num == lnkMenuAdd){
327 list data = llParseString2List(str, [seperator], []);
328
329 string message = llList2String(data, 0);
330 list buttons = [];
331 list returns = [];
332
333 integer i;
334 integer count = llGetListLength(data);
335 for(i=2; i<count; i += 0){
336 buttons += [llList2String(data, i++)];
337 returns += [llList2String(data, i++)];
338 }
339
340 addMenu((string)id, message, buttons, returns);
341
342 }else if(num == lnkMenuShow){
343 if(!showMenu(str, id)) llMessageLinked(sender_num, lnkMenuNotFound, str, NULL_KEY);
344 }
345 }
346
347 // ********** States **********
348 default{
350 if(responseInt > 0) llMessageLinked(requestedNum, responseInt, responseStr, responseKey);
351 }
352
353 link_message(integer sender_num, integer num, string str, key id){
354 checkDialogRequest(sender_num, num, str, id);
355 }
356 }
357
358 state StartDialog{
360 if(redirectState == "Dialog") state Dialog;
361 else if(redirectState == "MultiDialog") state MultiDialog;
362 else if(redirectState == "NumericAdjustDialog") state NumericAdjustDialog;
363 else state default;
364 }
365 }
366
367 state Dialog{
369 responseInt = -1;
370 dialogChannel = createDialog(keyId, message, buttons);
371 llSetTimerEvent(timerOut);
372 }
373
374 state_exit(){
376 }
377
378 on_rez(integer start_param){
379 state default;
380 }
381
382 timer(){
383 setResponse(lnkDialogTimeOut, "", keyId);
384 state default;
385 }
386
387 link_message(integer sender_num, integer num, string str, key id){
388 if(num == lnkDialogReshow){
389 dialogChannel = createDialog(keyId, message, buttons);
390 llSetTimerEvent(timerOut);
391 }else if(num == lnkDialogCancel) state default;
392
393 else checkDialogRequest(sender_num, num, str, id);
394 }
395
396 listen(integer channel, string name, key id, string msg){
397 if((channel != dialogChannel) || (id != keyId)) return;
398
399 integer index = llListFindList(buttons, [msg]);
400 setResponse(lnkDialogResponse, llList2String(returns, index), keyId);
401 state default;
402 }
403 }
404
405 state MultiDialog {
407 responseInt = -1;
408 startItemNo = 0;
409 dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo);
410 llSetTimerEvent(timerOut);
411 }
412
413 state_exit(){
415 }
416
417 on_rez(integer start_param){
418 state default;
419 }
420
421 timer(){
422 setResponse(lnkDialogTimeOut, "", keyId);
423 state default;
424 }
425
426 link_message(integer sender_num, integer num, string str, key id){
427 if(num == lnkDialogReshow){
428 dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo);
429 llSetTimerEvent(timerOut);
430 }else if(num == lnkDialogCancel) state default;
431
432 else checkDialogRequest(sender_num, num, str, id);
433 }
434
435 listen(integer channel, string name, key id, string msg){
436 if((channel != dialogChannel) || (id != keyId)) return;
437
438 // Dialog control buttons
439 if(msg == "<< BACK"){
440 dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo - 9);
441 llSetTimerEvent(timerOut);
442 }else if(msg == "NEXT >>"){
443 dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo + 9);
444 llSetTimerEvent(timerOut);
445 }else if(msg == " "){
446 dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo);
447 llSetTimerEvent(timerOut);
448
449 // Response buttons
450 }else{
451 integer index = llListFindList(buttons, [msg]);
452 setResponse(lnkDialogResponse, llList2String(returns, index), keyId);
453 state default;
454 }
455 }
456 }
457
458 state NumericAdjustDialog {
460 responseInt = -1;
461
462 numericValue = llList2Float(returns, 0);
463 useInteger = llList2Integer(returns, 2);
464 buttons = generateNumericAdjustButtons(buttons, llList2Integer(returns, 1));
465
466 string vMessage;
467 if(useInteger)
468 vMessage = replaceString("{VALUE}", (string)((integer)numericValue), message);
469 else vMessage = replaceString("{VALUE}", (string)numericValue, message);
470
471 dialogChannel = createDialog(keyId, vMessage, buttons);
472 llSetTimerEvent(timerOut);
473 }
474
475 state_exit(){
477 }
478
479 on_rez(integer start_param){
480 state default;
481 }
482
483 timer(){
484 setResponse(lnkDialogTimeOut, "", keyId);
485 state default;
486 }
487
488 link_message(integer sender_num, integer num, string str, key id){
489 if(num == lnkDialogReshow){
490 dialogChannel = createDialog(keyId, message, buttons);
491 llSetTimerEvent(timerOut);
492 }else if(num == lnkDialogCancel) state default;
493
494 else checkDialogRequest(sender_num, num, str, id);
495 }
496
497 listen(integer channel, string name, key id, string msg){
498 if((channel != dialogChannel) || (id != keyId)) return;
499
500 // Dialog control button is hit
501 if(msg == "OK"){
502 setResponse(lnkDialogResponse, (string)numericValue, keyId);
503 state default;
504 }else if(msg == "Cancel"){
505 setResponse(lnkDialogCanceled, (string)numericValue, keyId);
506 llMessageLinked(requestedNum, lnkDialogCanceled, (string)numericValue, keyId);
507 state default;
508
509 // Value adjustment button is hit
510 }else if(msg == "+/-")
511 numericValue = -numericValue;
512 else if(llSubStringIndex(msg, "+") == 0)
513 numericValue += (float)llDeleteSubString(msg, 0, 0);
514 else if(llSubStringIndex(msg, "-") == 0)
515 numericValue -= (float)llDeleteSubString(msg, 0, 0);
516
517 // Spawn another dialog if no OK nor Cancel is hit
518 string vMessage;
519 if(useInteger)
520 vMessage = replaceString("{VALUE}", (string)((integer)numericValue), message);
521 else vMessage = replaceString("{VALUE}", (string)numericValue, message);
522 dialogChannel = createDialog(keyId, vMessage, buttons);
523 llSetTimerEvent(timerOut);
524 }
525 }

Telepad for Opensim

Opensim TReleport with auto sync

Category: Teleport
By : Nargus Asturias
Created: 2014-10-21 Edited: 2014-10-20
Worlds: Second Life

1 //
2 // Telepad Instructions
3 //
4 // This Networked Telepad system allows you to
5 // create teleport points throughout a region.
6 // Its almost too easy to use.
7 //
8 // 1) Simply Rez a pad where you want a TP Point.
9 // 2) Edit the description (*not* the name) of
10 // the object to the name of the place
11 // (House, Pool, Skybox, etc...)
12 // 3) Click on the telepad, and choose "Reset"
13 // from the dialog box. Only the owner can do this.
14 // (this adds the telepad to the network)
15 //
16 // InWorldz and OpenSim 0.6.9 (osgrid and others) Caviat! (fixed in 0.7.1)
17 // Don't rotate the prim! Be sure it is set to Rotation 0,0,0
18 // There is a little bug that prevents the teleporter from dropping
19 // you off in the right place. However, when the bug is fixed, this script
20 // should work even with rotations, or child rotaions, unless rotations will
21 // be working differently than the other place. Also, if it is inside a child
22 // prim, it is likely to have rotation issues as well.
23 //
24 // **Important** if you move a telepad, or delete one,
25 // you must use "Reset" to be sure all telepads receive
26 // the changes. (Reset just the one you moved, not all of them)
27 //
28 // To use it, touch it, choose the destination, then right
29 // click it and choose Teleport.
30 //
31 // ** advanced **
32 // If the description starts with a minus (for example -Beach)
33 // then the telepad will serve as a direct telepad to that // // location.
34 //
35 // To use a special channel number for the network other
36 // than the default.. add colon channel number to the description.
37 // For example Beach:-99999
38 //
39
40
41
42
43 integer network_channel = -23423432; // default
44 integer dialog_channel = 0;
45
46 integer same_owner = TRUE;
47 integer directMode = FALSE;
48 float timeout = 15.0;
49
50 string myname;
51 list pads;
52
53 string destination;
54
55 integer collecting = FALSE;
56
57 //== dialog control stuff
58
59 // ********** DIALOG FUNCTIONS **********
60 // Dialog constants
61 integer lnkDialog = 14001;
62 integer lnkDialogNotify = 14004;
63 integer lnkDialogResponse = 14002;
64 integer lnkDialogTimeOut = 14003;
65
66 integer lnkDialogReshow = 14011;
67 integer lnkDialogCancel = 14012;
68
69 integer lnkMenuClear = 15001;
70 integer lnkMenuAdd = 15002;
71 integer lnkMenuShow = 15003;
72
73 string seperator = "||";
74 integer dialogTimeOut = 0;
75
76 string packDialogMessage(string message, list buttons, list returns){
77 string packed_message = message + seperator + (string)dialogTimeOut;
78
79 integer i;
80 integer count = llGetListLength(buttons);
81 for(i=0; i<count; i++){
82 string button = llList2String(buttons, i);
83 if(llStringLength(button) > 24) button = llGetSubString(button, 0, 23);
84 packed_message += seperator + button + seperator + llList2String(returns, i);
85 }
86
87 return packed_message;
88 }
89
90 dialogReshow(){llMessageLinked(LINK_THIS, lnkDialogReshow, "", NULL_KEY);}
91 dialogCancel(){
92 llMessageLinked(LINK_THIS, lnkDialogCancel, "", NULL_KEY);
93 llSleep(1);
94 }
95
96 dialog(key id, string message, list buttons, list returns){
97 llMessageLinked(LINK_THIS, lnkDialog, packDialogMessage(message, buttons, returns), id);
98 }
99
100 dialogNotify(key id, string message){
101 //list rows;
102
103 llMessageLinked(LINK_THIS, lnkDialogNotify,
104 message + seperator + (string)dialogTimeOut + seperator,
105 id);
106 }
107 // ********** END DIALOG FUNCTIONS **********
108
109
110
111
112 dotext()
113 {
114
115 string tex = "Telepad\n";
116 if(directMode)
117 {
118 tex += "Direct Teleport to "+myname;
119 llSetSitText("Teleport");
120 }
121 else
122 {
123 if(destination != "")
124 {
125 tex += "Click to go to "+destination +
126 "\n.\nRight-Click->Touch\nfor another Destination\n";
127 llSetSitText("Teleport");
128 }
129 else
130 {
131 tex += "Click to choose Destination\n";
132 llSetSitText(".");
133 }
134 }
135 llSetText(tex,<1.0,1.0,1.0>,1.0);
136 }
137
138 pinger()
139 {
140 if(directMode) return;
141 llRegionSay(network_channel,llDumpList2String(
142 [ myname, llGetPos(), llGetRot() ], ":"));
143 }
144
145 setupMenus()
146 {
147
148 llMessageLinked(LINK_THIS, lnkMenuClear, "", NULL_KEY);
149
150 list b1;
151 list b2;
152
153 integer n;
154 integer i;
155
156 pads = llListSort(pads,3,TRUE);
157 n = llGetListLength(pads);
158 for (i = 0; i < n; i += 3)
159 {
160 b1 += [ llList2String(pads,i) ];
161 b2 += [ "pad," + llList2String(pads,i) ];
162 }
164
165 llMessageLinked(LINK_THIS, lnkMenuAdd, packDialogMessage(
166 "[ Networked Telepad ]\n" +
167 " Choose Destination",
168 b1 + [ " " ],
169 b2 + [ " " ]
170 ), "MainMenu");
171
172
173 llMessageLinked(LINK_THIS, lnkMenuAdd, packDialogMessage(
174 "[ Networked Telepad ]\n" +
175 " Choose Destination",
176 b1 + [ "Reset" ],
177 b2 + [ "RESET" ]
178 ), "OwnerMenu");
179
180 }
181
182
183
184
185 default
186 {
188 {
191 dotext();
192 string mydesc = llGetObjectDesc();
193 list d = llParseString2List(mydesc,[ ":" ],[]);
194 myname = llList2String(d,0);
195 if(llGetSubString(myname,0,0) == "-")
196 {
197 directMode = TRUE;
198 myname = llGetSubString(myname,1,-1);
199 dotext();
200 }
201 string altchan = llList2String(d,1);
202 integer n = (integer)altchan;
203 if(n != 0)
204 {
205 if(n > 0) n = - n;
206 network_channel = n;
207 }
208 if((float)llList2String(d,2) > 0)
209 {
210 timeout = (float)llList2String(d,2);
211 }
212 if(myname == "")
213 {
214 llOwnerSay("Please name this telepad by putting a name in the objects description");
215 return;
216 }
217 llListen(network_channel,"",NULL_KEY,"");
218 llRegionSay(network_channel,"ping");
219 collecting = TRUE;
220 llSleep(0.2 + llFrand(0.3));
221 llSetTimerEvent(2.0);
222 pinger();
223 }
224 on_rez(integer num)
225 {
227 }
228 listen(integer chan, string name, key id, string message)
229 {
230 if(same_owner)
231 {
232 key ok = llGetOwnerKey(id);
233 if(ok != llGetOwner()) return;
234 }
235 if(message == "ping")
236 {
237 pads = [];
238 llSetTimerEvent(2.0);
239 collecting = TRUE;
240 pinger();
241 return;
242 }
243 list v = llParseString2List(message,[ ":" ],[]);
244 if(llGetListLength(v) != 3) return;
245
246 string n = llList2String(v,0);
247 if(directMode && n != myname) return;
248
249 vector vec = (vector)llList2String(v,1);
250 rotation rot = (rotation)llList2String(v,2);
251 integer i = llListFindList(pads, [ n ]);
252 if(i > -1)
253 {
254 pads = llListReplaceList(pads, [ n, vec, rot ], i, i+2);
255 }
256 else
257 {
258 pads += [ n, vec, rot ];
259 }
260 if(directMode)
261 {
262 vec = ( vec - llGetPos() ) / llGetRot();
263 rot = rot / llGetRot();
264 vec.z += 1.5;
265 llSitTarget(vec,rot);
267 }
268 else
269 {
270 collecting = TRUE;
271 llSetTimerEvent(2.0);
272 }
273
274 }
276 {
277 if(collecting) return;
278 key toucher = llDetectedKey(0);
279 if(toucher == llGetOwner())
280 {
281 llMessageLinked(LINK_THIS, lnkMenuShow, "OwnerMenu", llDetectedKey(0));
282 }
283 else
284 {
285 llMessageLinked(LINK_THIS, lnkMenuShow, "MainMenu", llDetectedKey(0));
286 }
287 }
288 timer()
289 {
290 if(collecting)
291 {
292 llSetTimerEvent(0.0);
293 setupMenus();
294 collecting = FALSE;
295 return;
296 }
299 destination = "";
300 dotext();
301 }
302 changed(integer change)
303 {
304 if(change & CHANGED_LINK)
305 {
306 llSleep(0.1);
308 {
310 if(!directMode) llSetTimerEvent(timeout);
311 }
312 }
313 }
314 link_message(integer sender, integer num, string message, key id)
315 {
316 if(num == lnkDialogResponse)
317 {
318 integer p = llSubStringIndex(message,",");
319 //integer s;
320 string cmd;
321 string rest;
322 if(p > -1)
323 {
324 cmd = llToLower(llGetSubString(message,0,p-1));
325 rest = llGetSubString(message,p+1,-1);
326 }
327 else
328 {
329 cmd = llToLower(message);
330 }
331 if(id == llGetOwner() && message == "RESET") llResetScript();
332 if(cmd == "pad")
333 {
334 integer ii = llListFindList(pads, [ rest ]);
335 if(ii > -1)
336 {
337 destination = rest;
338 vector vv = llList2Vector(pads,ii+1);
339 rotation rr = llList2Rot(pads,ii+2);
340 vv = (vv - llGetPos()) / llGetRot();
341 rr = rr / llGetRot();
342 vv.z += 1.5;
343 llSitTarget(vv,rr);
345 if(!directMode) llSetTimerEvent(timeout);
346 dotext();
347 }
348 }
349 }
350 }
351 }

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