aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_library
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/lscript/lscript_library
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/lscript/lscript_library')
-rw-r--r--linden/indra/lscript/lscript_library/lscript_alloc.cpp1121
-rw-r--r--linden/indra/lscript/lscript_library/lscript_export.cpp27
-rw-r--r--linden/indra/lscript/lscript_library/lscript_library.cpp576
-rw-r--r--linden/indra/lscript/lscript_library/lscript_library.vcproj183
4 files changed, 1907 insertions, 0 deletions
diff --git a/linden/indra/lscript/lscript_library/lscript_alloc.cpp b/linden/indra/lscript/lscript_library/lscript_alloc.cpp
new file mode 100644
index 0000000..978d7f2
--- /dev/null
+++ b/linden/indra/lscript/lscript_library/lscript_alloc.cpp
@@ -0,0 +1,1121 @@
1/**
2 * @file lscript_alloc.cpp
3 * @brief general heap management for scripting system
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28// #define at top of file accelerates gcc compiles
29// Under gcc 2.9, the manual is unclear if comments can appear above #ifndef
30// Under gcc 3, the manual explicitly states comments can appear above the #ifndef
31
32#include "linden_common.h"
33
34#include "lscript_alloc.h"
35
36// supported data types
37
38// basic types
39// integer 4 bytes of integer data
40// float 4 bytes of float data
41// string data null terminated 1 byte string
42// key data null terminated 1 byte string
43// vector data 12 bytes of 3 floats
44// quaternion data 16 bytes of 4 floats
45
46// list type
47// list data 4 bytes of number of entries followed by pointer
48
49// string pointer 4 bytes of address of string data on the heap (only used in list data)
50// key pointer 4 bytes of address of key data on the heap (only used in list data)
51
52// heap format
53//
54// 4 byte offset to next block (in bytes)
55// 1 byte of type of variable or empty
56// 2 bytes of reference count
57// nn bytes of data
58
59void reset_hp_to_safe_spot(const U8 *buffer)
60{
61 set_register((U8 *)buffer, LREG_HP, TOP_OF_MEMORY);
62}
63
64// create a heap from the HR to TM
65BOOL lsa_create_heap(U8 *heap_start, S32 size)
66{
67 LLScriptAllocEntry entry(size, LST_NULL);
68
69 S32 position = 0;
70
71 alloc_entry2bytestream(heap_start, position, entry);
72
73 return TRUE;
74}
75
76S32 lsa_heap_top(U8 *heap_start, S32 maxtop)
77{
78 S32 offset = 0;
79 LLScriptAllocEntry entry;
80 bytestream2alloc_entry(entry, heap_start, offset);
81
82 while (offset + entry.mSize < maxtop)
83 {
84 offset += entry.mSize;
85 bytestream2alloc_entry(entry, heap_start, offset);
86 }
87 return offset + entry.mSize;
88}
89
90
91// adding to heap
92// if block is empty
93// if block is at least block size + 4 larger than data
94// split block
95// insert data into first part
96// return address
97// else
98// insert data into block
99// return address
100// else
101// if next block is >= SP
102// set Stack-Heap collision
103// return NULL
104// if next block is empty
105// merge next block with current block
106// go to start of algorithm
107// else
108// move to next block
109// go to start of algorithm
110
111S32 lsa_heap_add_data(U8 *buffer, LLScriptLibData *data, S32 heapsize, BOOL b_delete)
112{
113 if (get_register(buffer, LREG_FR))
114 return 1;
115 LLScriptAllocEntry entry, nextentry;
116 S32 hr = get_register(buffer, LREG_HR);
117 S32 hp = get_register(buffer, LREG_HP);
118 S32 current_offset, next_offset, offset = hr;
119 S32 size = 0;
120
121 switch(data->mType)
122 {
123 case LST_INTEGER:
124 size = 4;
125 break;
126 case LST_FLOATINGPOINT:
127 size = 4;
128 break;
129 case LST_KEY:
130 size = (S32)strlen(data->mKey) + 1;
131 break;
132 case LST_STRING:
133 size = (S32)strlen(data->mString) + 1;
134 break;
135 case LST_LIST:
136 // list data 4 bytes of number of entries followed by number of pointer
137 size = 4 + 4*data->getListLength();
138 if (data->checkForMultipleLists())
139 {
140 set_fault(buffer, LSRF_NESTING_LISTS);
141 }
142 break;
143 case LST_VECTOR:
144 size = 12;
145 break;
146 case LST_QUATERNION:
147 size = 16;
148 break;
149 default:
150 break;
151 }
152
153 current_offset = offset;
154 bytestream2alloc_entry(entry, buffer, offset);
155
156 do
157 {
158 hp = get_register(buffer, LREG_HP);
159 if (!entry.mType)
160 {
161 if (entry.mSize >= size + SIZEOF_SCRIPT_ALLOC_ENTRY + 4)
162 {
163 offset = current_offset;
164 lsa_split_block(buffer, offset, size, entry);
165 entry.mType = data->mType;
166 entry.mSize = size;
167 entry.mReferenceCount = 1;
168 offset = current_offset;
169 alloc_entry2bytestream(buffer, offset, entry);
170 lsa_insert_data(buffer, offset, data, entry, heapsize);
171 hp = get_register(buffer, LREG_HP);
172 S32 new_hp = current_offset + size + 2*SIZEOF_SCRIPT_ALLOC_ENTRY;
173 if (new_hp >= hr + heapsize)
174 {
175 break;
176 }
177 if (new_hp > hp)
178 {
179 set_register(buffer, LREG_HP, new_hp);
180 hp = get_register(buffer, LREG_HP);
181 }
182 if (b_delete)
183 delete data;
184 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
185 // and function clean up of ref counts isn't based on scope (a mistake, I know)
186 if (current_offset <= hp)
187 return current_offset - hr + 1;
188 else
189 return hp - hr + 1;
190 }
191 else if (entry.mSize >= size)
192 {
193 entry.mType = data->mType;
194 entry.mReferenceCount = 1;
195 offset = current_offset;
196 alloc_entry2bytestream(buffer, offset, entry);
197 lsa_insert_data(buffer, offset, data, entry, heapsize);
198 hp = get_register(buffer, LREG_HP);
199 if (b_delete)
200 delete data;
201 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
202 // and function clean up of ref counts isn't based on scope (a mistake, I know)
203 return current_offset - hr + 1;
204 }
205 }
206 offset += entry.mSize;
207 if (offset < hr + heapsize)
208 {
209 next_offset = offset;
210 bytestream2alloc_entry(nextentry, buffer, offset);
211 if (!nextentry.mType && !entry.mType)
212 {
213 entry.mSize += nextentry.mSize + SIZEOF_SCRIPT_ALLOC_ENTRY;
214 offset = current_offset;
215 alloc_entry2bytestream(buffer, offset, entry);
216 }
217 else
218 {
219 current_offset = next_offset;
220 entry = nextentry;
221 }
222
223 // this works whether we are bumping out or coming in
224 S32 new_hp = current_offset + size + 2*SIZEOF_SCRIPT_ALLOC_ENTRY;
225
226 // make sure we aren't about to be stupid
227 if (new_hp >= hr + heapsize)
228 {
229 break;
230 }
231 if (new_hp > hp)
232 {
233 set_register(buffer, LREG_HP, new_hp);
234 hp = get_register(buffer, LREG_HP);
235 }
236 }
237 else
238 {
239 break;
240 }
241 } while (1);
242 set_fault(buffer, LSRF_STACK_HEAP_COLLISION);
243 reset_hp_to_safe_spot(buffer);
244 if (b_delete)
245 delete data;
246 return 0;
247}
248
249// split block
250// set offset to point to new block
251// set offset of new block to point to original offset - block size - data size
252// set new block to empty
253// set new block reference count to 0
254void lsa_split_block(U8 *buffer, S32 &offset, S32 size, LLScriptAllocEntry &entry)
255{
256 if (get_register(buffer, LREG_FR))
257 return;
258 LLScriptAllocEntry newentry;
259
260 newentry.mSize = entry.mSize - SIZEOF_SCRIPT_ALLOC_ENTRY - size;
261 entry.mSize -= newentry.mSize + SIZEOF_SCRIPT_ALLOC_ENTRY;
262
263 alloc_entry2bytestream(buffer, offset, entry);
264 S32 orig_offset = offset + size;
265 alloc_entry2bytestream(buffer, orig_offset, newentry);
266}
267
268// insert data
269// if data is non-list type
270// set type to basic type, set reference count to 1, copy data, return address
271// else
272// set type to list data type, set reference count to 1
273// save length of list
274// for each list entry
275// insert data
276// return address
277
278void lsa_insert_data(U8 *buffer, S32 &offset, LLScriptLibData *data, LLScriptAllocEntry &entry, S32 heapsize)
279{
280 if (get_register(buffer, LREG_FR))
281 return;
282 if (data->mType != LST_LIST)
283 {
284 switch(data->mType)
285 {
286 case LST_INTEGER:
287 integer2bytestream(buffer, offset, data->mInteger);
288 break;
289 case LST_FLOATINGPOINT:
290 float2bytestream(buffer, offset, data->mFP);
291 break;
292 case LST_KEY:
293 char2bytestream(buffer, offset, data->mKey);
294 break;
295 case LST_STRING:
296 char2bytestream(buffer, offset, data->mString);
297 break;
298 case LST_VECTOR:
299 vector2bytestream(buffer, offset, data->mVec);
300 break;
301 case LST_QUATERNION:
302 quaternion2bytestream(buffer, offset, data->mQuat);
303 break;
304 default:
305 break;
306 }
307 }
308 else
309 {
310 // store length of list
311 integer2bytestream(buffer, offset, data->getListLength());
312 data = data->mListp;
313 while(data)
314 {
315 // store entry and then store address if valid
316 S32 address = lsa_heap_add_data(buffer, data, heapsize, FALSE);
317 integer2bytestream(buffer, offset, address);
318 data = data->mListp;
319 }
320 }
321}
322
323S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
324{
325 S32 offset = 0;
326 S32 size = 0;
327
328 LLScriptAllocEntry entry;
329
330 if (!data)
331 {
332 entry.mType = LST_NULL;
333 entry.mReferenceCount = 0;
334 entry.mSize = MAX_HEAP_SIZE;
335 size = SIZEOF_SCRIPT_ALLOC_ENTRY;
336 *buffer = new U8[size];
337 alloc_entry2bytestream(*buffer, offset, entry);
338 return size;
339 }
340
341 entry.mType = data->mType;
342 entry.mReferenceCount = 1;
343
344 if (data->mType != LST_LIST)
345 {
346 if ( (data->mType != LST_STRING)
347 &&(data->mType != LST_KEY))
348 {
349 size = LSCRIPTDataSize[data->mType];
350 }
351 else
352 {
353 if (data->mType == LST_STRING)
354 {
355 if (data->mString)
356 {
357 size = (S32)strlen(data->mString) + 1;
358 }
359 else
360 {
361 size = 1;
362 }
363 }
364 if (data->mType == LST_KEY)
365 {
366 if (data->mKey)
367 {
368 size = (S32)strlen(data->mKey) + 1;
369 }
370 else
371 {
372 size = 1;
373 }
374 }
375 }
376 entry.mSize = size;
377 size += SIZEOF_SCRIPT_ALLOC_ENTRY;
378 *buffer = new U8[size];
379 alloc_entry2bytestream(*buffer, offset, entry);
380
381 switch(data->mType)
382 {
383 case LST_INTEGER:
384 integer2bytestream(*buffer, offset, data->mInteger);
385 break;
386 case LST_FLOATINGPOINT:
387 float2bytestream(*buffer, offset, data->mFP);
388 break;
389 case LST_KEY:
390 if (data->mKey)
391 char2bytestream(*buffer, offset, data->mKey);
392 else
393 byte2bytestream(*buffer, offset, 0);
394 break;
395 case LST_STRING:
396 if (data->mString)
397 char2bytestream(*buffer, offset, data->mString);
398 else
399 byte2bytestream(*buffer, offset, 0);
400 break;
401 case LST_VECTOR:
402 vector2bytestream(*buffer, offset, data->mVec);
403 break;
404 case LST_QUATERNION:
405 quaternion2bytestream(*buffer, offset, data->mQuat);
406 break;
407 default:
408 break;
409 }
410 }
411 else
412 {
413 U8 *listbuf;
414 S32 length = data->getListLength();
415 size = 4 * length + 4;
416 entry.mSize = size;
417
418 size += SIZEOF_SCRIPT_ALLOC_ENTRY;
419 *buffer = new U8[size];
420
421 alloc_entry2bytestream(*buffer, offset, entry);
422 // store length of list
423 integer2bytestream(*buffer, offset, length);
424 data = data->mListp;
425 while(data)
426 {
427 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
428 // and function clean up of ref counts isn't based on scope (a mistake, I know)
429 integer2bytestream(*buffer, offset, size + base_offset + 1);
430
431 S32 listsize = lsa_create_data_block(&listbuf, data, base_offset + size);
432 if (listsize)
433 {
434 U8 *tbuff = new U8[size + listsize];
435 memcpy(tbuff, *buffer, size);
436 memcpy(tbuff + size, listbuf, listsize);
437 size += listsize;
438 delete [] *buffer;
439 delete [] listbuf;
440 *buffer = tbuff;
441 }
442 data = data->mListp;
443 }
444 }
445 return size;
446}
447
448// increase reference count
449// increase reference count by 1
450
451void lsa_increase_ref_count(U8 *buffer, S32 offset)
452{
453 if (get_register(buffer, LREG_FR))
454 return;
455 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
456 // and function clean up of ref counts isn't based on scope (a mistake, I know)
457 offset += get_register(buffer, LREG_HR) - 1;
458 if ( (offset < get_register(buffer, LREG_HR))
459 ||(offset >= get_register(buffer, LREG_HP)))
460 {
461 set_fault(buffer, LSRF_BOUND_CHECK_ERROR);
462 return;
463 }
464 S32 orig_offset = offset;
465 LLScriptAllocEntry entry;
466 bytestream2alloc_entry(entry, buffer, offset);
467
468 entry.mReferenceCount++;
469
470 alloc_entry2bytestream(buffer, orig_offset, entry);
471}
472
473// decrease reference count
474// decrease reference count by 1
475// if reference count == 0
476// set type to empty
477
478void lsa_decrease_ref_count(U8 *buffer, S32 offset)
479{
480 if (get_register(buffer, LREG_FR))
481 return;
482 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
483 // and function clean up of ref counts isn't based on scope (a mistake, I know)
484 offset += get_register(buffer, LREG_HR) - 1;
485 if ( (offset < get_register(buffer, LREG_HR))
486 ||(offset >= get_register(buffer, LREG_HP)))
487 {
488 set_fault(buffer, LSRF_BOUND_CHECK_ERROR);
489 return;
490 }
491 S32 orig_offset = offset;
492 LLScriptAllocEntry entry;
493 bytestream2alloc_entry(entry, buffer, offset);
494
495 entry.mReferenceCount--;
496
497 if (entry.mReferenceCount < 0)
498 {
499 entry.mReferenceCount = 0;
500 set_fault(buffer, LSRF_HEAP_ERROR);
501 }
502 else if (!entry.mReferenceCount)
503 {
504 if (entry.mType == LST_LIST)
505 {
506 S32 i, num = bytestream2integer(buffer, offset);
507 for (i = 0; i < num; i++)
508 {
509 S32 list_offset = bytestream2integer(buffer, offset);
510 lsa_decrease_ref_count(buffer, list_offset);
511 }
512 }
513 entry.mType = LST_NULL;
514 }
515
516 alloc_entry2bytestream(buffer, orig_offset, entry);
517}
518
519char gLSAStringRead[16384];
520
521
522LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref)
523{
524 if (get_register(buffer, LREG_FR))
525 return (new LLScriptLibData);
526 S32 orig_offset = offset;
527 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
528 // and function clean up of ref counts isn't based on scope (a mistake, I know)
529 offset += get_register(buffer, LREG_HR) - 1;
530 if ( (offset < get_register(buffer, LREG_HR))
531 ||(offset >= get_register(buffer, LREG_HP)))
532 {
533 set_fault(buffer, LSRF_BOUND_CHECK_ERROR);
534 return (new LLScriptLibData);
535 }
536 LLScriptAllocEntry entry;
537 bytestream2alloc_entry(entry, buffer, offset);
538
539 LLScriptLibData *retval = new LLScriptLibData;
540
541 if (!entry.mType)
542 {
543 set_fault(buffer, LSRF_HEAP_ERROR);
544 return retval;
545 }
546
547 retval->mType = (LSCRIPTType)entry.mType;
548 if (entry.mType != LST_LIST)
549 {
550 switch(entry.mType)
551 {
552 case LST_INTEGER:
553 retval->mInteger = bytestream2integer(buffer, offset);
554 break;
555 case LST_FLOATINGPOINT:
556 retval->mFP = bytestream2float(buffer, offset);
557 break;
558 case LST_KEY:
559 bytestream2char(gLSAStringRead, buffer, offset);
560 retval->mKey = new char[strlen(gLSAStringRead) + 1];
561 strcpy(retval->mKey, gLSAStringRead);
562 break;
563 case LST_STRING:
564 bytestream2char(gLSAStringRead, buffer, offset);
565 retval->mString = new char[strlen(gLSAStringRead) + 1];
566 strcpy(retval->mString, gLSAStringRead);
567 break;
568 case LST_VECTOR:
569 bytestream2vector(retval->mVec, buffer, offset);
570 break;
571 case LST_QUATERNION:
572 bytestream2quaternion(retval->mQuat, buffer, offset);
573 break;
574 default:
575 break;
576 }
577 }
578 else
579 {
580 // get length of list
581 S32 i, length = bytestream2integer(buffer, offset);
582 LLScriptLibData *tip = retval;
583
584 for (i = 0; i < length; i++)
585 {
586 S32 address = bytestream2integer(buffer, offset);
587 tip->mListp = lsa_get_data(buffer, address, FALSE);
588 tip = tip->mListp;
589 }
590 }
591 if (retval->checkForMultipleLists())
592 {
593 set_fault(buffer, LSRF_NESTING_LISTS);
594 }
595 if (b_dec_ref)
596 {
597 lsa_decrease_ref_count(buffer, orig_offset);
598 }
599 return retval;
600}
601
602LLScriptLibData *lsa_get_list_ptr(U8 *buffer, S32 &offset, BOOL b_dec_ref)
603{
604 if (get_register(buffer, LREG_FR))
605 return (new LLScriptLibData);
606 S32 orig_offset = offset;
607 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
608 // and function clean up of ref counts isn't based on scope (a mistake, I know)
609 offset += get_register(buffer, LREG_HR) - 1;
610 if ( (offset < get_register(buffer, LREG_HR))
611 ||(offset >= get_register(buffer, LREG_HP)))
612 {
613 set_fault(buffer, LSRF_BOUND_CHECK_ERROR);
614 return (new LLScriptLibData);
615 }
616 LLScriptAllocEntry entry;
617 bytestream2alloc_entry(entry, buffer, offset);
618
619 if (!entry.mType)
620 {
621 set_fault(buffer, LSRF_HEAP_ERROR);
622 return NULL;
623 }
624
625 LLScriptLibData base, *tip = &base;
626
627 if (entry.mType != LST_LIST)
628 {
629 return NULL;
630 }
631 else
632 {
633 // get length of list
634 S32 i, length = bytestream2integer(buffer, offset);
635
636 for (i = 0; i < length; i++)
637 {
638 S32 address = bytestream2integer(buffer, offset);
639 tip->mListp = lsa_get_data(buffer, address, FALSE);
640 tip = tip->mListp;
641 }
642 }
643 if (b_dec_ref)
644 {
645 lsa_decrease_ref_count(buffer, orig_offset);
646 }
647 tip = base.mListp;
648 base.mListp = NULL;
649 return tip;
650}
651
652S32 lsa_cat_strings(U8 *buffer, S32 offset1, S32 offset2, S32 heapsize)
653{
654 if (get_register(buffer, LREG_FR))
655 return 0;
656 LLScriptLibData *string1;
657 LLScriptLibData *string2;
658 if (offset1 != offset2)
659 {
660 string1 = lsa_get_data(buffer, offset1, TRUE);
661 string2 = lsa_get_data(buffer, offset2, TRUE);
662 }
663 else
664 {
665 string1 = lsa_get_data(buffer, offset1, TRUE);
666 string2 = lsa_get_data(buffer, offset2, TRUE);
667 }
668
669 if ( (!string1)
670 ||(!string2))
671 {
672 set_fault(buffer, LSRF_HEAP_ERROR);
673 delete string1;
674 delete string2;
675 return 0;
676 }
677
678 char *test1 = NULL, *test2 = NULL;
679
680 if (string1->mType == LST_STRING)
681 {
682 test1 = string1->mString;
683 }
684 else if (string1->mType == LST_KEY)
685 {
686 test1 = string1->mKey;
687 }
688 if (string2->mType == LST_STRING)
689 {
690 test2 = string2->mString;
691 }
692 else if (string2->mType == LST_KEY)
693 {
694 test2 = string2->mKey;
695 }
696
697 if ( (!test1)
698 ||(!test2))
699 {
700 set_fault(buffer, LSRF_HEAP_ERROR);
701 delete string1;
702 delete string2;
703 return 0;
704 }
705
706 S32 size = (S32)strlen(test1) + (S32)strlen(test2) + 1;
707
708 LLScriptLibData *string3 = new LLScriptLibData;
709 string3->mType = LST_STRING;
710 string3->mString = new char[size];
711 strcpy(string3->mString, test1);
712 strcat(string3->mString, test2);
713
714 delete string1;
715 delete string2;
716
717 return lsa_heap_add_data(buffer, string3, heapsize, TRUE);
718}
719
720S32 lsa_cmp_strings(U8 *buffer, S32 offset1, S32 offset2)
721{
722 if (get_register(buffer, LREG_FR))
723 return 0;
724 LLScriptLibData *string1;
725 LLScriptLibData *string2;
726
727 string1 = lsa_get_data(buffer, offset1, TRUE);
728 string2 = lsa_get_data(buffer, offset2, TRUE);
729
730 if ( (!string1)
731 ||(!string2))
732 {
733 set_fault(buffer, LSRF_HEAP_ERROR);
734 delete string1;
735 delete string2;
736 return 0;
737 }
738
739 char *test1 = NULL, *test2 = NULL;
740
741 if (string1->mType == LST_STRING)
742 {
743 test1 = string1->mString;
744 }
745 else if (string1->mType == LST_KEY)
746 {
747 test1 = string1->mKey;
748 }
749 if (string2->mType == LST_STRING)
750 {
751 test2 = string2->mString;
752 }
753 else if (string2->mType == LST_KEY)
754 {
755 test2 = string2->mKey;
756 }
757
758 if ( (!test1)
759 ||(!test2))
760 {
761 set_fault(buffer, LSRF_HEAP_ERROR);
762 delete string1;
763 delete string2;
764 return 0;
765 }
766 S32 retval = strcmp(test1, test2);
767
768 delete string1;
769 delete string2;
770
771 return retval;
772}
773
774void lsa_print_heap(U8 *buffer)
775{
776 S32 offset = get_register(buffer, LREG_HR);
777 S32 readoffset;
778 S32 ivalue;
779 F32 fpvalue;
780 LLVector3 vvalue;
781 LLQuaternion qvalue;
782 char string[4096];
783
784 LLScriptAllocEntry entry;
785
786 bytestream2alloc_entry(entry, buffer, offset);
787
788 printf("HP: [0x%X]\n", get_register(buffer, LREG_HP));
789 printf("==========\n");
790
791 while (offset + entry.mSize < MAX_HEAP_SIZE)
792 {
793 printf("[0x%X] ", offset);
794 printf("%s ", LSCRIPTTypeNames[entry.mType]);
795 printf("Ref Count: %d ", entry.mReferenceCount);
796 printf("Size: %d = ", entry.mSize);
797
798 readoffset = offset;
799
800 switch(entry.mType)
801 {
802 case LST_INTEGER:
803 ivalue = bytestream2integer(buffer, readoffset);
804 printf("%d\n", ivalue);
805 break;
806 case LST_FLOATINGPOINT:
807 fpvalue = bytestream2float(buffer, readoffset);
808 printf("%f\n", fpvalue);
809 break;
810 case LST_STRING:
811 bytestream2char(string, buffer, readoffset);
812 printf("%s\n", string);
813 break;
814 case LST_KEY:
815 bytestream2char(string, buffer, readoffset);
816 printf("%s\n", string);
817 break;
818 case LST_VECTOR:
819 bytestream2vector(vvalue, buffer, readoffset);
820 printf("< %f, %f, %f >\n", vvalue.mV[VX], vvalue.mV[VY], vvalue.mV[VZ]);
821 break;
822 case LST_QUATERNION:
823 bytestream2quaternion(qvalue, buffer, readoffset);
824 printf("< %f, %f, %f, %f >\n", qvalue.mQ[VX], qvalue.mQ[VY], qvalue.mQ[VZ], qvalue.mQ[VS]);
825 break;
826 case LST_LIST:
827 ivalue = bytestream2integer(buffer, readoffset);
828 printf("%d\n", ivalue);
829 break;
830 default:
831 printf("\n");
832 break;
833 }
834 offset += entry.mSize;
835 bytestream2alloc_entry(entry, buffer, offset);
836 }
837 printf("[0x%X] ", offset);
838 printf("%s ", LSCRIPTTypeNames[entry.mType]);
839 printf("Ref Count: %d ", entry.mReferenceCount);
840 printf("Size: %d\n", entry.mSize);
841 printf("==========\n");
842}
843
844void lsa_fprint_heap(U8 *buffer, FILE *fp)
845{
846 S32 offset = get_register(buffer, LREG_HR);
847 S32 readoffset;
848 S32 ivalue;
849 F32 fpvalue;
850 LLVector3 vvalue;
851 LLQuaternion qvalue;
852 char string[4096];
853
854 LLScriptAllocEntry entry;
855
856 bytestream2alloc_entry(entry, buffer, offset);
857
858 while (offset + entry.mSize < MAX_HEAP_SIZE)
859 {
860 fprintf(fp, "[0x%X] ", offset);
861 fprintf(fp, "%s ", LSCRIPTTypeNames[entry.mType]);
862 fprintf(fp, "Ref Count: %d ", entry.mReferenceCount);
863 fprintf(fp, "Size: %d = ", entry.mSize);
864
865 readoffset = offset;
866
867 switch(entry.mType)
868 {
869 case LST_INTEGER:
870 ivalue = bytestream2integer(buffer, readoffset);
871 fprintf(fp, "%d\n", ivalue);
872 break;
873 case LST_FLOATINGPOINT:
874 fpvalue = bytestream2float(buffer, readoffset);
875 fprintf(fp, "%f\n", fpvalue);
876 break;
877 case LST_STRING:
878 bytestream2char(string, buffer, readoffset);
879 fprintf(fp, "%s\n", string);
880 break;
881 case LST_KEY:
882 bytestream2char(string, buffer, readoffset);
883 fprintf(fp, "%s\n", string);
884 break;
885 case LST_VECTOR:
886 bytestream2vector(vvalue, buffer, readoffset);
887 fprintf(fp, "< %f, %f, %f >\n", vvalue.mV[VX], vvalue.mV[VY], vvalue.mV[VZ]);
888 break;
889 case LST_QUATERNION:
890 bytestream2quaternion(qvalue, buffer, readoffset);
891 fprintf(fp, "< %f, %f, %f, %f >\n", qvalue.mQ[VX], qvalue.mQ[VY], qvalue.mQ[VZ], qvalue.mQ[VS]);
892 break;
893 case LST_LIST:
894 ivalue = bytestream2integer(buffer, readoffset);
895 fprintf(fp, "%d\n", ivalue);
896 break;
897 default:
898 fprintf(fp, "\n");
899 break;
900 }
901 offset += entry.mSize;
902 bytestream2alloc_entry(entry, buffer, offset);
903 }
904 fprintf(fp, "[0x%X] ", offset);
905 fprintf(fp, "%s ", LSCRIPTTypeNames[entry.mType]);
906 fprintf(fp, "Ref Count: %d ", entry.mReferenceCount);
907 fprintf(fp, "Size: %d", entry.mSize);
908 fprintf(fp, "\n");
909}
910
911S32 lsa_cat_lists(U8 *buffer, S32 offset1, S32 offset2, S32 heapsize)
912{
913 if (get_register(buffer, LREG_FR))
914 return 0;
915 LLScriptLibData *list1;
916 LLScriptLibData *list2;
917 if (offset1 != offset2)
918 {
919 list1 = lsa_get_data(buffer, offset1, TRUE);
920 list2 = lsa_get_data(buffer, offset2, TRUE);
921 }
922 else
923 {
924 list1 = lsa_get_data(buffer, offset1, TRUE);
925 list2 = lsa_get_data(buffer, offset2, TRUE);
926 }
927
928 if ( (!list1)
929 ||(!list2))
930 {
931 set_fault(buffer, LSRF_HEAP_ERROR);
932 delete list1;
933 delete list2;
934 return 0;
935 }
936
937 if ( (list1->mType != LST_LIST)
938 ||(list2->mType != LST_LIST))
939 {
940 set_fault(buffer, LSRF_HEAP_ERROR);
941 delete list1;
942 delete list2;
943 return 0;
944 }
945
946 LLScriptLibData *runner = list1;
947
948 while (runner->mListp)
949 {
950 runner = runner->mListp;
951 }
952
953 runner->mListp = list2->mListp;
954
955 list2->mListp = NULL;
956
957 delete list2;
958
959 return lsa_heap_add_data(buffer, list1, heapsize, TRUE);
960}
961
962
963S32 lsa_cmp_lists(U8 *buffer, S32 offset1, S32 offset2)
964{
965 if (get_register(buffer, LREG_FR))
966 return 0;
967 LLScriptLibData *list1;
968 LLScriptLibData *list2;
969 if (offset1 != offset2)
970 {
971 list1 = lsa_get_data(buffer, offset1, TRUE);
972 list2 = lsa_get_data(buffer, offset2, TRUE);
973 }
974 else
975 {
976 list1 = lsa_get_data(buffer, offset1, FALSE);
977 list2 = lsa_get_data(buffer, offset2, TRUE);
978 }
979
980 if ( (!list1)
981 ||(!list2))
982 {
983 set_fault(buffer, LSRF_HEAP_ERROR);
984 delete list1;
985 delete list2;
986 return 0;
987 }
988
989 if ( (list1->mType != LST_LIST)
990 ||(list2->mType != LST_LIST))
991 {
992 set_fault(buffer, LSRF_HEAP_ERROR);
993 delete list1;
994 delete list2;
995 return 0;
996 }
997
998 S32 length1 = list1->getListLength();
999 S32 length2 = list2->getListLength();
1000
1001 if (length1 != length2)
1002 {
1003 return length1 - length2;
1004 }
1005
1006 LLScriptLibData *runner1 = list1;
1007 LLScriptLibData *runner2 = list2;
1008
1009 S32 count = 0;
1010
1011 while (runner1)
1012 {
1013 if (runner1->mType != runner2->mType)
1014 return count;
1015
1016 switch(runner1->mType)
1017 {
1018 case LST_INTEGER:
1019 if (runner1->mInteger != runner2->mInteger)
1020 return count;
1021 break;
1022 case LST_FLOATINGPOINT:
1023 if (runner1->mFP != runner2->mFP)
1024 return count;
1025 break;
1026 case LST_KEY:
1027 if (strcmp(runner1->mKey, runner2->mKey))
1028 return count;
1029 break;
1030 case LST_STRING:
1031 if (strcmp(runner1->mString, runner2->mString))
1032 return count;
1033 break;
1034 case LST_VECTOR:
1035 if (runner1->mVec != runner2->mVec)
1036 return count;
1037 case LST_QUATERNION:
1038 if (runner1->mQuat != runner2->mQuat)
1039 return count;
1040 break;
1041 default:
1042 break;
1043 }
1044
1045 runner1 = runner1->mListp;
1046 runner2 = runner2->mListp;
1047 }
1048
1049 delete list1;
1050 delete list2;
1051 return 0;
1052}
1053
1054
1055S32 lsa_preadd_lists(U8 *buffer, LLScriptLibData *data, S32 offset2, S32 heapsize)
1056{
1057 if (get_register(buffer, LREG_FR))
1058 return 0;
1059 LLScriptLibData *list2 = lsa_get_data(buffer, offset2, TRUE);
1060
1061 if (!list2)
1062 {
1063 set_fault(buffer, LSRF_HEAP_ERROR);
1064 delete list2;
1065 return 0;
1066 }
1067
1068 if (list2->mType != LST_LIST)
1069 {
1070 set_fault(buffer, LSRF_HEAP_ERROR);
1071 delete list2;
1072 return 0;
1073 }
1074
1075 LLScriptLibData *runner = data->mListp;
1076
1077 while (runner->mListp)
1078 {
1079 runner = runner->mListp;
1080 }
1081
1082
1083 runner->mListp = list2->mListp;
1084 list2->mListp = data->mListp;
1085
1086 return lsa_heap_add_data(buffer, list2, heapsize, TRUE);
1087}
1088
1089
1090S32 lsa_postadd_lists(U8 *buffer, S32 offset1, LLScriptLibData *data, S32 heapsize)
1091{
1092 if (get_register(buffer, LREG_FR))
1093 return 0;
1094 LLScriptLibData *list1 = lsa_get_data(buffer, offset1, TRUE);
1095
1096 if (!list1)
1097 {
1098 set_fault(buffer, LSRF_HEAP_ERROR);
1099 delete list1;
1100 return 0;
1101 }
1102
1103 if (list1->mType != LST_LIST)
1104 {
1105 set_fault(buffer, LSRF_HEAP_ERROR);
1106 delete list1;
1107 return 0;
1108 }
1109
1110 LLScriptLibData *runner = list1;
1111
1112 while (runner->mListp)
1113 {
1114 runner = runner->mListp;
1115 }
1116
1117 runner->mListp = data->mListp;
1118
1119 return lsa_heap_add_data(buffer, list1, heapsize, TRUE);
1120}
1121
diff --git a/linden/indra/lscript/lscript_library/lscript_export.cpp b/linden/indra/lscript/lscript_library/lscript_export.cpp
new file mode 100644
index 0000000..d0a23aa
--- /dev/null
+++ b/linden/indra/lscript/lscript_library/lscript_export.cpp
@@ -0,0 +1,27 @@
1/**
2 * @file lscript_export.cpp
3 * @brief export interface class
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
diff --git a/linden/indra/lscript/lscript_library/lscript_library.cpp b/linden/indra/lscript/lscript_library/lscript_library.cpp
new file mode 100644
index 0000000..098c836
--- /dev/null
+++ b/linden/indra/lscript/lscript_library/lscript_library.cpp
@@ -0,0 +1,576 @@
1/**
2 * @file lscript_library.cpp
3 * @brief external library interface
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28// *WARNING*
29// When adding functions, they <b>MUST</b> be appended to the end of
30// the init() method. The init() associates the name with a number,
31// which is then serialized into the bytecode. Inserting a new
32// function in the middle will lead to many sim crashes. Phoenix 2006-04-10.
33
34#include "linden_common.h"
35
36#include "lscript_library.h"
37
38LLScriptLibrary::LLScriptLibrary()
39: mNextNumber(0), mFunctions(NULL)
40{
41 init();
42}
43
44LLScriptLibrary::~LLScriptLibrary()
45{
46 S32 i;
47 for (i = 0; i < mNextNumber; i++)
48 {
49 delete mFunctions[i];
50 mFunctions[i] = NULL;
51 }
52 delete [] mFunctions;
53}
54
55void dummy_func(LLScriptLibData *retval, LLScriptLibData *args, const LLUUID &id)
56{
57}
58
59void LLScriptLibrary::init()
60{
61 // IF YOU ADD NEW SCRIPT CALLS, YOU MUST PUT THEM AT THE END OF THIS LIST.
62 // Otherwise the bytecode numbers for each call will be wrong, and all
63 // existing scripts will crash.
64
65 // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only
66 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSin", "f", "f", "float llSin(float theta)\ntheta in radians"));
67 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCos", "f", "f", "float llCos(float theta)\ntheta in radians"));
68 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTan", "f", "f", "float llTan(float theta)\ntheta radians"));
69 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAtan2", "f", "ff", "float llAtan2(float y, float x)"));
70 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSqrt", "f", "f", "float llSqrt(float val)\nreturns 0 and triggers a Math Error for imaginary results"));
71 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPow", "f", "ff", "float llPow(float base, float exponent)\nreturns 0 and triggers Math Error for imaginary results"));
72 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAbs", "i", "i", "integer llAbs(integer val)"));
73 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llFabs", "f", "f", "float llFabs(float val)"));
74 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llFrand", "f", "f", "float llFrand(float mag)\nreturns random number in range [0,mag)"));
75 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llFloor", "i", "f", "integer llFloor(float val)\nreturns largest integer value <= val"));
76 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCeil", "i", "f", "integer llCeil(float val)\nreturns smallest integer value >= val"));
77 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRound", "i", "f", "integer llRound(float val)\nreturns val rounded to the nearest integer"));
78 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVecMag", "f", "v", "float llVecMag(vector v)\nreturns the magnitude of v"));
79 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVecNorm", "v", "v", "vector llVecNorm(vector v)\nreturns the v normalized"));
80 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVecDist", "f", "vv", "float llVecDist(vector v1, vector v2)\nreturns the 3D distance between v1 and v2"));
81 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Euler", "v", "q", "vector llRot2Euler(rotation q)\nreturns the Euler representation (roll, pitch, yaw) of q"));
82 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEuler2Rot", "q", "v", "rotation llEuler2Rot(vector v)\nreturns the rotation representation of Euler Angles v"));
83 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAxes2Rot", "q", "vvv", "rotation llAxes2Rot(vector fwd, vector left, vector up)\nreturns the rotation defined by the coordinate axes"));
84 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Fwd", "v", "q", "vector llRot2Fwd(rotation q)\nreturns the forward vector defined by q"));
85 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Left", "v", "q", "vector llRot2Left(rotation q)\nreturns the left vector defined by q"));
86 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Up", "v", "q", "vector llRot2Up(rotation q)\nreturns the up vector defined by q"));
87 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotBetween", "q", "vv", "rotation llRotBetween(vector v1, vector v2)\nreturns the rotation to rotate v1 to v2"));
88 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llWhisper", NULL, "is", "llWhisper(integer channel, string msg)\nwhispers msg on channel"));
89 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSay", NULL, "is", "llSay(integer channel, string msg)\nsays msg on channel"));
90 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llShout", NULL, "is", "llShout(integer channel, string msg)\nshouts msg on channel"));
91 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListen", "i", "isks", "integer llListen(integer channel, string name, key id, string msg)\nsets a callback for msg on channel from name and id (name, id, and/or msg can be empty) and returns an identifier that can be used to deactivate or remove the listen"));
92 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListenControl", NULL, "ii", "llListenControl(integer number, integer active)\nmakes a listen event callback active or inactive"));
93 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListenRemove", NULL, "i", "llListenRemove(integer number)\nremoves listen event callback number"));
94 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSensor", NULL, "skiff", "llSensor(string name, key id, integer type, float range, float arc)\nPerforms a single scan for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name, id, and/or keytype can be empty or 0)"));
95 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSensorRepeat", NULL, "skifff", "llSensorRepeat(string name, key id, integer type, float range, float arc, float rate)\nsets a callback for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name, id, and/or keytype can be empty or 0) and repeats every rate seconds"));
96 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSensorRemove", NULL, NULL, "llSensorRemove()\nremoves sensor"));
97 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedName", "s", "i", "string llDetectedName(integer number)\nreturns the name of detected object number (returns empty string if number is not valid sensed object)"));
98 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedKey", "k", "i", "key llDetectedKey(integer number)\nreturns the key of detected object number (returns empty key if number is not valid sensed object)"));
99 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedOwner", "k", "i", "key llDetectedOwner(integer number)\nreturns the key of detected object's owner (returns empty key if number is not valid sensed object)"));
100 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedType", "i", "i", "integer llDetectedType(integer number)\nreturns the type (AGENT, ACTIVE, PASSIVE, SCRIPTED) of detected object (returns 0 if number is not valid sensed object)"));
101 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedPos", "v", "i", "vector llDetectedPos(integer number)\nreturns the position of detected object number (returns <0,0,0> if number is not valid sensed object)"));
102 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedVel", "v", "i", "vector llDetectedVel(integer number)\nreturns the velocity of detected object number (returns <0,0,0> if number is not valid sensed object)"));
103 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedGrab", "v", "i", "vector llDetectedGrab(integer number)\nreturns the grab offset of the user touching object (returns <0,0,0> if number is not valid sensed object)"));
104 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedRot", "q", "i", "rotation llDetectedRot(integer number)\nreturns the rotation of detected object number (returns <0,0,0,1> if number is not valid sensed object)"));
105 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedGroup", "i", "i", "integer llDetectedGroup(integer number)\nReturns TRUE if detected object is part of same group as owner"));
106 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedLinkNumber", "i", "i", "integer llDetectedLinkNumber(integer number)\nreturns the link position of the triggered event for touches and collisions only"));
107 addFunction(new LLScriptLibraryFunction(0.f, 0.f, dummy_func, "llDie", NULL, NULL, "llDie()\ndeletes the object"));
108 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGround", "f", "v", "float llGround(vector v)\nreturns the ground height below the object position + v"));
109 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCloud", "f", "v", "float llCloud(vector v)\nreturns the cloud density at the object position + v"));
110 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llWind", "v", "v", "vector llWind(vector v)\nreturns the wind velocity at the object position + v"));
111 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetStatus", NULL, "ii", "llSetStatus(integer status, integer value)\nsets status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB,\nSTATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) to value"));
112 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetStatus", "i", "i", "integer llGetStatus(integer status)\ngets value of status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB,\nSTATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z)"));
113 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetScale", NULL, "v", "llSetScale(vector scale)\nsets the scale"));
114 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetScale", "v", NULL, "vector llGetScale()\ngets the scale"));
115 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetColor", NULL, "vi", "llSetColor(vector color, integer face)\nsets the color"));
116 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAlpha", "f", "i", "float llGetAlpha(integer face)\ngets the alpha"));
117 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetAlpha", NULL, "fi", "llSetAlpha(float alpha, integer face)\nsets the alpha"));
118 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetColor", "v", "i", "vector llGetColor(integer face)\ngets the color"));
119 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetTexture", NULL, "si", "llSetTexture(string texture, integer face)\nsets the texture of face"));
120 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llScaleTexture", NULL, "ffi", "llScaleTexture(float scales, float scalet, integer face)\nsets the texture s, t scales for the chosen face"));
121 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llOffsetTexture", NULL, "ffi", "llOffsetTexture(float offsets, float offsett, integer face)\nsets the texture s, t offsets for the chosen face"));
122 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llRotateTexture", NULL, "fi", "llOffsetTexture(float rotation, integer face)\nsets the texture rotation for the chosen face"));
123 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTexture", "s", "i", "string llGetTexture(integer face)\ngets the texture of face (if it's a texture in the object inventory, otherwise the key in a string)"));
124 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetPos", NULL, "v", "llSetPos(vector pos)\nsets the position (if the script isn't physical)"));
125 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPos", "v", NULL, "vector llGetPos()\ngets the position (if the script isn't physical)"));
126 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLocalPos", "v", NULL, "vector llGetLocalPos()\ngets the position relative to the root (if the script isn't physical)"));
127 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetRot", NULL, "q", "llSetRot(rotation rot)\nsets the rotation (if the script isn't physical)"));
128 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRot", "q", NULL, "rotation llGetRot()\ngets the rotation (if the script isn't physical)"));
129 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLocalRot", "q", NULL, "rotation llGetLocalRot()\ngets the rotation local to the root (if the script isn't physical)"));
130 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForce", NULL, "vi", "llSetForce(vector force, integer local)\nsets force on object, in local coords if local == TRUE (if the script is physical)"));
131 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetForce", "v", NULL, "vector llGetForce()\ngets the force (if the script is physical)"));
132 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTarget", "i", "vf", "integer llTarget(vector position, float range)\nset positions within range of position as a target and return an ID for the target"));
133 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTargetRemove", NULL, "i", "llTargetRemove(integer number)\nremoves target number"));
134 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotTarget", "i", "qf", "integer llRotTarget(rotation rot, float error)\nset rotations with error of rot as a rotational target and return an ID for the rotational target"));
135 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotTargetRemove", NULL, "i", "llRotTargetRemove(integer number)\nremoves rotational target number"));
136 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMoveToTarget", NULL, "vf", "llMoveToTarget(vector target, float tau)\ncritically damp to target in tau seconds (if the script is physical)"));
137 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopMoveToTarget", NULL, NULL, "llStopMoveToTarget()\nStops critically damped motion"));
138 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llApplyImpulse", NULL, "vi", "llApplyImpulse(vector force, integer local)\napplies impulse to object, in local coords if local == TRUE (if the script is physical)"));
139 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llApplyRotationalImpulse", NULL, "vi", "llApplyRotationalImpulse(vector force, integer local)\napplies rotational impulse to object, in local coords if local == TRUE (if the script is physical)"));
140 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTorque", NULL, "vi", "llSetTorque(vector torque, integer local)\nsets the torque of object, in local coords if local == TRUE (if the script is physical)"));
141 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTorque", "v", NULL, "vector llGetTorque()\ngets the torque (if the script is physical)"));
142 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForceAndTorque", NULL, "vvi", "llSetForceAndTorque(vector force, vector torque, integer local)\nsets the force and torque of object, in local coords if local == TRUE (if the script is physical)"));
143 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetVel", "v", NULL, "vector llGetVel()\ngets the velocity"));
144 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAccel", "v", NULL, "vector llGetAccel()\ngets the acceleration"));
145 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetOmega", "v", NULL, "vector llGetOmega()\ngets the omega"));
146 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTimeOfDay", "f", "", "float llGetTimeOfDay()\ngets the time in seconds since Second Life server midnight (or since server up-time; whichever is smaller)"));
147 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetWallclock", "f", "", "float llGetWallclock()\ngets the time in seconds since midnight"));
148 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTime", "f", NULL, "float llGetTime()\ngets the time in seconds since creation"));
149 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llResetTime", NULL, NULL, "llResetTime()\nsets the time to zero"));
150 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAndResetTime", "f", NULL, "float llGetAndResetTime()\ngets the time in seconds since creation and sets the time to zero"));
151 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSound", NULL, "sfii", "llSound(string sound, float volume, integer queue, integer loop)\nplays sound at volume and whether it should loop or not"));
152 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPlaySound", NULL, "sf", "llPlaySound(string sound, float volume)\nplays attached sound once at volume (0.0 - 1.0)"));
153 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLoopSound", NULL, "sf", "llLoopSound(string sound, float volume)\nplays attached sound looping indefinitely at volume (0.0 - 1.0)"));
154 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLoopSoundMaster", NULL, "sf", "llLoopSoundMaster(string sound, float volume)\nplays attached sound looping at volume (0.0 - 1.0), declares it a sync master"));
155 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLoopSoundSlave", NULL, "sf", "llLoopSoundSlave(string sound, float volume)\nplays attached sound looping at volume (0.0 - 1.0), synced to most audible sync master"));
156 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPlaySoundSlave", NULL, "sf", "llPlaySoundSlave(string sound, float volume)\nplays attached sound once at volume (0.0 - 1.0), synced to next loop of most audible sync master"));
157 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTriggerSound", NULL, "sf", "llTriggerSound(string sound, float volume)\nplays sound at volume (0.0 - 1.0), centered at but not attached to object"));
158 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopSound", NULL, "", "llStopSound()\nStops currently attached sound"));
159 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llPreloadSound", NULL, "s", "llPreloadSound(string sound)\npreloads a sound on viewers within range"));
160 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetSubString", "s", "sii", "string llGetSubString(string src, integer start, integer end)\nreturns the indicated substring"));
161 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDeleteSubString", "s", "sii", "string llDeleteSubString(string src, integer start, integer end)\nremoves the indicated substring and returns the result"));
162 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llInsertString", "s", "sis", "string llInsertString(string dst, integer position, string src)\ninserts src into dst at position and returns the result"));
163 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llToUpper", "s", "s", "string llToUpper(string src)\nconvert src to all upper case and returns the result"));
164 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llToLower", "s", "s", "string llToLower(string src)\nconvert src to all lower case and returns the result"));
165 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGiveMoney", "i", "ki", "llGiveMoney(key destination, integer amount)\ntransfer amount of money from script owner to destination"));
166 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeExplosion", NULL, "iffffsv", "llMakeExplosion(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake a round explosion of particles"));
167 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeFountain", NULL, "iffffisvf", "llMakeFountain(integer particles, float scale, float vel, float lifetime, float arc, integer bounce, string texture, vector offset, float bounce_offset)\nMake a fountain of particles"));
168 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeSmoke", NULL, "iffffsv", "llMakeSmoke(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake smoke like particles"));
169 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeFire", NULL, "iffffsv", "llMakeFire(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake fire like particles"));
170 addFunction(new LLScriptLibraryFunction(200.f, 0.1f, dummy_func, "llRezObject", NULL, "svvqi", "llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param)\nInstanciate owners inventory object at pos with velocity vel and rotation rot with start parameter param"));
171 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLookAt", NULL, "vff", "llLookAt(vector target, F32 strength, F32 damping)\nCause object name to point it's forward axis towards target"));
172 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopLookAt", NULL, NULL, "llStopLookAt()\nStop causing object name to point at a target"));
173 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTimerEvent", NULL, "f", "llSetTimerEvent(float sec)\nCause the timer event to be triggered every sec seconds"));
174 addFunction(new LLScriptLibraryFunction(0.f, 0.f, dummy_func, "llSleep", NULL, "f", "llSleep(float sec)\nPut script to sleep for sec seconds"));
175 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetMass", "f", NULL, "float llGetMass()\nGet the mass of task name that script is attached to"));
176 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCollisionFilter", NULL, "ski", "llCollisionFilter(string name, key id, integer accept)\nif accept == TRUE, only accept collisions with objects name and id (either is optional), otherwise with objects not name or id"));
177 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTakeControls", NULL, "iii", "llTakeControls(integer controls, integer accept, integer pass_on)\nTake controls from agent task has permissions for. If (accept == (controls & input)), send input to task. If pass_on send to agent also."));
178 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llReleaseControls", NULL, NULL, "llReleaseControls()\nStop taking inputs"));
179 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAttachToAvatar", NULL, "i", "llAttachToAvatar(integer attachment)\nAttach to avatar task has permissions for at point attachment"));
180 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetachFromAvatar", NULL, NULL, "llDetachFromAvatar()\nDrop off of avatar"));
181 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTakeCamera", NULL, "k", "llTakeCamera(key avatar)\nMove avatar's viewpoint to task"));
182 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llReleaseCamera", NULL, "k", "llReleaseCamera(key avatar)\nReturn camera to agent"));
183 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetOwner", "k", NULL, "key llGetOwner()\nReturns the owner of the task"));
184 addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llInstantMessage", NULL, "ks", "llInstantMessage(key user, string message)\nIMs message to the user"));
185 addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llEmail", NULL, "sss", "llEmail(string address, string subject, string message)\nSends email to address with subject and message"));
186 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetNextEmail", NULL, "ss", "llGetNextEmail(string address, string subject)\nGet the next waiting email with appropriate address and/or subject (if blank they are ignored)"));
187 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetKey", "k", NULL, "key llGetKey()\nGet the key for the task the script is attached to"));
188 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetBuoyancy", NULL, "f", "llSetBuoyancy(float buoyancy)\nSet the tasks buoyancy (0 is none, < 1.0 sinks, 1.0 floats, > 1.0 rises)"));
189 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetHoverHeight", NULL, "fif", "llSetHoverHeight(float height, integer water, float tau)\nCritically damps to a height (either above ground level or above the higher of land and water if water == TRUE)"));
190 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopHover", NULL, NULL, "llStopHover()\nStop hovering to a height"));
191 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMinEventDelay", NULL, "f", "llMinEventDelay(float delay)\nSet the minimum time between events being handled"));
192 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSoundPreload", NULL, "s", "llSoundPreload(string sound)\npreloads a sound on viewers within range"));
193 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotLookAt", NULL, "qff", "llRotLookAt(rotation target, F32 strength, F32 damping)\nCause object name to point it's forward axis towards target"));
194 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringLength", "i", "s", "integer llStringLength(string str)\nReturns the length of string"));
195 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStartAnimation", NULL, "s", "llStartAnimation(string anim)\nStart animation anim for agent that owns object"));
196 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopAnimation", NULL, "s", "llStopAnimation(string anim)\nStop animation anim for agent that owns object"));
197 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPointAt", NULL, "v", "llPointAt(vector pos)\nMake agent that owns object point at pos"));
198 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopPointAt", NULL, NULL, "llStopPointAt()\nStop agent that owns object pointing"));
199 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTargetOmega", NULL, "vff", "llTargetOmega(vector axis, float spinrate, float gain)\nAttempt to spin at spinrate with strength gain"));
200 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetStartParameter", "i", NULL, "integer llGetStartParameter()\nGet's the start paramter passed to llRezObject"));
201 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGodLikeRezObject", NULL, "kv", "llGodLikeRezObject(key inventory, vector pos)\nrez directly off of a UUID if owner has dog-bit set", TRUE));
202 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRequestPermissions", NULL, "ki", "llRequestPermissions(key agent, integer perm)\nask agent to allow the script to do perm (NB: Debit, ownership, link, joint, and permission requests can only go to the task's owner)"));
203 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPermissionsKey", "k", NULL, "key llGetPermissionsKey()\nReturn agent that permissions are enabled for. NULL_KEY if not enabled"));
204 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPermissions", "i", NULL, "integer llGetPermissions()\nreturn what permissions have been enabled"));
205 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLinkNumber", "i", NULL, "integer llGetLinkNumber()\nReturns what number in a link set the script is attached to (0 means no link, 1 the root, 2 for first child, &c)"));
206 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetLinkColor", NULL, "ivi", "llSetLinkColor(integer linknumber, vector color, integer face)\nIf a task exists in the link chain at linknumber, set face to color"));
207 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llCreateLink", NULL, "ki", "llCreateLink(key target, integer parent)\nAttempt to link task script is attached to and target (requires permission PERMISSION_CHANGE_LINKS be set). If parent == TRUE, task script is attached to is the root"));
208 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llBreakLink", NULL, "i", "llBreakLink(integer linknum)\nDelinks the task with the given link number (requires permission PERMISSION_CHANGE_LINKS be set)"));
209 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llBreakAllLinks", NULL, NULL, "llBreakAllLinks()\nDelinks all tasks in the link set (requires permission PERMISSION_CHANGE_LINKS be set)"));
210 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLinkKey", "k", "i", "key llGetLinkKey(integer linknum)\nGet the key of linknumber in link set"));
211 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLinkName", "s", "i", "string llGetLinkName(integer linknum)\nGet the name of linknumber in link set"));
212 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryNumber", "i", "i", "integer llGetInventoryNumber(integer type)\nGet the number of items of a given type in the task's inventory.\nValid types: INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_OBJECT, INVENTORY_SCRIPT, INVENTORY_CLOTHING, INVENTORY_BODYPART, INVENTORY_NOTECARD, INVENTORY_LANDMARK, INVENTORY_ALL"));
213 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryName", "s", "ii", "string llGetInventoryName(integer type, integer number)\nGet the name of the inventory item number of type"));
214 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetScriptState", NULL, "si", "llSetScriptState(string name, integer run)\nControl the state of a script name."));
215 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetEnergy", "f", NULL, "float llGetEnergy()\nReturns how much energy is in the object as a percentage of maximum"));
216 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGiveInventory", NULL, "ks", "llGiveInventory(key destination, string inventory)\nGive inventory to destination"));
217 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRemoveInventory", NULL, "s", "llRemoveInventory(string inventory)\nRemove the named inventory item"));
218 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetText", NULL, "svf", "llSetText(string text, vector color, float alpha)\nSet text floating over object"));
219 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llWater", "f", "v", "float llWater(vector v)\nreturns the water height below the object position + v"));
220 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPassTouches", NULL, "i", "llPassTouches(integer pass)\nif pass == TRUE, touches are passed from children on to parents (default is FALSE)"));
221 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llRequestAgentData", "k", "ki", "key llRequestAgentData(key id, integer data)\nRequests data about agent id. When data is available the dataserver event will be raised"));
222 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llRequestInventoryData", "k", "s", "key llRequestInventoryData(string name)\nRequests data from object's inventory object. When data is available the dataserver event will be raised"));
223 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetDamage", NULL, "f", "llSetDamage(float damage)\nSets the amount of damage that will be done to an object that this task hits. Task will be killed."));
224 addFunction(new LLScriptLibraryFunction(100.f, 5.f, dummy_func, "llTeleportAgentHome", NULL, "k", "llTeleportAgentHome(key id)\nTeleports agent on owner's land to agent's home location"));
225 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llModifyLand", NULL, "ii", "llModifyLand(integer action, integer size)\nModify land with action (LAND_LEVEL, LAND_RAISE, LAND_LOWER, LAND_SMOOTH, LAND_NOISE, LAND_REVERT)\non size (LAND_SMALL_BRUSH, LAND_MEDIUM_BRUSH, LAND_LARGE_BRUSH)"));
226 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCollisionSound", NULL, "sf", "llCollisionSound(string impact_sound, float impact_volume)\nSuppress default collision sounds, replace default impact sounds with impact_sound (empty string to just suppress)"));
227 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCollisionSprite", NULL, "s", "llCollisionSprite(string impact_sprite)\nSuppress default collision sprites, replace default impact sprite with impact_sprite (empty string to just suppress)"));
228 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAnimation", "s", "k", "string llGetAnimation(key id)\nGet the currently playing locomotion animation for avatar id"));
229 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llResetScript", NULL, NULL, "llResetScript()\nResets the script"));
230 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMessageLinked", NULL, "iisk", "llMessageLinked(integer linknum, integer num, string str, key id)\nSends num, str, and id to members of the link set (LINK_ROOT sends to root task in a linked set,\nLINK_SET sends to all tasks,\nLINK_ALL_OTHERS to all other tasks,\nLINK_ALL_CHILDREN to all children,\nLINK_THIS to the task the script it is in)"));
231 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPushObject", NULL, "kvvi", "llPushObject(key id, vector impulse, vector ang_impulse, integer local)\nApplies impulse and ang_impulse to object id"));
232 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPassCollisions", NULL, "i", "llPassCollisions(integer pass)\nif pass == TRUE, collisions are passed from children on to parents (default is FALSE)"));
233 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetScriptName", "s", NULL, "llGetScriptName()\nReturns the script name"));
234 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetNumberOfSides", "i", NULL, "integer llGetNumberOfSides()\nReturns the number of sides"));
235 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAxisAngle2Rot", "q", "vf", "rotation llAxisAngle2Rot(vector axis, float angle)\nReturns the rotation generated angle about axis"));
236 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Axis", "v", "q", "vector llRot2Axis(rotation rot)\nReturns the rotation axis represented by rot"));
237 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Angle", "f", "q", "float llRot2Angle(rotation rot)\nReturns the rotation angle represented by rot"));
238 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAcos", "f", "f", "float llAcos(float val)\nReturns the arccosine in radians of val"));
239 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAsin", "f", "f", "float llAsin(float val)\nReturns the arcsine in radians of val"));
240 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAngleBetween", "f", "qq", "float llAngleBetween(rotation a, rotation b)\nReturns angle between rotation a and b"));
241 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryKey", "k", "s", "key llGetInventoryKey(string name)\nReturns the key of the inventory name"));
242 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAllowInventoryDrop", NULL, "i", "llAllowInventoryDrop(integer add)\nIf add == TRUE, users without permissions can still drop inventory items onto task"));
243 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetSunDirection", "v", NULL, "vector llGetSunDirection()\nReturns the sun direction on the simulator"));
244 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTextureOffset", "v", "i", "vector llGetTextureOffset(integer side)\nReturns the texture offset of side in the x and y components of a vector"));
245 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTextureScale", "v", "i", "vector llGetTextureScale(integer side)\nReturns the texture scale of side in the x and y components of a vector"));
246 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTextureRot", "f", "i", "float llGetTextureRot(integer side)\nReturns the texture rotation of side"));
247 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSubStringIndex", "i", "ss", "integer llSubStringIndex(string source, string pattern)\nFinds index in source where pattern first appears (returns -1 if not found)"));
248 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetOwnerKey", "k", "k", "key llGetOwnerKey(key id)\nFind the owner of id"));
249 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCenterOfMass", "v", NULL, "vector llGetCenterOfMass()\nGet the object's center of mass"));
250 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListSort", "l", "lii", "list llListSort(list src, integer stride, integer ascending)\nSort the list into blocks of stride in ascending order if ascending == TRUE. Note that sort only works between same types."));
251 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetListLength", "i", "l", "integer llGetListLength(list src)\nGet the number of elements in the list"));
252 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Integer", "i", "li", "integer llList2Integer(list src, integer index)\nCopy the integer at index in the list"));
253 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Float", "f", "li", "float llList2Float(list src, integer index)\nCopy the float at index in the list"));
254 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2String", "s", "li", "string llList2String(list src, integer index)\nCopy the string at index in the list"));
255 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Key", "k", "li", "key llList2Key(list src, integer index)\nCopy the key at index in the list"));
256 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Vector", "v", "li", "vector llList2Vector(list src, integer index)\nCopy the vector at index in the list"));
257 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Rot", "q", "li", "rotation llList2Rot(list src, integer index)\nCopy the rotation at index in the list"));
258 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2List", "l", "lii", "list llList2List(list src, integer start, integer end)\nCopy the slice of the list from start to end"));
259 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDeleteSubList", "l", "lii", "list llDeleteSubList(list src, integer start, integer end)\nRemove the slice from the list and return the remainder"));
260 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetListEntryType", "i", "li", "integer llGetListEntryType(list src, integer index)\nReturns the type of the index entry in the list\n(TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_KEY, TYPE_VECTOR, TYPE_ROTATION, or TYPE_INVALID if index is off list)"));
261 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2CSV", "s", "l", "string llList2CSV(list src)\nCreate a string of comma separated values from list"));
262 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCSV2List", "l", "s", "list llCSV2List(string src)\nCreate a list from a string of comma separated values"));
263 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListRandomize", "l", "li", "list llListRandomize(list src, integer stride)\nReturns a randomized list of blocks of size stride"));
264 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2ListStrided", "l", "liii", "list llList2ListStrided(list src, integer start, integer end, integer stride)\nCopy the strided slice of the list from start to end"));
265 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionCorner", "v", NULL, "vector llGetRegionCorner()\nReturns a vector with the south west corner x,y position of the region the object is in"));
266 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListInsertList", "l", "lli", "list llListInsertList(list dest, list src, integer start)\nInserts src into dest at position start"));
267 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListFindList", "i", "ll", "integer llListFindList(list src, list test)\nReturns the start of the first instance of test in src, -1 if not found"));
268 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectName", "s", NULL, "string llGetObjectName()\nReturns the name of the object script is attached to"));
269 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetObjectName", NULL, "s", "llSetObjectName(string name)\nSets the objects name"));
270 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetDate", "s", NULL, "string llGetDate()\nGets the date as YYYY-MM-DD"));
271 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEdgeOfWorld", "i", "vv", "integer llEdgeOfWorld(vector pos, vector dir)\nChecks to see whether the border hit by dir from pos is the edge of the world (has no neighboring simulator)"));
272 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAgentInfo", "i", "k", "integer llGetAgentInfo(key id)\nGets information about agent ID.\nReturns AGENT_FLYING, AGENT_ATTACHMENTS, AGENT_SCRIPTED, AGENT_SITTING, AGENT_ON_OBJECT, AGENT_MOUSELOOK, AGENT_AWAY, AGENT_BUSY, AGENT_TYPING, AGENT_CROUCHING, AGENT_ALWAYS_RUN, AGENT_WALKING and/or AGENT_IN_AIR."));
273 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llAdjustSoundVolume", NULL, "f", "llAdjustSoundVolume(float volume)\nadjusts volume of attached sound (0.0 - 1.0)"));
274 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetSoundQueueing", NULL, "i", "llSetSoundQueueing(integer queue)\ndetermines whether attached sound calls wait for the current sound to finish (0 = no [default], nonzero = yes)"));
275 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetSoundRadius", NULL, "f", "llSetSoundRadius(float radius)\nestablishes a hard cut-off radius for audibility of scripted sounds (both attached and triggered)"));
276 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llKey2Name", "s", "k", "string llKey2Name(key id)\nReturns the name of the object key, iff the object is in the current simulator, otherwise the empty string"));
277 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTextureAnim", NULL, "iiiifff", "llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate)\nAnimate the texture on the specified face/faces"));
278 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTriggerSoundLimited", NULL, "sfvv", "llTriggerSoundLimited(string sound, float volume, vector tne, vector bsw)\nplays sound at volume (0.0 - 1.0), centered at but not attached to object, limited to AABB defined by vectors top-north-east and bottom-south-west"));
279 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEjectFromLand", NULL, "k", "llEjectFromLand(key pest)\nEjects pest from land that you own"));
280 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llParseString2List", "l", "sll", "list llParseString2List(string src, list separators, list spacers)\nBreaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each)"));
281 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llOverMyLand", "i", "k", "integer llOverMyLand(key id)\nReturns TRUE if id is over land owner of object owns, FALSE otherwise"));
282 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLandOwnerAt", "k", "v", "key llGetLandOwnerAt(vector pos)\nReturns the key of the land owner, NULL_KEY if public"));
283 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llGetNotecardLine", "k", "si", "key llGetNotecardLine(string name, integer line)\nReturns line line of notecard name via the dataserver event"));
284 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAgentSize", "v", "k", "vector llGetAgentSize(key id)\nIf the agent is in the same sim as the object, returns the size of the avatar"));
285 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSameGroup", "i", "k", "integer llSameGroup(key id)\nReturns TRUE if ID is in the same sim and has the same active group, otherwise FALSE"));
286 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llUnSit", NULL, "k", "key llUnSit(key id)\nIf agent identified by id is sitting on the object the script is attached to or is over land owned by the objects owner, the agent is forced to stand up"));
287 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundSlope", "v", "v", "vector llGroundSlope(vector v)\nreturns the ground slope below the object position + v"));
288 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundNormal", "v", "v", "vector llGroundNormal(vector v)\nreturns the ground normal below the object position + v"));
289 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundContour", "v", "v", "vector llGroundCountour(vector v)\nreturns the ground contour below the object position + v"));
290 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAttached", "i", NULL, "integer llGetAttached()\nreturns the object attachment point or 0 if not attached"));
291 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetFreeMemory", "i", NULL, "integer llGetFreeMemory()\nreturns the available heap space for the current script"));
292 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionName", "s", NULL, "string llGetRegionName()\nreturns the current region name"));
293 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionTimeDilation", "f", NULL, "float llGetRegionTimeDilation()\nreturns the current time dilation as a float between 0 and 1"));
294 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionFPS", "f", NULL, "float llGetRegionFPS()\nreturns the mean region frames per second"));
295
296 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llParticleSystem", NULL, "l", "llParticleSystem(list rules)\nCreates a particle system based on rules. Empty list removes particle system from object.\nList format is [ rule1, data1, rule2, data2 . . . rulen, datan ]"));
297 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundRepel", NULL, "fif", "llGroundRepel(float height, integer water, float tau)\nCritically damps to height if within height*0.5 of level (either above ground level or above the higher of land and water if water == TRUE)"));
298 addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llGiveInventoryList", NULL, "ksl", "llGiveInventoryList(key destination, string category, list inventory)\nGive inventory to destination in a new category"));
299
300// script calls for vehicle action
301 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleType", NULL, "i", "llSetVehicleType(integer type)\nsets vehicle to one of the default types"));
302 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleFloatParam", NULL, "if", "llSetVehicleFloatParam(integer param, float value)\nsets the specified vehicle float parameter"));
303 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleVectorParam", NULL, "iv", "llSetVehicleVectorParam(integer param, vector vec)\nsets the specified vehicle vector parameter"));
304 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleRotationParam", NULL, "iq", "llSetVehicleVectorParam(integer param, rotation rot)\nsets the specified vehicle rotation parameter"));
305 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleFlags", NULL, "i", "llSetVehicleFlags(integer flags)\nsets the enabled bits in 'flags'"));
306 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRemoveVehicleFlags", NULL, "i", "llRemoveVehicleFlags(integer flags)\nremoves the enabled bits in 'flags'"));
307 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSitTarget", NULL, "vq", "llSitTarget(vector offset, rotation rot)\nSet the sit location for this object (if offset == <0,0,0> clear it)"));
308 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAvatarOnSitTarget", "k", NULL, "key llAvatarOnSitTarget()\nIf an avatar is sitting on the sit target, return the avatar's key, NULL_KEY otherwise"));
309 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llAddToLandPassList", NULL, "kf", "llAddToLandPassList(key avatar, float hours)\nAdd avatar to the land pass list for hours"));
310 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTouchText", NULL, "s", "llSetTouchText(string text)\nDisplays text in pie menu that acts as a touch"));
311 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetSitText", NULL, "s", "llSetSitText(string text)\nDisplays text rather than sit in pie menu"));
312 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCameraEyeOffset", NULL, "v", "llSetCameraEyeOffset(vector offset)\nSets the camera eye offset used in this object if an avatar sits on it"));
313 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCameraAtOffset", NULL, "v", "llSetCameraAtOffset(vector offset)\nSets the camera at offset used in this object if an avatar sits on it"));
314
315 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDumpList2String", "s", "ls", "string llDumpList2String(list src, string separator)\nWrite the list out in a single string using separator between values"));
316 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llScriptDanger", "i", "v", "integer llScriptDanger(vector pos)\nReturns true if pos is over public land, sandbox land, land that doesn't allow everyone to edit and build, or land that doesn't allow outside scripts"));
317 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llDialog", NULL, "ksli", "llDialog(key avatar, string message, list buttons, integer chat_channel\nShows a dialog box on the avatar's screen with the message.\nUp to 12 strings in the list form buttons.\nIf a button is clicked, the name is chatted on chat_channel."));
318 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVolumeDetect", NULL, "i", "llVolumeDetect(integer detect)\nIf detect = TRUE, object becomes phantom but triggers collision_start and collision_end events\nwhen other objects start and stop interpenetrating.\nMust be applied to the root object."));
319 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llResetOtherScript", NULL, "s", "llResetOtherScript(string name)\nResets script name"));
320 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetScriptState", "i", "s", "integer llGetScriptState(string name)\nResets TRUE if script name is running"));
321 addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llRemoteLoadScript", NULL, "ksii", "Deprecated. Please use llRemoteLoadScriptPin instead."));
322
323 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetRemoteScriptAccessPin", NULL, "i", "llSetRemoteScriptAccessPin(integer pin)\nIf pin is set to a non-zero number, the task will accept remote script\nloads via llRemoteLoadScriptPin if it passes in the correct pin.\nOthersise, llRemoteLoadScriptPin is ignored."));
324 addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llRemoteLoadScriptPin", NULL, "ksiii", "llRemoteLoadScriptPin(key target, string name, integer pin, integer running, integer start_param)\nIf the owner of the object this script is attached can modify target,\nthey are in the same region,\nand the matching pin is used,\ncopy script name onto target,\nif running == TRUE, start the script with param."));
325
326 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llOpenRemoteDataChannel", NULL, NULL, "llOpenRemoteDataChannel()\nCreates a channel to listen for XML-RPC calls. Will trigger a remote_data event with channel id once it is available."));
327 addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llSendRemoteData", "k", "ksis", "key llSendRemoteData(key channel, string dest, integer idata, string sdata)\nSend an XML-RPC request to dest through channel with payload of channel (in a string), integer idata and string sdata.\nA message identifier key is returned.\nAn XML-RPC reply will trigger a remote_data event and reference the message id.\nThe message_id is returned."));
328 addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llRemoteDataReply", NULL, "kksi", "llRemoteDataReply(key channel, key message_id, string sdata, integer idata)\nSend an XML-RPC reply to message_id on channel with payload of string sdata and integer idata"));
329 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llCloseRemoteDataChannel", NULL, "k", "llCloseRemoteDataChannel(key channel)\nCloses XML-RPC channel."));
330
331 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMD5String", "s", "si", "string llMD5String(string src, integer nonce)\nPerforms a RSA Data Security, Inc. MD5 Message-Digest Algorithm on string with nonce. Returns a 32 character hex string."));
332 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetPrimitiveParams", NULL, "l", "llSetPrimitiveParams(list rules)\nSet primitive parameters based on rules."));
333 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringToBase64", "s", "s", "string llStringToBase64(string str)\nConverts a string to the Base 64 representation of the string."));
334 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llBase64ToString", "s", "s", "string llBase64ToString(string str)\nConverts a Base 64 string to a conventional string. If the conversion creates any unprintable characters, they are converted to spaces."));
335 addFunction(new LLScriptLibraryFunction(10.f, 0.3f, dummy_func, "llXorBase64Strings", "s", "ss", "string llXorBase64Strings(string s1, string s2)\nDEPRECATED! Please use llXorBase64StringsCorrect instead!! Incorrectly performs an exclusive or on two Base 64 strings and returns a Base 64 string. s2 repeats if it is shorter than s1. Retained for backwards compatability."));
336 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRemoteDataSetRegion", NULL, NULL, "llRemoteDataSetRegion()\nIf an object using remote data channels changes regions, you must call this function to reregister the remote data channels.\nYou do not need to make this call if you don't change regions."));
337 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLog10", "f", "f", "float llLog10(float val)\nReturns the base 10 log of val if val > 0, otherwise returns 0."));
338 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLog", "f", "f", "float llLog(float val)\nReturns the base e log of val if val > 0, otherwise returns 0."));
339 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAnimationList", "l", "k", "list llGetAnimationList(key id)\nGets a list of all playing animations for avatar id"));
340 addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llSetParcelMusicURL", NULL, "s", "llSetParcelMusicURL(string url)\nSets the streaming audio URL for the parcel object is on"));
341
342 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRootPosition", "v", NULL, "vector llGetRootPosition()\nGets the global position of the root object of the object script is attached to"));
343 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRootRotation", "q", NULL, "rotation llGetRootRotation()\nGets the global rotation of the root object of the object script is attached to"));
344
345 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectDesc", "s", NULL, "string llGetObjectDesc()\nReturns the description of the object the script is attached to"));
346 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetObjectDesc", NULL, "s", "llSetObjectDesc(string name)\nSets the object's description"));
347 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCreator", "k", NULL, "key llGetCreator()\nReturns the creator of the object"));
348 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTimestamp", "s", NULL, "string llGetTimestamp()\nGets the timestamp in the format: YYYY-MM-DDThh:mm:ss.ff..fZ"));
349 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetLinkAlpha", NULL, "ifi", "llSetLinkAlpha(integer linknumber, float alpha, integer face)\nIf a prim exists in the link chain at linknumber, set face to alpha"));
350 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetNumberOfPrims", "i", NULL, "integer llGetNumberOfPrims()\nReturns the number of prims in a link set the script is attached to"));
351 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llGetNumberOfNotecardLines", "k", "s", "key llGetNumberOfNotecardLines(string name)\nReturns number of lines in notecard 'name' via the dataserver event (cast return value to integer)"));
352
353 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetBoundingBox", "l", "k", "list llGetBoundingBox(key object)\nReturns the bounding box around an object (including any linked prims) relative to the root prim, in a list: [ (vector) min_corner, (vector) max_corner ]"));
354 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetGeometricCenter", "v", NULL, "vector llGetGeometricCenter()\nReturns the geometric center of the linked set the script is attached to."));
355 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llGetPrimitiveParams", "l", "l", "list llGetPrimitiveParams(list params)\nGets primitive parameters specified in the params list."));
356 addFunction(new LLScriptLibraryFunction(10.f, 0.0f, dummy_func, "llIntegerToBase64", "s", "i", "string llIntegerToBase64(integer number)\nBig endian encode of of integer as a Base64 string."));
357 addFunction(new LLScriptLibraryFunction(10.f, 0.0f, dummy_func, "llBase64ToInteger", "i", "s", "integer llBase64ToInteger(string str)\nBig endian decode of a Base64 string into an integer."));
358 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetGMTclock", "f", "", "float llGetGMTclock()\nGets the time in seconds since midnight in GMT"));
359 addFunction(new LLScriptLibraryFunction(10.f, 10.f, dummy_func, "llGetSimulatorHostname", "s", "", "string llGetSimulatorHostname()\nGets the hostname of the machine script is running on (same as string in viewer Help dialog)"));
360
361 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLocalRot", NULL, "q", "llSetLocalRot(rotation rot)\nsets the rotation of a child prim relative to the root prim"));
362
363 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llParseStringKeepNulls", "l", "sll", "list llParseStringKeepNulls(string src, list separators, list spacers)\nBreaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each), keeping any null values generated."));
364 addFunction(new LLScriptLibraryFunction(200.f, 0.1f, dummy_func, "llRezAtRoot", NULL, "svvqi", "llRezAtRoot(string inventory, vector pos, vector vel, rotation rot, integer param)\nInstantiate owner's inventory object at pos with velocity vel and rotation rot with start parameter param.\nThe last selected root object's location will be set to pos"));
365
366 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectPermMask", "i", "i", "integer llGetObjectPermMask(integer mask)\nReturns the requested permission mask for the root object the task is attached to.", FALSE));
367 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetObjectPermMask", NULL, "ii", "llSetObjectPermMask(integer mask, integer value)\nSets the given permission mask to the new value on the root object the task is attached to.", TRUE));
368
369 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryPermMask", "i", "si", "integer llGetInventoryPermMask(string item, integer mask)\nReturns the requested permission mask for the inventory item.", FALSE));
370 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetInventoryPermMask", NULL, "sii", "llSetInventoryPermMask(string item, integer mask, integer value)\nSets the given permission mask to the new value on the inventory item.", TRUE));
371 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryCreator", "k", "s", "key llGetInventoryCreator(string item)\nReturns the key for the creator of the inventory item.", FALSE));
372 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llOwnerSay", NULL, "s", "llOwnerSay(string msg)\nsays msg to owner only (if owner in sim)"));
373 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llRequestSimulatorData", "k", "si", "key llRequestSimulatorData(string simulator, integer data)\nRequests data about simulator. When data is available the dataserver event will be raised"));
374 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llForceMouselook", NULL, "i", "llForceMouselook(integer mouselook)\nIf mouselook is TRUE any avatar that sits on this object is forced into mouselook mode"));
375 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectMass", "f", "k", "float llGetObjectMass(key id)\nGet the mass of the object with key id"));
376 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListReplaceList", "l", "llii", "list llListReplaceList(list dest, list src, integer start, integer end)\nReplaces start through end of dest with src."));
377 addFunction(new LLScriptLibraryFunction(10.f, 10.f, dummy_func, "llLoadURL", NULL, "kss", "llLoadURL(key avatar_id, string message, string url)\nShows dialog to avatar avatar_id offering to load web page at URL. If user clicks yes, launches their web browser."));
378
379 addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llParcelMediaCommandList", NULL, "l", "llParcelMediaCommandList(list command)\nSends a list of commands, some with arguments, to a parcel."));
380 addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llParcelMediaQuery", "l", "l", "list llParcelMediaQuery(list query)\nSends a list of queries, returns a list of results."));
381
382 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llModPow", "i", "iii", "integer llModPow(integer a, integer b, integer c)\nReturns a raised to the b power, mod c. ( (a**b)%c ). b is capped at 0xFFFF (16 bits)."));
383
384 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryType", "i", "s", "integer llGetInventoryType(string name)\nReturns the type of the inventory name"));
385 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetPayPrice", NULL, "il", "llSetPayPrice(integer price, list quick_pay_buttons)\nSets the default amount when someone chooses to pay this object."));
386 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", "", "vector llGetCameraPos()\nGets current camera position for agent task has permissions for."));
387 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", "", "rotation llGetCameraRot()\nGets current camera orientation for agent task has permissions for."));
388
389 addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llSetPrimURL", NULL, "s", "llSetPrimURL(string url)\nUpdates the URL for the web page shown on the sides of the object."));
390 addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, "", "llRefreshPrimURL()\nReloads the web page shown on the sides of the object."));
391
392 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEscapeURL", "s", "s", "string llEscapeURL(string url)\nReturns and escaped/encoded version of url, replacing spaces with %20 etc."));
393 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llUnescapeURL", "s", "s", "string llUnescapeURL(string url)\nReturns and unescaped/unencoded version of url, replacing %20 with spaces etc."));
394
395 addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llMapDestination", NULL, "svv", "llMapDestination(string simname, vector pos, vector look_at)\nOpens world map centered on region with pos highlighted.\nOnly works for scripts attached to avatar, or during touch events.\n(NOTE: look_at currently does nothing)"));
396 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llAddToLandBanList", NULL, "kf", "llAddToLandBanList(key avatar, float hours)\nAdd avatar to the land ban list for hours"));
397 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandPassList", NULL, "k", "llRemoveFromLandPassList(key avatar)\nRemove avatar from the land pass list"));
398 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandBanList", NULL, "k", "llRemoveFromLandBanList(key avatar)\nRemove avatar from the land ban list"));
399
400 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCameraParams", NULL, "l", "llSetCameraParams(list rules)\nSets multiple camera parameters at once.\nList format is [ rule1, data1, rule2, data2 . . . rulen, datan ]"));
401 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llClearCameraParams", NULL, NULL, "llClearCameraParams()\nResets all camera parameters to default values and turns off scripted camera control."));
402
403 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListStatistics", "f", "il", "integer llListStatistics(integer operation, list l)\nPerform statistical aggregate functions on list l using LIST_STAT_* operations."));
404 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetUnixTime", "i", NULL, "integer llGetUnixTime()\nGet the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock."));
405 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelFlags", "i", "v", "integer llGetParcelFlags(vector pos)\nGet the parcel flags (PARCEL_FLAG_*) for the parcel including the point pos."));
406 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionFlags", "i", NULL, "integer llGetRegionFlags()\nGet the region flags (REGION_FLAG_*) for the region the object is in."));
407 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llXorBase64StringsCorrect", "s", "ss", "string llXorBase64StringsCorrect(string s1, string s2)\nCorrectly performs an exclusive or on two Base 64 strings and returns a Base 64 string. s2 repeats if it is shorter than s1."));
408
409 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llHTTPRequest", "k", "sls", "llHTTPRequest(string url, list parameters, string body)\nSend an HTTP request."));
410
411 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llResetLandBanList", NULL, NULL, "llResetLandBanList()\nRemoves all residents from the land ban list."));
412 addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llResetLandPassList", NULL, NULL, "llResetLandPassList()\nRemoves all residents from the land access/pass list."));
413
414 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectPrimCount", "i", "k", "integer llGetObjectPrimCount(key object_id)\nReturns the total number of prims for an object."));
415 addFunction(new LLScriptLibraryFunction(10.f, 2.0f, dummy_func, "llGetParcelPrimOwners", "l", "v", "list llGetParcelPrimOwners(vector pos)\nReturns a list of all residents who own objects on the parcel and the number of objects they own.\nRequires owner-like permissions for the parcel."));
416 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelPrimCount", "i", "vii","integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)\nGets the number of prims on the parcel of the given category.\nCategories: PARCEL_COUNT_TOTAL, _OWNER, _GROUP, _OTHER, _SELECTED, _TEMP."));
417 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelMaxPrims", "i", "vi","integer llGetParcelMaxPrims(vector pos, integer sim_wide)\nGets the maximum number of prims allowed on the parcel at pos."));
418 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelDetails", "l", "vl","list llGetParcelDetails(vector pos, list params)\nGets the parcel details specified in params for the parcel at pos.\nParams is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA"));
419
420 // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only
421
422 // IF YOU ADD NEW SCRIPT CALLS, YOU MUST PUT THEM AT THE END OF THIS LIST.
423 // Otherwise the bytecode numbers for each call will be wrong, and all
424 // existing scripts will crash.
425}
426
427 //Ventrella Follow Cam Script Stuff
428 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPitch", NULL, "f", "llSetCamPitch(-45 to 80)\n(Adjusts the angular amount that the camera aims straight ahead vs. straight down, maintaining the same distance. Analogous to 'incidence'."));
429 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamVerticalOffset", NULL, "f", "llSetCamVerticalOffset(-2 to 2)\nAdjusts the vertical position of the camera focus position relative to the subject"));
430 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLag", NULL, "f", "llSetCamPositionLag(0 to 3) \nHow much the camera lags as it tries to move towards its 'ideal' position"));
431 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLag", NULL, "f", "llSetCamFocusLag(0 to 3)\nHow much the camera lags as it tries to aim towards the subject"));
432 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamDistance", NULL, "f", "llSetCamDistance(0.5 to 10)\nSets how far away the camera wants to be from its subject"));
433 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamBehindnessAngle", NULL, "f", "llSetCamBehindnessAngle(0 to 180)\nSets the angle in degrees within which the camera is not constrained by changes in subject rotation"));
434 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamBehindnessLag", NULL, "f", "llSetCamBehindnessLag(0 to 3)\nSets how strongly the camera is forced to stay behind the target if outside of behindness angle"));
435 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionThreshold", NULL, "f", "llSetCamPositionThreshold(0 to 4)\nSets the radius of a sphere around the camera's ideal position within which it is not affected by subject motion"));
436 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusThreshold", NULL, "f", "llSetCamFocusThreshold(0 to 4)\nSets the radius of a sphere around the camera's subject position within which its focus is not affected by subject motion"));
437 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamScriptControl", NULL, "i", "llSetCamScriptControl(TRUE or FALSE)\nTurns on or off scripted control of the camera"));
438 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPosition", NULL, "v", "llSetCamPosition(vector)\nSets the position of the camera"));
439 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocus", NULL, "v", "llSetCamFocus(vector focus)\nSets the focus (target position) of the camera"));
440 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLocked", NULL, "i", "llSetCamPositionLocked(TRUE or FALSE)\nLocks the camera position so it will not move"));
441 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLocked", NULL, "i", "llSetCamFocusLocked(TRUE or FALSE)\nLocks the camera focus so it will not move"));
442
443// These functions are being put on hold until we think through how we want them handled (security issues). DK 02/16/05
444 //addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkPrimitiveParams", NULL, "il", "llSetLinkPrimitiveParams(integer linknumber, list rules)\nSet primitive parameters for linknumber based on rules."));
445 //addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkTexture", NULL, "isi", "llSetLinkTexture(integer link_pos, string texture, integer face)\nSets the texture of face for link_pos"));
446
447 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale."));
448
449LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only)
450 : mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only)
451{
452 mDesc = new char[512];
453 if (mSleepTime)
454 {
455 sprintf(mDesc,"%s\nSleeps script for %.1f seconds.",desc,mSleepTime);
456 }
457 else
458 {
459 strcpy(mDesc,desc);
460 }
461}
462
463LLScriptLibraryFunction::~LLScriptLibraryFunction()
464{
465 delete [] mDesc;
466}
467
468void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func)
469{
470 LLScriptLibraryFunction **temp = (LLScriptLibraryFunction **)new U32[mNextNumber + 1];
471 if (mNextNumber)
472 {
473 memcpy(temp, mFunctions, sizeof(LLScriptLibraryFunction *)*mNextNumber);
474 delete [] mFunctions;
475 }
476 mFunctions = temp;
477 mFunctions[mNextNumber] = func;
478 mNextNumber++;
479}
480
481void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &))
482{
483 S32 i;
484 for (i = 0; i < mNextNumber; i++)
485 {
486 if (!strcmp(name, mFunctions[i]->mName))
487 {
488 mFunctions[i]->mExecFunc = exec_func;
489 }
490 }
491}
492
493void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
494{
495 char tmp[1024];
496 if (b_prepend_comma)
497 {
498 s << ", ";
499 }
500 switch (mType)
501 {
502 case LST_INTEGER:
503 s << mInteger;
504 break;
505 case LST_FLOATINGPOINT:
506 snprintf(tmp, 1024, "%f", mFP);
507 s << tmp;
508 break;
509 case LST_KEY:
510 s << mKey;
511 break;
512 case LST_STRING:
513 s << mString;
514 break;
515 case LST_VECTOR:
516 snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX],
517 mVec.mV[VY], mVec.mV[VZ]);
518 s << tmp;
519 break;
520 case LST_QUATERNION:
521 snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY],
522 mQuat.mQ[VZ], mQuat.mQ[VS]);
523 s << tmp;
524 break;
525 default:
526 break;
527 }
528}
529
530void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep)
531{
532 if (b_prepend_sep)
533 {
534 ostr << sep;
535 }
536 //print(ostr, FALSE);
537 {
538 BOOL b_prepend_comma = FALSE;
539 char tmp[1024];
540 if (b_prepend_comma)
541 {
542 ostr << ", ";
543 }
544 switch (mType)
545 {
546 case LST_INTEGER:
547 ostr << mInteger;
548 break;
549 case LST_FLOATINGPOINT:
550 snprintf(tmp, 1024, "%f", mFP);
551 ostr << tmp;
552 break;
553 case LST_KEY:
554 ostr << mKey;
555 break;
556 case LST_STRING:
557 ostr << mString;
558 break;
559 case LST_VECTOR:
560 snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX],
561 mVec.mV[VY], mVec.mV[VZ]);
562 ostr << tmp;
563 break;
564 case LST_QUATERNION:
565 snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY],
566 mQuat.mQ[VZ], mQuat.mQ[VS]);
567 ostr << tmp;
568 break;
569 default:
570 break;
571 }
572 }
573}
574
575
576LLScriptLibrary gScriptLibrary;
diff --git a/linden/indra/lscript/lscript_library/lscript_library.vcproj b/linden/indra/lscript/lscript_library/lscript_library.vcproj
new file mode 100644
index 0000000..f4861c7
--- /dev/null
+++ b/linden/indra/lscript/lscript_library/lscript_library.vcproj
@@ -0,0 +1,183 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="7.10"
5 Name="lscript_library"
6 ProjectGUID="{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}"
7 Keyword="Win32Proj">
8 <Platforms>
9 <Platform
10 Name="Win32"/>
11 </Platforms>
12 <Configurations>
13 <Configuration
14 Name="Debug|Win32"
15 OutputDirectory="../../lib_$(ConfigurationName)/i686-win32"
16 IntermediateDirectory="Debug"
17 ConfigurationType="4"
18 CharacterSet="1">
19 <Tool
20 Name="VCCLCompilerTool"
21 Optimization="0"
22 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath"
23 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG"
24 MinimalRebuild="TRUE"
25 BasicRuntimeChecks="3"
26 RuntimeLibrary="1"
27 StructMemberAlignment="4"
28 ForceConformanceInForLoopScope="TRUE"
29 UsePrecompiledHeader="0"
30 WarningLevel="3"
31 WarnAsError="TRUE"
32 Detect64BitPortabilityProblems="FALSE"
33 DebugInformationFormat="4"/>
34 <Tool
35 Name="VCCustomBuildTool"/>
36 <Tool
37 Name="VCLibrarianTool"
38 OutputFile="$(OutDir)/lscript_library.lib"/>
39 <Tool
40 Name="VCMIDLTool"/>
41 <Tool
42 Name="VCPostBuildEventTool"/>
43 <Tool
44 Name="VCPreBuildEventTool"/>
45 <Tool
46 Name="VCPreLinkEventTool"/>
47 <Tool
48 Name="VCResourceCompilerTool"/>
49 <Tool
50 Name="VCWebServiceProxyGeneratorTool"/>
51 <Tool
52 Name="VCXMLDataGeneratorTool"/>
53 <Tool
54 Name="VCManagedWrapperGeneratorTool"/>
55 <Tool
56 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
57 </Configuration>
58 <Configuration
59 Name="Release|Win32"
60 OutputDirectory="../../lib_$(ConfigurationName)/i686-win32"
61 IntermediateDirectory="Release"
62 ConfigurationType="4"
63 CharacterSet="1">
64 <Tool
65 Name="VCCLCompilerTool"
66 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath"
67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
68 RuntimeLibrary="0"
69 StructMemberAlignment="0"
70 ForceConformanceInForLoopScope="TRUE"
71 UsePrecompiledHeader="0"
72 WarningLevel="3"
73 WarnAsError="TRUE"
74 Detect64BitPortabilityProblems="FALSE"
75 DebugInformationFormat="3"/>
76 <Tool
77 Name="VCCustomBuildTool"/>
78 <Tool
79 Name="VCLibrarianTool"
80 OutputFile="$(OutDir)/lscript_library.lib"/>
81 <Tool
82 Name="VCMIDLTool"/>
83 <Tool
84 Name="VCPostBuildEventTool"/>
85 <Tool
86 Name="VCPreBuildEventTool"/>
87 <Tool
88 Name="VCPreLinkEventTool"/>
89 <Tool
90 Name="VCResourceCompilerTool"/>
91 <Tool
92 Name="VCWebServiceProxyGeneratorTool"/>
93 <Tool
94 Name="VCXMLDataGeneratorTool"/>
95 <Tool
96 Name="VCManagedWrapperGeneratorTool"/>
97 <Tool
98 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
99 </Configuration>
100 <Configuration
101 Name="ReleaseNoOpt|Win32"
102 OutputDirectory="../../lib_$(ConfigurationName)/i686-win32"
103 IntermediateDirectory="$(ConfigurationName)"
104 ConfigurationType="4"
105 CharacterSet="1">
106 <Tool
107 Name="VCCLCompilerTool"
108 Optimization="0"
109 AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath"
110 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE"
111 RuntimeLibrary="0"
112 StructMemberAlignment="0"
113 ForceConformanceInForLoopScope="TRUE"
114 UsePrecompiledHeader="0"
115 WarningLevel="3"
116 WarnAsError="TRUE"
117 Detect64BitPortabilityProblems="FALSE"
118 DebugInformationFormat="3"/>
119 <Tool
120 Name="VCCustomBuildTool"/>
121 <Tool
122 Name="VCLibrarianTool"
123 OutputFile="$(OutDir)/lscript_library.lib"/>
124 <Tool
125 Name="VCMIDLTool"/>
126 <Tool
127 Name="VCPostBuildEventTool"/>
128 <Tool
129 Name="VCPreBuildEventTool"/>
130 <Tool
131 Name="VCPreLinkEventTool"/>
132 <Tool
133 Name="VCResourceCompilerTool"/>
134 <Tool
135 Name="VCWebServiceProxyGeneratorTool"/>
136 <Tool
137 Name="VCXMLDataGeneratorTool"/>
138 <Tool
139 Name="VCManagedWrapperGeneratorTool"/>
140 <Tool
141 Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
142 </Configuration>
143 </Configurations>
144 <References>
145 </References>
146 <Files>
147 <Filter
148 Name="Source Files"
149 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
150 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
151 <File
152 RelativePath=".\lscript_alloc.cpp">
153 </File>
154 <File
155 RelativePath=".\lscript_export.cpp">
156 </File>
157 <File
158 RelativePath=".\lscript_library.cpp">
159 </File>
160 </Filter>
161 <Filter
162 Name="Header Files"
163 Filter="h;hpp;hxx;hm;inl;inc;xsd"
164 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
165 <File
166 RelativePath="..\lscript_alloc.h">
167 </File>
168 <File
169 RelativePath="..\lscript_export.h">
170 </File>
171 <File
172 RelativePath="..\lscript_library.h">
173 </File>
174 </Filter>
175 <Filter
176 Name="Resource Files"
177 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
178 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
179 </Filter>
180 </Files>
181 <Globals>
182 </Globals>
183</VisualStudioProject>