From 226339cd400bd6d74218c0d067a2671b91a7a802 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 15 Aug 2007 16:57:01 +0000 Subject: * Applying ckrinke's LSL baseclass changes (Thanks!) --- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 102 +++++++++++---------- .../Server_API/LSL_BuiltIn_Commands_Interface.cs | 92 ++++++++++++------- 2 files changed, 114 insertions(+), 80 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index b411a20..4af438a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -20,25 +20,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL return; } - // - // IMPLEMENT THESE! - // - - - - - public float llSin(float f) { return 0; } - public float llCos(float f) { return 0; } - public float llTan(float f) { return 0; } - public float llAtan2(float x, float y) { return 0; } - public float llSqrt(float f) { return 0; } - public float llPow(float fbase, float fexponent) { return 0; } - public UInt32 llAbs(Int32 i) { return 0; } - public float llFabs(float f) { return 0; } +//These are the implementations of the various ll-functions used by the LSL scripts. + //starting out, we use the System.Math library for trig functions. - CFK 8-14-07 + public float llSin(float f) { return (float)Math.Sin(f); } + public float llCos(float f) { return (float)Math.Cos(f); } + public float llTan(float f) { return (float)Math.Tan(f); } + public float llAtan2(float x, float y) { return (float)Math.Atan2(y, x); } + public float llSqrt(float f) { return (float)Math.Sqrt(f); } + public float llPow(float fbase, float fexponent) { return (float)Math.Pow(fbase, fexponent); } + public Int32 llAbs(Int32 i) { return (Int32)Math.Abs(i); } + public float llFabs(float f) { return (float)Math.Abs(f); } public float llFrand(float mag) { return 0; } - public UInt32 llFloor(float f) { return 0; } - public UInt32 llCeil(float f) { return 0; } - public UInt32 llRound(float f) { return 0; } + public Int32 llFloor(float f) { return (Int32)Math.Floor(f); } + public Int32 llCeil(float f) { return (Int32)Math.Ceiling(f); } + public Int32 llRound(float f) { return (Int32)Math.Round(f, 1); } public float llVecMag(Axiom.Math.Vector3 v) { return 0; } public Axiom.Math.Vector3 llVecNorm(Axiom.Math.Vector3 v) { return new Axiom.Math.Vector3(); } public float llVecDist(Axiom.Math.Vector3 a, Axiom.Math.Vector3 b) { return 0; } @@ -233,24 +228,34 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public Int32 llSubStringIndex(string source, string pattern) { return 0; } public string llGetOwnerKey(string id) { return ""; } public Axiom.Math.Vector3 llGetCenterOfMass() { return new Axiom.Math.Vector3(); } - public void llListSort() { } - public void llGetListLength() { } - public void llList2Integer() { } - public void llList2Float() { } - public void llList2String() { } - public void llList2Key() { } - public void llList2Vector() { } - public void llList2Rot() { } - public void llList2List() { } - public void llDeleteSubList() { } - public void llGetListEntryType() { } - public void llList2CSV() { } - public void llCSV2List() { } - public void llListRandomize() { } - public void llList2ListStrided() { } - public void llGetRegionCorner() { } - public void llListInsertList() { } - public void llListFindList() { } + public List llListSort(List src, Int32 stride, Int32 ascending) + { return new List(); } + public Int32 llGetListLength(List src) { return 0; } + public Int32 llList2Integer(List src, Int32 index) { return 0;} + public float llList2Float(List src, Int32 index) { return 0; } + public string llList2String(List src, Int32 index) { return ""; } + public string llList2Key(List src, Int32 index) { return ""; } + public Axiom.Math.Vector3 llList2Vector(List src, Int32 index) + { return new Axiom.Math.Vector3(); } + public Axiom.Math.Quaternion llList2Rot(List src, Int32 index) + { return new Axiom.Math.Quaternion(); } + public List llList2List(List src, Int32 start, Int32 end) + { return new List(); } + public List llDeleteSubList(List src, Int32 start, Int32 end) + { return new List(); } + public Int32 llGetListEntryType(List src, Int32 index) { return 0; } + public string llList2CSV(List src) { return ""; } + public List llCSV2List(string src) + { return new List(); } + public List llListRandomize(List src, Int32 stride) + { return new List(); } + public List llList2ListStrided(List src, Int32 start, Int32 end, Int32 stride) + { return new List(); } + public Axiom.Math.Vector3 llGetRegionCorner() + { return new Axiom.Math.Vector3(); } + public List llListInsertList(List dest, List src, Int32 start) + { return new List(); } + public Int32 llListFindList(List src, List test) { return 0; } public string llGetObjectName() { return ""; } public void llSetObjectName(string name) { } public string llGetDate() { return ""; } @@ -300,7 +305,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public void llSetCameraAtOffset(Axiom.Math.Vector3 offset) { } public void llDumpList2String() { } public void llScriptDanger(Axiom.Math.Vector3 pos) { } - public void llDialog() { } + public void llDialog(string avatar, string message, List buttons, Int32 chat_channel) { } public void llVolumeDetect(Int32 detect) { } public void llResetOtherScript(string name) { } public Int32 llGetScriptState(string name) { return 0; } @@ -314,14 +319,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public string llMD5String(string src, Int32 nonce) { return OpenSim.Framework.Utilities.Util.Md5Hash(src + ":" + nonce.ToString()); } - public void llSetPrimitiveParams() { } + public void llSetPrimitiveParams(List rules) { } public string llStringToBase64(string str) { return ""; } public string llBase64ToString(string str) { return ""; } public void llXorBase64Strings() { } public void llRemoteDataSetRegion() { } - public float llLog10(float val) { return 0; } - public float llLog(float val) { return 0; } - public void llGetAnimationList() { } + public float llLog10(float val) { return (float)Math.Log10(val); } + public float llLog(float val) { return (float)Math.Log(val); } + public List llGetAnimationList(string id) { return new List(); } public void llSetParcelMusicURL(string url) { } public Axiom.Math.Vector3 llGetRootPosition() { return new Axiom.Math.Vector3(); } public Axiom.Math.Quaternion llGetRootRotation() { return new Axiom.Math.Quaternion(); } @@ -332,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public void llSetLinkAlpha(Int32 linknumber, float alpha, Int32 face) { } public Int32 llGetNumberOfPrims() { return 0; } public string llGetNumberOfNotecardLines(string name) { return ""; } - public void llGetBoundingBox() { } + public List llGetBoundingBox(string obj) { return new List(); } public Axiom.Math.Vector3 llGetGeometricCenter() { return new Axiom.Math.Vector3(); } public void llGetPrimitiveParams() { } public string llIntegerToBase64(Int32 number) { return ""; } @@ -340,7 +345,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public float llGetGMTclock() { return 0; } public string llGetSimulatorHostname() { return ""; } public void llSetLocalRot(Axiom.Math.Quaternion rot) { } - public void llParseStringKeepNulls() { } + public List llParseStringKeepNulls(string src, List seperators, List spacers) + { return new List(); } public void llRezAtRoot(string inventory, Axiom.Math.Vector3 position, Axiom.Math.Vector3 velocity, Axiom.Math.Quaternion rot, Int32 param) { } public Int32 llGetObjectPermMask(Int32 mask) { return 0; } public void llSetObjectPermMask(Int32 mask, Int32 value) { } @@ -353,7 +359,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public float llGetObjectMass(string id) { return 0; } public void llListReplaceList() { } public void llLoadURL(string avatar_id, string message, string url) { } - public void llParcelMediaCommandList() { } + public void llParcelMediaCommandList(List commandList) { } public void llParcelMediaQuery() { } public Int32 llModPow(Int32 a, Int32 b, Int32 c) { @@ -364,7 +370,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL } public Int32 llGetInventoryType(string name) { return 0; } - public void llSetPayPrice() { } + public void llSetPayPrice(Int32 price, List quick_pay_buttons) { } public Axiom.Math.Vector3 llGetCameraPos() { return new Axiom.Math.Vector3(); } public Axiom.Math.Quaternion llGetCameraRot() { return new Axiom.Math.Quaternion(); } public void llSetPrimURL() { } @@ -375,9 +381,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public void llAddToLandBanList(string avatar, float hours) { } public void llRemoveFromLandPassList(string avatar) { } public void llRemoveFromLandBanList(string avatar) { } - public void llSetCameraParams() { } + public void llSetCameraParams(List rules) { } public void llClearCameraParams() { } - public void llListStatistics() { } + public float llListStatistics(Int32 operation, List src) { return 0; } public Int32 llGetUnixTime() { return OpenSim.Framework.Utilities.Util.UnixTimeSinceEpoch(); } @@ -388,7 +394,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public void llResetLandBanList() { } public void llResetLandPassList() { } public Int32 llGetParcelPrimCount(Axiom.Math.Vector3 pos, Int32 category, Int32 sim_wide) { return 0; } - public void llGetParcelPrimOwners() { } + public List llGetParcelPrimOwners(Axiom.Math.Vector3 pos) { return new List(); } public Int32 llGetObjectPrimCount(string object_id) { return 0; } public Int32 llGetParcelMaxPrims(Axiom.Math.Vector3 pos, Int32 sim_wide) { return 0; } public List llGetParcelDetails(Axiom.Math.Vector3 pos, List param) { return new List(); } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs index 4bc8b77..d2b8d0a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs @@ -40,12 +40,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler float llAtan2(float x, float y); float llSqrt(float f); float llPow(float fbase, float fexponent); - UInt32 llAbs(Int32 i); + Int32 llAbs(Int32 i); float llFabs(float f); float llFrand(float mag); - UInt32 llFloor(float f); - UInt32 llCeil(float f); - UInt32 llRound(float f); + Int32 llFloor(float f); + Int32 llCeil(float f); + Int32 llRound(float f); float llVecMag(Axiom.Math.Vector3 v); Axiom.Math.Vector3 llVecNorm(Axiom.Math.Vector3 v); float llVecDist(Axiom.Math.Vector3 a, Axiom.Math.Vector3 b); @@ -345,24 +345,41 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler //wiki: vector llGetCenterOfMass() Axiom.Math.Vector3 llGetCenterOfMass(); //wiki: list llListSort(list src, integer stride, integer ascending) - void llListSort(); - void llGetListLength(); - void llList2Integer(); - void llList2Float(); - void llList2String(); - void llList2Key(); - void llList2Vector(); - void llList2Rot(); - void llList2List(); - void llDeleteSubList(); - void llGetListEntryType(); - void llList2CSV(); - void llCSV2List(); - void llListRandomize(); - void llList2ListStrided(); - void llGetRegionCorner(); - void llListInsertList(); - void llListFindList(); + List llListSort(List src, Int32 stride, Int32 ascending); + //integer llGetListLength(list src) + Int32 llGetListLength(List src); + //wiki: integer llList2Integer(list src, integer index) + Int32 llList2Integer(List src, Int32 index); + //wiki: float llList2Float(list src, integer index) + float llList2Float(List src, Int32 index); + //wiki: string llList2String(list src, integer index) + string llList2String(List src, Int32 index); + //wiki: key llList2Key(list src, integer index) + string llList2Key(List src, Int32 index); + //wiki: vector llList2Vector(list src, integer index) + Axiom.Math.Vector3 llList2Vector(List src, Int32 index); + //wiki rotation llList2Rot(list src, integer index) + Axiom.Math.Quaternion llList2Rot(List src, Int32 index); + //wiki: list llList2List(list src, integer start, integer end) + List llList2List(List src, Int32 start, Int32 end); + //wiki: llDeleteSubList(list src, integer start, integer end) + List llDeleteSubList(List src, Int32 start, Int32 end); + //wiki: integer llGetListEntryType( list src, integer index ) + Int32 llGetListEntryType(List src, Int32 index); + //wiki: string llList2CSV( list src ) + string llList2CSV(List src); + //wiki: list llCSV2List( string src ) + List llCSV2List(string src); + //wiki: list llListRandomize( list src, integer stride ) + List llListRandomize(List src, Int32 stride); + //wiki: list llList2ListStrided( list src, integer start, integer end, integer stride ) + List llList2ListStrided(List src, Int32 start, Int32 end, Int32 stride); + //wiki: vector llGetRegionCorner( ) + Axiom.Math.Vector3 llGetRegionCorner(); + //wiki: list llListInsertList( list dest, list src, integer start ) + List llListInsertList(List dest, List src, Int32 start); + //wiki: integer llListFindList( list src, list test ) + Int32 llListFindList(List src, List test); //wiki: string llGetObjectName() string llGetObjectName(); //wiki: llSetObjectName(string name) @@ -450,7 +467,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler void llDumpList2String(); //wiki: integer llScriptDanger(vector pos) void llScriptDanger(Axiom.Math.Vector3 pos); - void llDialog(); + //wiki: llDialog( key avatar, string message, list buttons, integer chat_channel ) + void llDialog(string avatar, string message, List buttons, Int32 chat_channel); //wiki: llVolumeDetect(integer detect) void llVolumeDetect(Int32 detect); //wiki: llResetOtherScript(string name) @@ -473,7 +491,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler void llCloseRemoteDataChannel(string channel); //wiki: string llMD5String(string src, integer nonce) string llMD5String(string src, Int32 nonce); - void llSetPrimitiveParams(); + //wiki: llSetPrimitiveParams( list rules ) + void llSetPrimitiveParams(List rules); //wiki: string llStringToBase64(string str) string llStringToBase64(string str); //wiki: string llBase64ToString(string str) @@ -486,7 +505,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler float llLog10(float val); //wiki: float llLog(float val) float llLog(float val); - void llGetAnimationList(); + //wiki: list llGetAnimationList( key id ) + List llGetAnimationList(string id); //wiki: llSetParcelMusicURL(string url) void llSetParcelMusicURL(string url); //wiki: vector llGetRootPosition() @@ -507,7 +527,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler Int32 llGetNumberOfPrims(); //wiki: key llGetNumberOfNotecardLines(string name) string llGetNumberOfNotecardLines(string name); - void llGetBoundingBox(); + //wiki: list llGetBoundingBox( key object ) + List llGetBoundingBox(string obj); //wiki: vector llGetGeometricCenter() Axiom.Math.Vector3 llGetGeometricCenter(); void llGetPrimitiveParams(); @@ -521,7 +542,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler string llGetSimulatorHostname(); //llSetLocalRot(rotation rot) void llSetLocalRot(Axiom.Math.Quaternion rot); - void llParseStringKeepNulls(); + //wiki: list llParseStringKeepNulls( string src, list separators, list spacers ) + List llParseStringKeepNulls(string src, List seperators, List spacers); //wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param) void llRezAtRoot(string inventory, Axiom.Math.Vector3 position, Axiom.Math.Vector3 velocity, Axiom.Math.Quaternion rot, Int32 param); //wiki: integer llGetObjectPermMask(integer mask) @@ -545,13 +567,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler void llListReplaceList(); //wiki: llLoadURL(key avatar_id, string message, string url) void llLoadURL(string avatar_id, string message, string url); - void llParcelMediaCommandList(); + //wiki: llParcelMediaCommandList( list commandList ) + void llParcelMediaCommandList(List commandList); void llParcelMediaQuery(); //wiki integer llModPow(integer a, integer b, integer c) Int32 llModPow(Int32 a, Int32 b, Int32 c); //wiki: integer llGetInventoryType(string name) Int32 llGetInventoryType(string name); - void llSetPayPrice(); + //wiki: llSetPayPrice( integer price, list quick_pay_buttons ) + void llSetPayPrice(Int32 price, List quick_pay_buttons); //wiki: vector llGetCameraPos() Axiom.Math.Vector3 llGetCameraPos(); //wiki rotation llGetCameraRot() @@ -572,9 +596,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler void llRemoveFromLandPassList(string avatar); //wiki: llRemoveFromLandBanList(key avatar) void llRemoveFromLandBanList(string avatar); - void llSetCameraParams(); + //wiki: llSetCameraParams( list rules ) + void llSetCameraParams(List rules); + //wiki: llClearCameraParams() void llClearCameraParams(); - void llListStatistics(); + //wiki: float llListStatistics( integer operation, list src ) + float llListStatistics(Int32 operation, List src); //wiki: integer llGetUnixTime() Int32 llGetUnixTime(); //wiki: integer llGetParcelFlags(vector pos) @@ -590,7 +617,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler void llResetLandPassList(); //wiki integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide) Int32 llGetParcelPrimCount(Axiom.Math.Vector3 pos, Int32 category, Int32 sim_wide); - void llGetParcelPrimOwners(); + //wiki: list llGetParcelPrimOwners( vector pos ) + List llGetParcelPrimOwners(Axiom.Math.Vector3 pos); //wiki: integer llGetObjectPrimCount(key object_id) Int32 llGetObjectPrimCount(string object_id); //wiki: integer llGetParcelMaxPrims( vector pos, integer sim_wide ) -- cgit v1.1