diff options
author | Charles Krinke | 2007-12-18 02:41:34 +0000 |
---|---|---|
committer | Charles Krinke | 2007-12-18 02:41:34 +0000 |
commit | 6f389ba4cf54d7e964b98430f7a6601d3ec0c73b (patch) | |
tree | 2c092e7bea58052485854d3a3c9e548c790abb5b /OpenSim/Region/ScriptEngine/Common | |
parent | * Fixed a potential race condition with adding Caps handlers (diff) | |
download | opensim-SC_OLD-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.zip opensim-SC_OLD-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.tar.gz opensim-SC_OLD-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.tar.bz2 opensim-SC_OLD-6f389ba4cf54d7e964b98430f7a6601d3ec0c73b.tar.xz |
Many Thanks to Alondria for adding:
The list type and a bunch of support functions to LSL
Added/ReImplmented: llGetListLength(), llList2Integer(), osList2Double() (note rename),
llList2Float(), llList2String(), llList2Key(), llList2Vector(), llList2Rot(),
llList2List(), llDeleteSubList(), llGetListEntryType(), llList2CSV(), llCSV2List(),
llListInsertList(), llDumpList2String(),
Borked Still: llListSort(), llListRandomize(), llList2ListStrided(), llListFindList(),
Changed: llHTTPRequest() (Made wrapper of LSL_Types.list->List<string>)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | 61 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 114 |
2 files changed, 145 insertions, 30 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 60e2a0e..34bac59 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -345,41 +345,41 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
345 | //wiki: vector llGetCenterOfMass() | 345 | //wiki: vector llGetCenterOfMass() |
346 | LSL_Types.Vector3 llGetCenterOfMass(); | 346 | LSL_Types.Vector3 llGetCenterOfMass(); |
347 | //wiki: list llListSort(list src, integer stride, integer ascending) | 347 | //wiki: list llListSort(list src, integer stride, integer ascending) |
348 | List<string> llListSort(List<string> src, int stride, int ascending); | 348 | LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending); |
349 | //integer llGetListLength(list src) | 349 | //integer llGetListLength(list src) |
350 | int llGetListLength(List<string> src); | 350 | int llGetListLength(LSL_Types.list src); |
351 | //wiki: integer llList2Integer(list src, integer index) | 351 | //wiki: integer llList2Integer(list src, integer index) |
352 | int llList2Integer(List<string> src, int index); | 352 | int llList2Integer(LSL_Types.list src, int index); |
353 | //wiki: double llList2double(list src, integer index) | 353 | //wiki: double llList2double(list src, integer index) |
354 | double llList2double(List<string> src, int index); | 354 | double osList2Double(LSL_Types.list src, int index); |
355 | //wiki: string llList2String(list src, integer index) | 355 | //wiki: string llList2String(list src, integer index) |
356 | string llList2String(List<string> src, int index); | 356 | string llList2String(LSL_Types.list src, int index); |
357 | //wiki: key llList2Key(list src, integer index) | 357 | //wiki: key llList2Key(list src, integer index) |
358 | string llList2Key(List<string> src, int index); | 358 | string llList2Key(LSL_Types.list src, int index); |
359 | //wiki: vector llList2Vector(list src, integer index) | 359 | //wiki: vector llList2Vector(list src, integer index) |
360 | LSL_Types.Vector3 llList2Vector(List<string> src, int index); | 360 | LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index); |
361 | //wiki rotation llList2Rot(list src, integer index) | 361 | //wiki rotation llList2Rot(list src, integer index) |
362 | LSL_Types.Quaternion llList2Rot(List<string> src, int index); | 362 | LSL_Types.Quaternion llList2Rot(LSL_Types.list src, int index); |
363 | //wiki: list llList2List(list src, integer start, integer end) | 363 | //wiki: list llList2List(list src, integer start, integer end) |
364 | List<string> llList2List(List<string> src, int start, int end); | 364 | LSL_Types.list llList2List(LSL_Types.list src, int start, int end); |
365 | //wiki: llDeleteSubList(list src, integer start, integer end) | 365 | //wiki: llDeleteSubList(list src, integer start, integer end) |
366 | List<string> llDeleteSubList(List<string> src, int start, int end); | 366 | LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end); |
367 | //wiki: integer llGetListEntryType( list src, integer index ) | 367 | //wiki: integer llGetListEntryType( list src, integer index ) |
368 | int llGetListEntryType(List<string> src, int index); | 368 | int llGetListEntryType(LSL_Types.list src, int index); |
369 | //wiki: string llList2CSV( list src ) | 369 | //wiki: string llList2CSV( list src ) |
370 | string llList2CSV(List<string> src); | 370 | string llList2CSV(LSL_Types.list src); |
371 | //wiki: list llCSV2List( string src ) | 371 | //wiki: list llCSV2List( string src ) |
372 | List<string> llCSV2List(string src); | 372 | LSL_Types.list llCSV2List(string src); |
373 | //wiki: list llListRandomize( list src, integer stride ) | 373 | //wiki: list llListRandomize( list src, integer stride ) |
374 | List<string> llListRandomize(List<string> src, int stride); | 374 | LSL_Types.list llListRandomize(LSL_Types.list src, int stride); |
375 | //wiki: list llList2ListStrided( list src, integer start, integer end, integer stride ) | 375 | //wiki: list llList2ListStrided( list src, integer start, integer end, integer stride ) |
376 | List<string> llList2ListStrided(List<string> src, int start, int end, int stride); | 376 | LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride); |
377 | //wiki: vector llGetRegionCorner( ) | 377 | //wiki: vector llGetRegionCorner( ) |
378 | LSL_Types.Vector3 llGetRegionCorner(); | 378 | LSL_Types.Vector3 llGetRegionCorner(); |
379 | //wiki: list llListInsertList( list dest, list src, integer start ) | 379 | //wiki: list llListInsertList( list dest, list src, integer start ) |
380 | List<string> llListInsertList(List<string> dest, List<string> src, int start); | 380 | LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start); |
381 | //wiki: integer llListFindList( list src, list test ) | 381 | //wiki: integer llListFindList( list src, list test ) |
382 | int llListFindList(List<string> src, List<string> test); | 382 | int llListFindList(LSL_Types.list src, LSL_Types.list test); |
383 | //wiki: string llGetObjectName() | 383 | //wiki: string llGetObjectName() |
384 | string llGetObjectName(); | 384 | string llGetObjectName(); |
385 | //wiki: llSetObjectName(string name) | 385 | //wiki: llSetObjectName(string name) |
@@ -466,11 +466,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
466 | void llSetCameraEyeOffset(LSL_Types.Vector3 offset); | 466 | void llSetCameraEyeOffset(LSL_Types.Vector3 offset); |
467 | //wiki: llSeteCameraAtOffset(vector offset) | 467 | //wiki: llSeteCameraAtOffset(vector offset) |
468 | void llSetCameraAtOffset(LSL_Types.Vector3 offset); | 468 | void llSetCameraAtOffset(LSL_Types.Vector3 offset); |
469 | void llDumpList2String(); | 469 | // |
470 | string llDumpList2String(LSL_Types.list src, string seperator); | ||
470 | //wiki: integer llScriptDanger(vector pos) | 471 | //wiki: integer llScriptDanger(vector pos) |
471 | void llScriptDanger(LSL_Types.Vector3 pos); | 472 | void llScriptDanger(LSL_Types.Vector3 pos); |
472 | //wiki: llDialog( key avatar, string message, list buttons, integer chat_channel ) | 473 | //wiki: llDialog( key avatar, string message, list buttons, integer chat_channel ) |
473 | void llDialog(string avatar, string message, List<string> buttons, int chat_channel); | 474 | void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel); |
474 | //wiki: llVolumeDetect(integer detect) | 475 | //wiki: llVolumeDetect(integer detect) |
475 | void llVolumeDetect(int detect); | 476 | void llVolumeDetect(int detect); |
476 | //wiki: llResetOtherScript(string name) | 477 | //wiki: llResetOtherScript(string name) |
@@ -494,7 +495,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
494 | //wiki: string llMD5String(string src, integer nonce) | 495 | //wiki: string llMD5String(string src, integer nonce) |
495 | string llMD5String(string src, int nonce); | 496 | string llMD5String(string src, int nonce); |
496 | //wiki: llSetPrimitiveParams( list rules ) | 497 | //wiki: llSetPrimitiveParams( list rules ) |
497 | void llSetPrimitiveParams(List<string> rules); | 498 | void llSetPrimitiveParams(LSL_Types.list rules); |
498 | //wiki: string llStringToBase64(string str) | 499 | //wiki: string llStringToBase64(string str) |
499 | string llStringToBase64(string str); | 500 | string llStringToBase64(string str); |
500 | //wiki: string llBase64ToString(string str) | 501 | //wiki: string llBase64ToString(string str) |
@@ -508,7 +509,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
508 | //wiki: double llLog(double val) | 509 | //wiki: double llLog(double val) |
509 | double llLog(double val); | 510 | double llLog(double val); |
510 | //wiki: list llGetAnimationList( key id ) | 511 | //wiki: list llGetAnimationList( key id ) |
511 | List<string> llGetAnimationList(string id); | 512 | LSL_Types.list llGetAnimationList(string id); |
512 | //wiki: llSetParcelMusicURL(string url) | 513 | //wiki: llSetParcelMusicURL(string url) |
513 | void llSetParcelMusicURL(string url); | 514 | void llSetParcelMusicURL(string url); |
514 | //wiki: vector llGetRootPosition() | 515 | //wiki: vector llGetRootPosition() |
@@ -530,7 +531,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
530 | //wiki: key llGetNumberOfNotecardLines(string name) | 531 | //wiki: key llGetNumberOfNotecardLines(string name) |
531 | string llGetNumberOfNotecardLines(string name); | 532 | string llGetNumberOfNotecardLines(string name); |
532 | //wiki: list llGetBoundingBox( key object ) | 533 | //wiki: list llGetBoundingBox( key object ) |
533 | List<string> llGetBoundingBox(string obj); | 534 | LSL_Types.list llGetBoundingBox(string obj); |
534 | //wiki: vector llGetGeometricCenter() | 535 | //wiki: vector llGetGeometricCenter() |
535 | LSL_Types.Vector3 llGetGeometricCenter(); | 536 | LSL_Types.Vector3 llGetGeometricCenter(); |
536 | void llGetPrimitiveParams(); | 537 | void llGetPrimitiveParams(); |
@@ -545,7 +546,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
545 | //llSetLocalRot(rotation rot) | 546 | //llSetLocalRot(rotation rot) |
546 | void llSetLocalRot(LSL_Types.Quaternion rot); | 547 | void llSetLocalRot(LSL_Types.Quaternion rot); |
547 | //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) | 548 | //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) |
548 | List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers); | 549 | LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers); |
549 | //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) | 550 | //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) |
550 | void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, | 551 | void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, |
551 | LSL_Types.Quaternion rot, int param); | 552 | LSL_Types.Quaternion rot, int param); |
@@ -572,14 +573,14 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
572 | //wiki: llLoadURL(key avatar_id, string message, string url) | 573 | //wiki: llLoadURL(key avatar_id, string message, string url) |
573 | void llLoadURL(string avatar_id, string message, string url); | 574 | void llLoadURL(string avatar_id, string message, string url); |
574 | //wiki: llParcelMediaCommandList( list commandList ) | 575 | //wiki: llParcelMediaCommandList( list commandList ) |
575 | void llParcelMediaCommandList(List<string> commandList); | 576 | void llParcelMediaCommandList(LSL_Types.list commandList); |
576 | void llParcelMediaQuery(); | 577 | void llParcelMediaQuery(); |
577 | //wiki integer llModPow(integer a, integer b, integer c) | 578 | //wiki integer llModPow(integer a, integer b, integer c) |
578 | int llModPow(int a, int b, int c); | 579 | int llModPow(int a, int b, int c); |
579 | //wiki: integer llGetInventoryType(string name) | 580 | //wiki: integer llGetInventoryType(string name) |
580 | int llGetInventoryType(string name); | 581 | int llGetInventoryType(string name); |
581 | //wiki: llSetPayPrice( integer price, list quick_pay_buttons ) | 582 | //wiki: llSetPayPrice( integer price, list quick_pay_buttons ) |
582 | void llSetPayPrice(int price, List<string> quick_pay_buttons); | 583 | void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons); |
583 | //wiki: vector llGetCameraPos() | 584 | //wiki: vector llGetCameraPos() |
584 | LSL_Types.Vector3 llGetCameraPos(); | 585 | LSL_Types.Vector3 llGetCameraPos(); |
585 | //wiki rotation llGetCameraRot() | 586 | //wiki rotation llGetCameraRot() |
@@ -601,11 +602,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
601 | //wiki: llRemoveFromLandBanList(key avatar) | 602 | //wiki: llRemoveFromLandBanList(key avatar) |
602 | void llRemoveFromLandBanList(string avatar); | 603 | void llRemoveFromLandBanList(string avatar); |
603 | //wiki: llSetCameraParams( list rules ) | 604 | //wiki: llSetCameraParams( list rules ) |
604 | void llSetCameraParams(List<string> rules); | 605 | void llSetCameraParams(LSL_Types.list rules); |
605 | //wiki: llClearCameraParams() | 606 | //wiki: llClearCameraParams() |
606 | void llClearCameraParams(); | 607 | void llClearCameraParams(); |
607 | //wiki: double llListStatistics( integer operation, list src ) | 608 | //wiki: double llListStatistics( integer operation, list src ) |
608 | double llListStatistics(int operation, List<string> src); | 609 | double llListStatistics(int operation, LSL_Types.list src); |
609 | //wiki: integer llGetUnixTime() | 610 | //wiki: integer llGetUnixTime() |
610 | int llGetUnixTime(); | 611 | int llGetUnixTime(); |
611 | //wiki: integer llGetParcelFlags(vector pos) | 612 | //wiki: integer llGetParcelFlags(vector pos) |
@@ -614,7 +615,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
614 | int llGetRegionFlags(); | 615 | int llGetRegionFlags(); |
615 | //wiki: string llXorBase64StringsCorrect(string str1, string str2) | 616 | //wiki: string llXorBase64StringsCorrect(string str1, string str2) |
616 | string llXorBase64StringsCorrect(string str1, string str2); | 617 | string llXorBase64StringsCorrect(string str1, string str2); |
617 | string llHTTPRequest(string url, List<string> parameters, string body); | 618 | string llHTTPRequest(string url, LSL_Types.list parameters, string body); |
618 | //wiki: llResetLandBanList() | 619 | //wiki: llResetLandBanList() |
619 | void llResetLandBanList(); | 620 | void llResetLandBanList(); |
620 | //wiki: llResetLandPassList() | 621 | //wiki: llResetLandPassList() |
@@ -622,13 +623,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
622 | //wiki integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide) | 623 | //wiki integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide) |
623 | int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide); | 624 | int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide); |
624 | //wiki: list llGetParcelPrimOwners( vector pos ) | 625 | //wiki: list llGetParcelPrimOwners( vector pos ) |
625 | List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos); | 626 | LSL_Types.list llGetParcelPrimOwners(LSL_Types.Vector3 pos); |
626 | //wiki: integer llGetObjectPrimCount(key object_id) | 627 | //wiki: integer llGetObjectPrimCount(key object_id) |
627 | int llGetObjectPrimCount(string object_id); | 628 | int llGetObjectPrimCount(string object_id); |
628 | //wiki: integer llGetParcelMaxPrims( vector pos, integer sim_wide ) | 629 | //wiki: integer llGetParcelMaxPrims( vector pos, integer sim_wide ) |
629 | int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide); | 630 | int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide); |
630 | //wiki list llGetParcelDetails(vector pos, list params) | 631 | //wiki list llGetParcelDetails(vector pos, list params) |
631 | List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param); | 632 | LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param); |
632 | 633 | ||
633 | //OpenSim functions | 634 | //OpenSim functions |
634 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); | 635 | string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index e0cf1e5..136b613 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -252,5 +252,119 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
252 | return c; | 252 | return c; |
253 | } | 253 | } |
254 | } | 254 | } |
255 | |||
256 | [Serializable] | ||
257 | public class list | ||
258 | { | ||
259 | private object[] m_data; | ||
260 | public list(params object[] args) | ||
261 | { | ||
262 | m_data = new object[args.Length]; | ||
263 | m_data = args; | ||
264 | } | ||
265 | public int Length | ||
266 | { | ||
267 | get { return m_data.Length; } | ||
268 | } | ||
269 | public object[] Data | ||
270 | { | ||
271 | get { return m_data; } | ||
272 | } | ||
273 | public static list operator +(list a, list b) | ||
274 | { | ||
275 | object[] tmp; | ||
276 | tmp = new object[a.Length + b.Length]; | ||
277 | a.Data.CopyTo(tmp, 0); | ||
278 | b.Data.CopyTo(tmp, a.Length); | ||
279 | return new list(tmp); | ||
280 | } | ||
281 | public list GetSublist(int start, int end) | ||
282 | { | ||
283 | Console.WriteLine("GetSublist(" + start.ToString() + "," + end.ToString() + ")"); | ||
284 | object[] ret; | ||
285 | // Take care of neg start or end's | ||
286 | if (start < 0) | ||
287 | { | ||
288 | start = m_data.Length + start; | ||
289 | } | ||
290 | if (end < 0) | ||
291 | { | ||
292 | end = m_data.Length + end; | ||
293 | } | ||
294 | |||
295 | // Case start < end | ||
296 | |||
297 | if (start <= end) | ||
298 | { | ||
299 | if (start >= m_data.Length) | ||
300 | { | ||
301 | return new list(); | ||
302 | } | ||
303 | if (end >= m_data.Length) | ||
304 | { | ||
305 | end = m_data.Length - 1; | ||
306 | } | ||
307 | ret = new object[end - start + 1]; | ||
308 | Array.Copy(m_data, start, ret, 0, end - start + 1); | ||
309 | return new list(ret); | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | if (start >= m_data.Length) | ||
314 | { | ||
315 | return this.GetSublist(0, end); | ||
316 | } | ||
317 | if (end >= m_data.Length) | ||
318 | { | ||
319 | return new list(); | ||
320 | } | ||
321 | // end < start | ||
322 | //ret = new object[m_data.Length - Math.Abs(end - start + 1)]; | ||
323 | //Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1); | ||
324 | //Array.Copy(m_data, start, ret, 0, m_data.Length - start); | ||
325 | return this.GetSublist(0, end) + this.GetSublist(start, this.Data.Length - 1); | ||
326 | //return new list(ret); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | public string ToPrettyString() | ||
331 | { | ||
332 | string output; | ||
333 | if (m_data.Length == 0) | ||
334 | { | ||
335 | return "[]"; | ||
336 | } | ||
337 | output = "["; | ||
338 | foreach (object o in m_data) | ||
339 | { | ||
340 | if (o.GetType().ToString() == "System.String") | ||
341 | { | ||
342 | output = output + "\"" + o + "\", "; | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | output = output + o.ToString() + ", "; | ||
347 | } | ||
348 | } | ||
349 | output = output.Substring(0, output.Length - 2); | ||
350 | output = output + "]"; | ||
351 | return output; | ||
352 | } | ||
353 | public override string ToString() | ||
354 | { | ||
355 | string output; | ||
356 | output = ""; | ||
357 | if (m_data.Length == 0) | ||
358 | { | ||
359 | return ""; | ||
360 | } | ||
361 | foreach (object o in m_data) | ||
362 | { | ||
363 | output = output + o.ToString(); | ||
364 | } | ||
365 | return output; | ||
366 | } | ||
367 | } | ||
255 | } | 368 | } |
369 | |||
256 | } | 370 | } |