From 8eb9952e5ff5c003a98168e7847f309e51f48645 Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Sat, 18 Aug 2007 02:15:21 +0000 Subject: [PATCH] lsl test cases, and llregioncorner (thanks Dalien!) --- .../Compiler/LSL/LSL_BaseClass.cs | 2 +- bin/ScriptEngines/Default.lsl | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 486332f09c..24170172fb 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -292,7 +292,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public List llList2ListStrided(List src, int start, int end, int stride) { return new List(); } public Axiom.Math.Vector3 llGetRegionCorner() - { return new Axiom.Math.Vector3(); } + { return new Axiom.Math.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); } public List llListInsertList(List dest, List src, int start) { return new List(); } public int llListFindList(List src, List test) { return 0; } diff --git a/bin/ScriptEngines/Default.lsl b/bin/ScriptEngines/Default.lsl index 6e362f88b5..51f6ca59e0 100644 --- a/bin/ScriptEngines/Default.lsl +++ b/bin/ScriptEngines/Default.lsl @@ -1,4 +1,12 @@ integer touch_count = 0; + +to_integer(float num) +{ + llSay(0, num + " floor: " + llFloor(num)); + llSay(0, num + " ceiling: " + llCeil(num)); + llSay(0, num + " round: " + llRound(num)); +} + default { state_entry() { @@ -7,6 +15,33 @@ default { touch_start(integer total_number) { + float angle45 = PI/4.0; // 45 degrees + float angle30 = PI/6.0; // 30 degrees + float sqrt2 = llSqrt(2.0); + float deltaCos = llCos(angle45) - sqrt2/2.0; + float deltaSin = llSin(angle30) - 0.5; + float deltaAtan = llAtan2(1, 1)*4 - PI; + float deltaTan = llTan(PI); + llSay(0, "deltaSin: " + deltaSin); + llShout(0, "deltaCos: " + deltaCos); + llWhisper(0, "deltaTan: " + deltaTan); + llWhisper(0, "deltaAtan: " + deltaAtan); + llSay(0, "Fabs(power(2^16)): " + llFabs(0-llPow(2, 16))); + llSay(0, "Abs(-1): " + llAbs(-1)); + llSay(0, "One random(100): " + llFrand(100)); + llSay(0, "Two random(100): " + llFrand(100)); + llSay(0, "Three random(100): " + llFrand(100)); + llSay(0, "Four random(100.0): " + llFrand(100.0)); + llWhisper(0, "The unix time is: " + llGetUnixTime()); + to_integer(2.4); + to_integer(2.5); + to_integer(2.6); + to_integer(3.51); + llSay(0, "Should be 112abd47ceaae1c05a826828650434a6: " + llMD5String("Hello, Avatar!", 0)); + llSay(0, "Should be 9: " +llModPow(2, 16, 37)); + llSay(0, "Region corner: " + (string)llGetRegionCorner()); + llSetText("This is a text", <1,0,0>, 1); + touch_count++; llSay(0, "Object was touched. Touch count: " + touch_count); }