aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs240
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs2062
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs524
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs16
6 files changed, 1424 insertions, 1424 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index f7aa634..ff5c6bf 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
@@ -612,7 +612,7 @@ namespace OpenSim.Region.ScriptEngine.Common
612 //wiki: integer llGetRegionFlags() 612 //wiki: integer llGetRegionFlags()
613 int llGetRegionFlags(); 613 int llGetRegionFlags();
614 //wiki: string llXorBase64StringsCorrect(string str1, string str2) 614 //wiki: string llXorBase64StringsCorrect(string str1, string str2)
615 string llXorBase64StringsCorrect(string str1, string str2); 615 string llXorBase64StringsCorrect(string str1, string str2);
616 void llHTTPRequest(string url, List<string> parameters, string body); 616 void llHTTPRequest(string url, List<string> parameters, string body);
617 //wiki: llResetLandBanList() 617 //wiki: llResetLandBanList()
618 void llResetLandBanList(); 618 void llResetLandBanList();
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 78cfd21..6603323 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -1,120 +1,120 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.IO; 4using System.IO;
5using Microsoft.CSharp; 5using Microsoft.CSharp;
6using System.CodeDom.Compiler; 6using System.CodeDom.Compiler;
7using System.Reflection; 7using System.Reflection;
8 8
9namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL 9namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
10{ 10{
11 11
12 public class Compiler 12 public class Compiler
13 { 13 {
14 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 14 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
15 private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); 15 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
16 private static UInt64 scriptCompileCounter = 0; 16 private static UInt64 scriptCompileCounter = 0;
17 //private ICodeCompiler icc = codeProvider.CreateCompiler(); 17 //private ICodeCompiler icc = codeProvider.CreateCompiler();
18 public string CompileFromFile(string LSOFileName) 18 public string CompileFromFile(string LSOFileName)
19 { 19 {
20 switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) 20 switch (System.IO.Path.GetExtension(LSOFileName).ToLower())
21 { 21 {
22 case ".txt": 22 case ".txt":
23 case ".lsl": 23 case ".lsl":
24 Common.SendToDebug("Source code is LSL, converting to CS"); 24 Common.SendToDebug("Source code is LSL, converting to CS");
25 return CompileFromLSLText(File.ReadAllText(LSOFileName)); 25 return CompileFromLSLText(File.ReadAllText(LSOFileName));
26 case ".cs": 26 case ".cs":
27 Common.SendToDebug("Source code is CS"); 27 Common.SendToDebug("Source code is CS");
28 return CompileFromCSText(File.ReadAllText(LSOFileName)); 28 return CompileFromCSText(File.ReadAllText(LSOFileName));
29 default: 29 default:
30 throw new Exception("Unknown script type."); 30 throw new Exception("Unknown script type.");
31 } 31 }
32 } 32 }
33 /// <summary> 33 /// <summary>
34 /// Converts script from LSL to CS and calls CompileFromCSText 34 /// Converts script from LSL to CS and calls CompileFromCSText
35 /// </summary> 35 /// </summary>
36 /// <param name="Script">LSL script</param> 36 /// <param name="Script">LSL script</param>
37 /// <returns>Filename to .dll assembly</returns> 37 /// <returns>Filename to .dll assembly</returns>
38 public string CompileFromLSLText(string Script) 38 public string CompileFromLSLText(string Script)
39 { 39 {
40 if (Script.Substring(0, 4).ToLower() == "//c#") 40 if (Script.Substring(0, 4).ToLower() == "//c#")
41 { 41 {
42 return CompileFromCSText( Script ); 42 return CompileFromCSText( Script );
43 } 43 }
44 else 44 else
45 { 45 {
46 return CompileFromCSText(LSL_Converter.Convert(Script)); 46 return CompileFromCSText(LSL_Converter.Convert(Script));
47 } 47 }
48 } 48 }
49 /// <summary> 49 /// <summary>
50 /// Compile CS script to .Net assembly (.dll) 50 /// Compile CS script to .Net assembly (.dll)
51 /// </summary> 51 /// </summary>
52 /// <param name="Script">CS script</param> 52 /// <param name="Script">CS script</param>
53 /// <returns>Filename to .dll assembly</returns> 53 /// <returns>Filename to .dll assembly</returns>
54 public string CompileFromCSText(string Script) 54 public string CompileFromCSText(string Script)
55 { 55 {
56 56
57 57
58 // Output assembly name 58 // Output assembly name
59 scriptCompileCounter++; 59 scriptCompileCounter++;
60 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); 60 string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
61 try 61 try
62 { 62 {
63 System.IO.File.Delete(OutFile); 63 System.IO.File.Delete(OutFile);
64 } 64 }
65 catch (Exception e) 65 catch (Exception e)
66 { 66 {
67 Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString()); 67 Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString());
68 } 68 }
69 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); 69 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
70 70
71 // DEBUG - write source to disk 71 // DEBUG - write source to disk
72 try 72 try
73 { 73 {
74 File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); 74 File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script);
75 } 75 }
76 catch { } 76 catch { }
77 77
78 // Do actual compile 78 // Do actual compile
79 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); 79 System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
80 parameters.IncludeDebugInformation = true; 80 parameters.IncludeDebugInformation = true;
81 // Add all available assemblies 81 // Add all available assemblies
82 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) 82 foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
83 { 83 {
84 //Console.WriteLine("Adding assembly: " + asm.Location); 84 //Console.WriteLine("Adding assembly: " + asm.Location);
85 //parameters.ReferencedAssemblies.Add(asm.Location); 85 //parameters.ReferencedAssemblies.Add(asm.Location);
86 } 86 }
87 87
88 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); 88 string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
89 string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); 89 string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location);
90 //Console.WriteLine("Assembly location: " + rootPath); 90 //Console.WriteLine("Assembly location: " + rootPath);
91 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); 91 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
92 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); 92 parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll"));
93 93
94 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); 94 //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
95 parameters.GenerateExecutable = false; 95 parameters.GenerateExecutable = false;
96 parameters.OutputAssembly = OutFile; 96 parameters.OutputAssembly = OutFile;
97 parameters.IncludeDebugInformation = false; 97 parameters.IncludeDebugInformation = false;
98 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script); 98 CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script);
99 99
100 // Go through errors 100 // Go through errors
101 // TODO: Return errors to user somehow 101 // TODO: Return errors to user somehow
102 if (results.Errors.Count > 0) 102 if (results.Errors.Count > 0)
103 { 103 {
104 104
105 string errtext = ""; 105 string errtext = "";
106 foreach (CompilerError CompErr in results.Errors) 106 foreach (CompilerError CompErr in results.Errors)
107 { 107 {
108 errtext += "Line number " + (CompErr.Line - 1) + 108 errtext += "Line number " + (CompErr.Line - 1) +
109 ", Error Number: " + CompErr.ErrorNumber + 109 ", Error Number: " + CompErr.ErrorNumber +
110 ", '" + CompErr.ErrorText + "'\r\n"; 110 ", '" + CompErr.ErrorText + "'\r\n";
111 } 111 }
112 throw new Exception(errtext); 112 throw new Exception(errtext);
113 } 113 }
114 114
115 115
116 return OutFile; 116 return OutFile;
117 } 117 }
118 118
119 } 119 }
120} 120}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index 1294213..18eddd0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
45 } 45 }
46 } 46 }
47 47
48 public LSL_BuiltIn_Commands_Interface m_LSL_Functions; 48 public LSL_BuiltIn_Commands_Interface m_LSL_Functions;
49 public string SourceCode = ""; 49 public string SourceCode = "";
50 50
51 public LSL_BaseClass() 51 public LSL_BaseClass()
@@ -453,7 +453,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
453 public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } 453 public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); }
454 public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } 454 public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); }
455 public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } 455 public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); }
456 public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } 456 public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); }
457 public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } 457 public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); }
458 public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } 458 public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); }
459 public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } 459 public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index eb72d5c..a2aa713 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -1,1031 +1,1031 @@
1using Axiom.Math; 1using Axiom.Math;
2using System; 2using System;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Region.Environment.Scenes; 6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Region.Environment.Scenes.Scripting; 7using OpenSim.Region.Environment.Scenes.Scripting;
8using OpenSim.Region.Environment.Interfaces; 8using OpenSim.Region.Environment.Interfaces;
9using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 9using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
10using OpenSim.Region.ScriptEngine.Common; 10using OpenSim.Region.ScriptEngine.Common;
11using OpenSim.Framework.Console; 11using OpenSim.Framework.Console;
12using OpenSim.Framework.Utilities; 12using OpenSim.Framework.Utilities;
13using System.Runtime.Remoting.Lifetime; 13using System.Runtime.Remoting.Lifetime;
14 14
15namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler 15namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
16{ 16{
17 // 17 //
18 // !!!IMPORTANT!!! 18 // !!!IMPORTANT!!!
19 // 19 //
20 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status 20 // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status
21 // 21 //
22 22
23 /// <summary> 23 /// <summary>
24 /// Contains all LSL ll-functions. This class will be in Default AppDomain. 24 /// Contains all LSL ll-functions. This class will be in Default AppDomain.
25 /// </summary> 25 /// </summary>
26 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface 26 public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
27 { 27 {
28 28
29 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 29 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
30 private ScriptEngine m_ScriptEngine; 30 private ScriptEngine m_ScriptEngine;
31 private SceneObjectPart m_host; 31 private SceneObjectPart m_host;
32 private uint m_localID; 32 private uint m_localID;
33 private LLUUID m_itemID; 33 private LLUUID m_itemID;
34 private bool throwErrorOnNotImplemented = true; 34 private bool throwErrorOnNotImplemented = true;
35 35
36 36
37 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) 37 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
38 { 38 {
39 m_ScriptEngine = ScriptEngine; 39 m_ScriptEngine = ScriptEngine;
40 m_host = host; 40 m_host = host;
41 m_localID = localID; 41 m_localID = localID;
42 m_itemID = itemID; 42 m_itemID = itemID;
43 43
44 44
45 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 45 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
46 } 46 }
47 47
48 48
49 private string m_state = "default"; 49 private string m_state = "default";
50 50
51 public string State() 51 public string State()
52 { 52 {
53 return m_state; 53 return m_state;
54 } 54 }
55 55
56 // Object never expires 56 // Object never expires
57 public override Object InitializeLifetimeService() 57 public override Object InitializeLifetimeService()
58 { 58 {
59 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); 59 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
60 // return null; 60 // return null;
61 ILease lease = (ILease)base.InitializeLifetimeService(); 61 ILease lease = (ILease)base.InitializeLifetimeService();
62 62
63 if (lease.CurrentState == LeaseState.Initial) 63 if (lease.CurrentState == LeaseState.Initial)
64 { 64 {
65 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); 65 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
66 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2); 66 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
67 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2); 67 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
68 } 68 }
69 return lease; 69 return lease;
70 } 70 }
71 71
72 72
73 public Scene World 73 public Scene World
74 { 74 {
75 get { return m_ScriptEngine.World; } 75 get { return m_ScriptEngine.World; }
76 } 76 }
77 77
78 //These are the implementations of the various ll-functions used by the LSL scripts. 78 //These are the implementations of the various ll-functions used by the LSL scripts.
79 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 79 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
80 public double llSin(double f) { return (double)Math.Sin(f); } 80 public double llSin(double f) { return (double)Math.Sin(f); }
81 public double llCos(double f) { return (double)Math.Cos(f); } 81 public double llCos(double f) { return (double)Math.Cos(f); }
82 public double llTan(double f) { return (double)Math.Tan(f); } 82 public double llTan(double f) { return (double)Math.Tan(f); }
83 public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); } 83 public double llAtan2(double x, double y) { return (double)Math.Atan2(y, x); }
84 public double llSqrt(double f) { return (double)Math.Sqrt(f); } 84 public double llSqrt(double f) { return (double)Math.Sqrt(f); }
85 public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); } 85 public double llPow(double fbase, double fexponent) { return (double)Math.Pow(fbase, fexponent); }
86 public int llAbs(int i) { return (int)Math.Abs(i); } 86 public int llAbs(int i) { return (int)Math.Abs(i); }
87 public double llFabs(double f) { return (double)Math.Abs(f); } 87 public double llFabs(double f) { return (double)Math.Abs(f); }
88 88
89 public double llFrand(double mag) 89 public double llFrand(double mag)
90 { 90 {
91 lock (Util.RandomClass) 91 lock (Util.RandomClass)
92 { 92 {
93 return Util.RandomClass.Next((int)mag); 93 return Util.RandomClass.Next((int)mag);
94 } 94 }
95 } 95 }
96 96
97 public int llFloor(double f) { return (int)Math.Floor(f); } 97 public int llFloor(double f) { return (int)Math.Floor(f); }
98 public int llCeil(double f) { return (int)Math.Ceiling(f); } 98 public int llCeil(double f) { return (int)Math.Ceiling(f); }
99 public int llRound(double f) { return (int)Math.Round(f, 3); } 99 public int llRound(double f) { return (int)Math.Round(f, 3); }
100 100
101 //This next group are vector operations involving squaring and square root. ckrinke 101 //This next group are vector operations involving squaring and square root. ckrinke
102 public double llVecMag(LSL_Types.Vector3 v) 102 public double llVecMag(LSL_Types.Vector3 v)
103 { 103 {
104 return (v.X * v.X + v.Y * v.Y + v.Z * v.Z); 104 return (v.X * v.X + v.Y * v.Y + v.Z * v.Z);
105 } 105 }
106 106
107 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 107 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
108 { 108 {
109 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; 109 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z;
110 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 110 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
111 nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag; 111 nor.X = v.X / mag; nor.Y = v.Y / mag; nor.Z = v.Z / mag;
112 return nor; 112 return nor;
113 } 113 }
114 114
115 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b) 115 public double llVecDist(LSL_Types.Vector3 a, LSL_Types.Vector3 b)
116 { 116 {
117 double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z; 117 double dx = a.X - b.X; double dy = a.Y - b.Y; double dz = a.Z - b.Z;
118 return Math.Sqrt(dx * dx + dy * dy + dz * dz); 118 return Math.Sqrt(dx * dx + dy * dy + dz * dz);
119 } 119 }
120 120
121 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke 121 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
122 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 122 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
123 { 123 {
124 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke 124 //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
125 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R); 125 LSL_Types.Quaternion t = new LSL_Types.Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.R * r.R);
126 double m = (t.X + t.Y + t.Z + t.R); 126 double m = (t.X + t.Y + t.Z + t.R);
127 if (m == 0) return new LSL_Types.Vector3(); 127 if (m == 0) return new LSL_Types.Vector3();
128 double n = 2 * (r.Y * r.R + r.X * r.Z); 128 double n = 2 * (r.Y * r.R + r.X * r.Z);
129 double p = m * m - n * n; 129 double p = m * m - n * n;
130 if (p > 0) 130 if (p > 0)
131 return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)), 131 return new LSL_Types.Vector3(Math.Atan2(2.0 * (r.X * r.R - r.Y * r.Z), (-t.X - t.Y + t.Z + t.R)),
132 Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R))); 132 Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (r.Z * r.R - r.X * r.Y), (t.X - t.Y - t.Z + t.R)));
133 else if (n > 0) 133 else if (n > 0)
134 return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 134 return new LSL_Types.Vector3(0.0, Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z));
135 else 135 else
136 return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z)); 136 return new LSL_Types.Vector3(0.0, -Math.PI / 2, Math.Atan2((r.Z * r.R + r.X * r.Y), 0.5 - t.X - t.Z));
137 } 137 }
138 138
139 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) 139 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
140 { 140 {
141 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 141 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
142 float err = 0.00001f; 142 float err = 0.00001f;
143 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); 143 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2);
144 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); 144 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2);
145 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); 145 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2);
146 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw); 146 LSL_Types.Quaternion a1 = new LSL_Types.Quaternion(0.0, 0.0, cz, cw);
147 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw); 147 LSL_Types.Quaternion a2 = new LSL_Types.Quaternion(0.0, by, 0.0, bw);
148 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw); 148 LSL_Types.Quaternion a3 = new LSL_Types.Quaternion(ax, 0.0, 0.0, aw);
149 LSL_Types.Quaternion a = new LSL_Types.Quaternion(); 149 LSL_Types.Quaternion a = new LSL_Types.Quaternion();
150 //This multiplication doesnt compile, yet. a = a1 * a2 * a3; 150 //This multiplication doesnt compile, yet. a = a1 * a2 * a3;
151 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz, 151 LSL_Types.Quaternion b = new LSL_Types.Quaternion(ax * bw * cw + aw * by * cz,
152 aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz); 152 aw * by * cw - ax * bw * cz, aw * bw * cz + ax * by * cw, aw * bw * cw - ax * by * cz);
153 LSL_Types.Quaternion c = new LSL_Types.Quaternion(); 153 LSL_Types.Quaternion c = new LSL_Types.Quaternion();
154 //This addition doesnt compile yet c = a + b; 154 //This addition doesnt compile yet c = a + b;
155 LSL_Types.Quaternion d = new LSL_Types.Quaternion(); 155 LSL_Types.Quaternion d = new LSL_Types.Quaternion();
156 //This addition doesnt compile yet d = a - b; 156 //This addition doesnt compile yet d = a - b;
157 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) || 157 if ((Math.Abs(c.X) > err && Math.Abs(d.X) > err) ||
158 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) || 158 (Math.Abs(c.Y) > err && Math.Abs(d.Y) > err) ||
159 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) || 159 (Math.Abs(c.Z) > err && Math.Abs(d.Z) > err) ||
160 (Math.Abs(c.R) > err && Math.Abs(d.R) > err)) 160 (Math.Abs(c.R) > err && Math.Abs(d.R) > err))
161 { 161 {
162 //return a new Quaternion that is null until I figure this out 162 //return a new Quaternion that is null until I figure this out
163 // return b; 163 // return b;
164 // return a; 164 // return a;
165 } 165 }
166 return new LSL_Types.Quaternion(); 166 return new LSL_Types.Quaternion();
167 } 167 }
168 168
169 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); } 169 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) { return new LSL_Types.Quaternion(); }
170 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 170 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); }
171 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 171 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); }
172 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); } 172 public LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r) { return new LSL_Types.Vector3(); }
173 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); } 173 public LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end) { return new LSL_Types.Quaternion(); }
174 174
175 public void llWhisper(int channelID, string text) 175 public void llWhisper(int channelID, string text)
176 { 176 {
177 //type for whisper is 0 177 //type for whisper is 0
178 World.SimChat(Helpers.StringToField(text), 178 World.SimChat(Helpers.StringToField(text),
179 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 179 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
180 } 180 }
181 181
182 public void llSay(int channelID, string text) 182 public void llSay(int channelID, string text)
183 { 183 {
184 //type for say is 1 184 //type for say is 1
185 185
186 World.SimChat(Helpers.StringToField(text), 186 World.SimChat(Helpers.StringToField(text),
187 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 187 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
188 } 188 }
189 189
190 public void llShout(int channelID, string text) 190 public void llShout(int channelID, string text)
191 { 191 {
192 //type for shout is 2 192 //type for shout is 2
193 World.SimChat(Helpers.StringToField(text), 193 World.SimChat(Helpers.StringToField(text),
194 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 194 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
195 } 195 }
196 196
197 public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; } 197 public int llListen(int channelID, string name, string ID, string msg) { NotImplemented("llListen"); return 0; }
198 public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; } 198 public void llListenControl(int number, int active) { NotImplemented("llListenControl"); return; }
199 public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; } 199 public void llListenRemove(int number) { NotImplemented("llListenRemove"); return; }
200 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; } 200 public void llSensor(string name, string id, int type, double range, double arc) { NotImplemented("llSensor"); return; }
201 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; } 201 public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) { NotImplemented("llSensorRepeat"); return; }
202 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; } 202 public void llSensorRemove() { NotImplemented("llSensorRemove"); return; }
203 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; } 203 public string llDetectedName(int number) { NotImplemented("llDetectedName"); return ""; }
204 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; } 204 public string llDetectedKey(int number) { NotImplemented("llDetectedKey"); return ""; }
205 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; } 205 public string llDetectedOwner(int number) { NotImplemented("llDetectedOwner"); return ""; }
206 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; } 206 public int llDetectedType(int number) { NotImplemented("llDetectedType"); return 0; }
207 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); } 207 public LSL_Types.Vector3 llDetectedPos(int number) { NotImplemented("llDetectedPos"); return new LSL_Types.Vector3(); }
208 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); } 208 public LSL_Types.Vector3 llDetectedVel(int number) { NotImplemented("llDetectedVel"); return new LSL_Types.Vector3(); }
209 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); } 209 public LSL_Types.Vector3 llDetectedGrab(int number) { NotImplemented("llDetectedGrab"); return new LSL_Types.Vector3(); }
210 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); } 210 public LSL_Types.Quaternion llDetectedRot(int number) { NotImplemented("llDetectedRot"); return new LSL_Types.Quaternion(); }
211 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; } 211 public int llDetectedGroup(int number) { NotImplemented("llDetectedGroup"); return 0; }
212 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; } 212 public int llDetectedLinkNumber(int number) { NotImplemented("llDetectedLinkNumber"); return 0; }
213 public void llDie() { NotImplemented("llDie"); return; } 213 public void llDie() { NotImplemented("llDie"); return; }
214 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; } 214 public double llGround(LSL_Types.Vector3 offset) { NotImplemented("llGround"); return 0; }
215 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; } 215 public double llCloud(LSL_Types.Vector3 offset) { NotImplemented("llCloud"); return 0; }
216 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); } 216 public LSL_Types.Vector3 llWind(LSL_Types.Vector3 offset) { NotImplemented("llWind"); return new LSL_Types.Vector3(); }
217 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; } 217 public void llSetStatus(int status, int value) { NotImplemented("llSetStatus"); return; }
218 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; } 218 public int llGetStatus(int status) { NotImplemented("llGetStatus"); return 0; }
219 219
220 public void llSetScale(LSL_Types.Vector3 scale) 220 public void llSetScale(LSL_Types.Vector3 scale)
221 { 221 {
222 // TODO: this needs to trigger a persistance save as well 222 // TODO: this needs to trigger a persistance save as well
223 LLVector3 tmp = m_host.Scale; 223 LLVector3 tmp = m_host.Scale;
224 tmp.X = (float)scale.X; 224 tmp.X = (float)scale.X;
225 tmp.Y = (float)scale.Y; 225 tmp.Y = (float)scale.Y;
226 tmp.Z = (float)scale.Z; 226 tmp.Z = (float)scale.Z;
227 m_host.Scale = tmp; 227 m_host.Scale = tmp;
228 return; 228 return;
229 } 229 }
230 public LSL_Types.Vector3 llGetScale() 230 public LSL_Types.Vector3 llGetScale()
231 { 231 {
232 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z); 232 return new LSL_Types.Vector3(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
233 } 233 }
234 234
235 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; } 235 public void llSetColor(LSL_Types.Vector3 color, int face) { NotImplemented("llSetColor"); return; }
236 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; } 236 public double llGetAlpha(int face) { NotImplemented("llGetAlpha"); return 0; }
237 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; } 237 public void llSetAlpha(double alpha, int face) { NotImplemented("llSetAlpha"); return; }
238 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); } 238 public LSL_Types.Vector3 llGetColor(int face) { NotImplemented("llGetColor"); return new LSL_Types.Vector3(); }
239 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; } 239 public void llSetTexture(string texture, int face) { NotImplemented("llSetTexture"); return; }
240 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; } 240 public void llScaleTexture(double u, double v, int face) { NotImplemented("llScaleTexture"); return; }
241 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; } 241 public void llOffsetTexture(double u, double v, int face) { NotImplemented("llOffsetTexture"); return; }
242 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; } 242 public void llRotateTexture(double rotation, int face) { NotImplemented("llRotateTexture"); return; }
243 243
244 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; } 244 public string llGetTexture(int face) { NotImplemented("llGetTexture"); return ""; }
245 245
246 public void llSetPos(LSL_Types.Vector3 pos) 246 public void llSetPos(LSL_Types.Vector3 pos)
247 { 247 {
248 if (m_host.ParentID != 0) 248 if (m_host.ParentID != 0)
249 { 249 {
250 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 250 m_host.UpdateOffSet(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z));
251 } 251 }
252 else 252 else
253 { 253 {
254 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z)); 254 m_host.UpdateGroupPosition(new LLVector3((float)pos.X, (float)pos.Y, (float)pos.Z));
255 } 255 }
256 } 256 }
257 257
258 public LSL_Types.Vector3 llGetPos() 258 public LSL_Types.Vector3 llGetPos()
259 { 259 {
260 return new LSL_Types.Vector3(m_host.AbsolutePosition.X, 260 return new LSL_Types.Vector3(m_host.AbsolutePosition.X,
261 m_host.AbsolutePosition.Y, 261 m_host.AbsolutePosition.Y,
262 m_host.AbsolutePosition.Z); 262 m_host.AbsolutePosition.Z);
263 } 263 }
264 264
265 public LSL_Types.Vector3 llGetLocalPos() 265 public LSL_Types.Vector3 llGetLocalPos()
266 { 266 {
267 if (m_host.ParentID != 0) 267 if (m_host.ParentID != 0)
268 { 268 {
269 return new LSL_Types.Vector3(m_host.OffsetPosition.X, 269 return new LSL_Types.Vector3(m_host.OffsetPosition.X,
270 m_host.OffsetPosition.Y, 270 m_host.OffsetPosition.Y,
271 m_host.OffsetPosition.Z); 271 m_host.OffsetPosition.Z);
272 } 272 }
273 else 273 else
274 { 274 {
275 return new LSL_Types.Vector3(m_host.AbsolutePosition.X, 275 return new LSL_Types.Vector3(m_host.AbsolutePosition.X,
276 m_host.AbsolutePosition.Y, 276 m_host.AbsolutePosition.Y,
277 m_host.AbsolutePosition.Z); 277 m_host.AbsolutePosition.Z);
278 } 278 }
279 } 279 }
280 public void llSetRot(LSL_Types.Quaternion rot) 280 public void llSetRot(LSL_Types.Quaternion rot)
281 { 281 {
282 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R)); 282 m_host.UpdateRotation(new LLQuaternion((float)rot.X, (float)rot.Y, (float)rot.Z, (float)rot.R));
283 } 283 }
284 public LSL_Types.Quaternion llGetRot() 284 public LSL_Types.Quaternion llGetRot()
285 { 285 {
286 LLQuaternion q = m_host.RotationOffset; 286 LLQuaternion q = m_host.RotationOffset;
287 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 287 return new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
288 } 288 }
289 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); } 289 public LSL_Types.Quaternion llGetLocalRot() { NotImplemented("llGetLocalRot"); return new LSL_Types.Quaternion(); }
290 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); } 290 public void llSetForce(LSL_Types.Vector3 force, int local) { NotImplemented("llSetForce"); }
291 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); } 291 public LSL_Types.Vector3 llGetForce() { NotImplemented("llGetForce"); return new LSL_Types.Vector3(); }
292 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; } 292 public int llTarget(LSL_Types.Vector3 position, double range) { NotImplemented("llTarget"); return 0; }
293 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); } 293 public void llTargetRemove(int number) { NotImplemented("llTargetRemove"); }
294 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; } 294 public int llRotTarget(LSL_Types.Quaternion rot, double error) { NotImplemented("llRotTarget"); return 0; }
295 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); } 295 public void llRotTargetRemove(int number) { NotImplemented("llRotTargetRemove"); }
296 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); } 296 public void llMoveToTarget(LSL_Types.Vector3 target, double tau) { NotImplemented("llMoveToTarget"); }
297 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); } 297 public void llStopMoveToTarget() { NotImplemented("llStopMoveToTarget"); }
298 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); } 298 public void llApplyImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyImpulse"); }
299 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); } 299 public void llApplyRotationalImpulse(LSL_Types.Vector3 force, int local) { NotImplemented("llApplyRotationalImpulse"); }
300 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); } 300 public void llSetTorque(LSL_Types.Vector3 torque, int local) { NotImplemented("llSetTorque"); }
301 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); } 301 public LSL_Types.Vector3 llGetTorque() { NotImplemented("llGetTorque"); return new LSL_Types.Vector3(); }
302 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); } 302 public void llSetForceAndTorque(LSL_Types.Vector3 force, LSL_Types.Vector3 torque, int local) { NotImplemented("llSetForceAndTorque"); }
303 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); } 303 public LSL_Types.Vector3 llGetVel() { NotImplemented("llGetVel"); return new LSL_Types.Vector3(); }
304 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); } 304 public LSL_Types.Vector3 llGetAccel() { NotImplemented("llGetAccel"); return new LSL_Types.Vector3(); }
305 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); } 305 public LSL_Types.Vector3 llGetOmega() { NotImplemented("llGetOmega"); return new LSL_Types.Vector3(); }
306 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; } 306 public double llGetTimeOfDay() { NotImplemented("llGetTimeOfDay"); return 0; }
307 307
308 public double llGetWallclock() 308 public double llGetWallclock()
309 { 309 {
310 return DateTime.Now.TimeOfDay.TotalSeconds; 310 return DateTime.Now.TimeOfDay.TotalSeconds;
311 } 311 }
312 312
313 public double llGetTime() { NotImplemented("llGetTime"); return 0; } 313 public double llGetTime() { NotImplemented("llGetTime"); return 0; }
314 public void llResetTime() { NotImplemented("llResetTime"); } 314 public void llResetTime() { NotImplemented("llResetTime"); }
315 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; } 315 public double llGetAndResetTime() { NotImplemented("llGetAndResetTime"); return 0; }
316 public void llSound() { NotImplemented("llSound"); } 316 public void llSound() { NotImplemented("llSound"); }
317 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); } 317 public void llPlaySound(string sound, double volume) { NotImplemented("llPlaySound"); }
318 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); } 318 public void llLoopSound(string sound, double volume) { NotImplemented("llLoopSound"); }
319 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); } 319 public void llLoopSoundMaster(string sound, double volume) { NotImplemented("llLoopSoundMaster"); }
320 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); } 320 public void llLoopSoundSlave(string sound, double volume) { NotImplemented("llLoopSoundSlave"); }
321 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); } 321 public void llPlaySoundSlave(string sound, double volume) { NotImplemented("llPlaySoundSlave"); }
322 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); } 322 public void llTriggerSound(string sound, double volume) { NotImplemented("llTriggerSound"); }
323 public void llStopSound() { NotImplemented("llStopSound"); } 323 public void llStopSound() { NotImplemented("llStopSound"); }
324 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); } 324 public void llPreloadSound(string sound) { NotImplemented("llPreloadSound"); }
325 325
326 public string llGetSubString(string src, int start, int end) 326 public string llGetSubString(string src, int start, int end)
327 { 327 {
328 return src.Substring(start, end); 328 return src.Substring(start, end);
329 } 329 }
330 330
331 public string llDeleteSubString(string src, int start, int end) 331 public string llDeleteSubString(string src, int start, int end)
332 { 332 {
333 return src.Remove(start, end - start); 333 return src.Remove(start, end - start);
334 } 334 }
335 public string llInsertString(string dst, int position, string src) 335 public string llInsertString(string dst, int position, string src)
336 { 336 {
337 return dst.Insert(position, src); 337 return dst.Insert(position, src);
338 } 338 }
339 public string llToUpper(string src) 339 public string llToUpper(string src)
340 { 340 {
341 return src.ToUpper(); 341 return src.ToUpper();
342 } 342 }
343 343
344 public string llToLower(string src) 344 public string llToLower(string src)
345 { 345 {
346 return src.ToLower(); 346 return src.ToLower();
347 } 347 }
348 348
349 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; } 349 public int llGiveMoney(string destination, int amount) { NotImplemented("llGiveMoney"); return 0; }
350 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); } 350 public void llMakeExplosion() { NotImplemented("llMakeExplosion"); }
351 public void llMakeFountain() { NotImplemented("llMakeFountain"); } 351 public void llMakeFountain() { NotImplemented("llMakeFountain"); }
352 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); } 352 public void llMakeSmoke() { NotImplemented("llMakeSmoke"); }
353 public void llMakeFire() { NotImplemented("llMakeFire"); } 353 public void llMakeFire() { NotImplemented("llMakeFire"); }
354 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); } 354 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezObject"); }
355 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); } 355 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { NotImplemented("llLookAt"); }
356 public void llStopLookAt() { NotImplemented("llStopLookAt"); } 356 public void llStopLookAt() { NotImplemented("llStopLookAt"); }
357 357
358 public void llSetTimerEvent(double sec) 358 public void llSetTimerEvent(double sec)
359 { 359 {
360 // Setting timer repeat 360 // Setting timer repeat
361 m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); 361 m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
362 } 362 }
363 363
364 public void llSleep(double sec) 364 public void llSleep(double sec)
365 { 365 {
366 System.Threading.Thread.Sleep((int)(sec * 1000)); 366 System.Threading.Thread.Sleep((int)(sec * 1000));
367 } 367 }
368 368
369 public double llGetMass() { NotImplemented("llGetMass"); return 0; } 369 public double llGetMass() { NotImplemented("llGetMass"); return 0; }
370 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); } 370 public void llCollisionFilter(string name, string id, int accept) { NotImplemented("llCollisionFilter"); }
371 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); } 371 public void llTakeControls(int controls, int accept, int pass_on) { NotImplemented("llTakeControls"); }
372 public void llReleaseControls() { NotImplemented("llReleaseControls"); } 372 public void llReleaseControls() { NotImplemented("llReleaseControls"); }
373 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); } 373 public void llAttachToAvatar(int attachment) { NotImplemented("llAttachToAvatar"); }
374 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); } 374 public void llDetachFromAvatar() { NotImplemented("llDetachFromAvatar"); }
375 public void llTakeCamera() { NotImplemented("llTakeCamera"); } 375 public void llTakeCamera() { NotImplemented("llTakeCamera"); }
376 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); } 376 public void llReleaseCamera() { NotImplemented("llReleaseCamera"); }
377 377
378 public string llGetOwner() 378 public string llGetOwner()
379 { 379 {
380 return m_host.ObjectOwner.ToStringHyphenated(); 380 return m_host.ObjectOwner.ToStringHyphenated();
381 } 381 }
382 382
383 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); } 383 public void llInstantMessage(string user, string message) { NotImplemented("llInstantMessage"); }
384 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); } 384 public void llEmail(string address, string subject, string message) { NotImplemented("llEmail"); }
385 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); } 385 public void llGetNextEmail(string address, string subject) { NotImplemented("llGetNextEmail"); }
386 386
387 public string llGetKey() 387 public string llGetKey()
388 { 388 {
389 return m_host.UUID.ToStringHyphenated(); 389 return m_host.UUID.ToStringHyphenated();
390 } 390 }
391 391
392 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); } 392 public void llSetBuoyancy(double buoyancy) { NotImplemented("llSetBuoyancy"); }
393 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); } 393 public void llSetHoverHeight(double height, int water, double tau) { NotImplemented("llSetHoverHeight"); }
394 public void llStopHover() { NotImplemented("llStopHover"); } 394 public void llStopHover() { NotImplemented("llStopHover"); }
395 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); } 395 public void llMinEventDelay(double delay) { NotImplemented("llMinEventDelay"); }
396 public void llSoundPreload() { NotImplemented("llSoundPreload"); } 396 public void llSoundPreload() { NotImplemented("llSoundPreload"); }
397 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); } 397 public void llRotLookAt(LSL_Types.Quaternion target, double strength, double damping) { NotImplemented("llRotLookAt"); }
398 398
399 public int llStringLength(string str) 399 public int llStringLength(string str)
400 { 400 {
401 if (str.Length > 0) 401 if (str.Length > 0)
402 { 402 {
403 return str.Length; 403 return str.Length;
404 } 404 }
405 else 405 else
406 { 406 {
407 return 0; 407 return 0;
408 } 408 }
409 } 409 }
410 410
411 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); } 411 public void llStartAnimation(string anim) { NotImplemented("llStartAnimation"); }
412 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); } 412 public void llStopAnimation(string anim) { NotImplemented("llStopAnimation"); }
413 public void llPointAt() { NotImplemented("llPointAt"); } 413 public void llPointAt() { NotImplemented("llPointAt"); }
414 public void llStopPointAt() { NotImplemented("llStopPointAt"); } 414 public void llStopPointAt() { NotImplemented("llStopPointAt"); }
415 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); } 415 public void llTargetOmega(LSL_Types.Vector3 axis, double spinrate, double gain) { NotImplemented("llTargetOmega"); }
416 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; } 416 public int llGetStartParameter() { NotImplemented("llGetStartParameter"); return 0; }
417 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); } 417 public void llGodLikeRezObject(string inventory, LSL_Types.Vector3 pos) { NotImplemented("llGodLikeRezObject"); }
418 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); } 418 public void llRequestPermissions(string agent, int perm) { NotImplemented("llRequestPermissions"); }
419 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; } 419 public string llGetPermissionsKey() { NotImplemented("llGetPermissionsKey"); return ""; }
420 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; } 420 public int llGetPermissions() { NotImplemented("llGetPermissions"); return 0; }
421 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; } 421 public int llGetLinkNumber() { NotImplemented("llGetLinkNumber"); return 0; }
422 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); } 422 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) { NotImplemented("llSetLinkColor"); }
423 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); } 423 public void llCreateLink(string target, int parent) { NotImplemented("llCreateLink"); }
424 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); } 424 public void llBreakLink(int linknum) { NotImplemented("llBreakLink"); }
425 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); } 425 public void llBreakAllLinks() { NotImplemented("llBreakAllLinks"); }
426 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; } 426 public string llGetLinkKey(int linknum) { NotImplemented("llGetLinkKey"); return ""; }
427 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); } 427 public void llGetLinkName(int linknum) { NotImplemented("llGetLinkName"); }
428 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; } 428 public int llGetInventoryNumber(int type) { NotImplemented("llGetInventoryNumber"); return 0; }
429 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; } 429 public string llGetInventoryName(int type, int number) { NotImplemented("llGetInventoryName"); return ""; }
430 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); } 430 public void llSetScriptState(string name, int run) { NotImplemented("llSetScriptState"); }
431 public double llGetEnergy() { return 1.0f; } 431 public double llGetEnergy() { return 1.0f; }
432 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); } 432 public void llGiveInventory(string destination, string inventory) { NotImplemented("llGiveInventory"); }
433 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); } 433 public void llRemoveInventory(string item) { NotImplemented("llRemoveInventory"); }
434 434
435 public void llSetText(string text, LSL_Types.Vector3 color, double alpha) 435 public void llSetText(string text, LSL_Types.Vector3 color, double alpha)
436 { 436 {
437 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z); 437 Axiom.Math.Vector3 av3 = new Axiom.Math.Vector3((float)color.X, (float)color.Y, (float)color.Z);
438 m_host.SetText(text, av3, alpha); 438 m_host.SetText(text, av3, alpha);
439 } 439 }
440 440
441 441
442 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; } 442 public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); return 0; }
443 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); } 443 public void llPassTouches(int pass) { NotImplemented("llPassTouches"); }
444 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; } 444 public string llRequestAgentData(string id, int data) { NotImplemented("llRequestAgentData"); return ""; }
445 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; } 445 public string llRequestInventoryData(string name) { NotImplemented("llRequestInventoryData"); return ""; }
446 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); } 446 public void llSetDamage(double damage) { NotImplemented("llSetDamage"); }
447 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); } 447 public void llTeleportAgentHome(string agent) { NotImplemented("llTeleportAgentHome"); }
448 public void llModifyLand(int action, int brush) { } 448 public void llModifyLand(int action, int brush) { }
449 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); } 449 public void llCollisionSound(string impact_sound, double impact_volume) { NotImplemented("llCollisionSound"); }
450 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); } 450 public void llCollisionSprite(string impact_sprite) { NotImplemented("llCollisionSprite"); }
451 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; } 451 public string llGetAnimation(string id) { NotImplemented("llGetAnimation"); return ""; }
452 public void llResetScript() 452 public void llResetScript()
453 { 453 {
454 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); 454 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
455 } 455 }
456 public void llMessageLinked(int linknum, int num, string str, string id) { } 456 public void llMessageLinked(int linknum, int num, string str, string id) { }
457 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { } 457 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) { }
458 public void llPassCollisions(int pass) { } 458 public void llPassCollisions(int pass) { }
459 public string llGetScriptName() { return ""; } 459 public string llGetScriptName() { return ""; }
460 460
461 public int llGetNumberOfSides() { return 0; } 461 public int llGetNumberOfSides() { return 0; }
462 462
463 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); } 463 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) { return new LSL_Types.Quaternion(); }
464 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); } 464 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) { return new LSL_Types.Vector3(); }
465 public void llRot2Angle() { } 465 public void llRot2Angle() { }
466 466
467 public double llAcos(double val) 467 public double llAcos(double val)
468 { 468 {
469 return (double)Math.Acos(val); 469 return (double)Math.Acos(val);
470 } 470 }
471 471
472 public double llAsin(double val) 472 public double llAsin(double val)
473 { 473 {
474 return (double)Math.Asin(val); 474 return (double)Math.Asin(val);
475 } 475 }
476 476
477 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; } 477 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { return 0; }
478 public string llGetInventoryKey(string name) { return ""; } 478 public string llGetInventoryKey(string name) { return ""; }
479 public void llAllowInventoryDrop(int add) { } 479 public void llAllowInventoryDrop(int add) { }
480 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); } 480 public LSL_Types.Vector3 llGetSunDirection() { return new LSL_Types.Vector3(); }
481 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } 481 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); }
482 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } 482 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); }
483 public double llGetTextureRot(int side) { return 0; } 483 public double llGetTextureRot(int side) { return 0; }
484 484
485 public int llSubStringIndex(string source, string pattern) 485 public int llSubStringIndex(string source, string pattern)
486 { 486 {
487 return source.IndexOf(pattern); 487 return source.IndexOf(pattern);
488 } 488 }
489 489
490 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; } 490 public string llGetOwnerKey(string id) { NotImplemented("llGetOwnerKey"); return ""; }
491 491
492 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } 492 public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); }
493 493
494 public List<string> llListSort(List<string> src, int stride, int ascending) 494 public List<string> llListSort(List<string> src, int stride, int ascending)
495 { 495 {
496 SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); 496 SortedList<string, List<string>> sorted = new SortedList<string, List<string>>();
497 // Add chunks to an array 497 // Add chunks to an array
498 int s = stride; 498 int s = stride;
499 if (s < 1) 499 if (s < 1)
500 s = 1; 500 s = 1;
501 int c = 0; 501 int c = 0;
502 List<string> chunk = new List<string>(); 502 List<string> chunk = new List<string>();
503 string chunkString = ""; 503 string chunkString = "";
504 foreach (string element in src) 504 foreach (string element in src)
505 { 505 {
506 c++; 506 c++;
507 if (c > s) 507 if (c > s)
508 { 508 {
509 sorted.Add(chunkString, chunk); 509 sorted.Add(chunkString, chunk);
510 chunkString = ""; 510 chunkString = "";
511 chunk = new List<string>(); 511 chunk = new List<string>();
512 c = 0; 512 c = 0;
513 } 513 }
514 chunk.Add(element); 514 chunk.Add(element);
515 chunkString += element.ToString(); 515 chunkString += element.ToString();
516 } 516 }
517 if (chunk.Count > 0) 517 if (chunk.Count > 0)
518 sorted.Add(chunkString, chunk); 518 sorted.Add(chunkString, chunk);
519 519
520 List<string> ret = new List<string>(); 520 List<string> ret = new List<string>();
521 foreach (List<string> ls in sorted.Values) 521 foreach (List<string> ls in sorted.Values)
522 { 522 {
523 ret.AddRange(ls); 523 ret.AddRange(ls);
524 } 524 }
525 525
526 if (ascending == LSL.LSL_BaseClass.TRUE) 526 if (ascending == LSL.LSL_BaseClass.TRUE)
527 return ret; 527 return ret;
528 ret.Reverse(); 528 ret.Reverse();
529 return ret; 529 return ret;
530 } 530 }
531 531
532 public int llGetListLength(List<string> src) 532 public int llGetListLength(List<string> src)
533 { 533 {
534 return src.Count; 534 return src.Count;
535 } 535 }
536 536
537 public int llList2Integer(List<string> src, int index) 537 public int llList2Integer(List<string> src, int index)
538 { 538 {
539 return Convert.ToInt32(src[index]); 539 return Convert.ToInt32(src[index]);
540 } 540 }
541 541
542 public double llList2double(List<string> src, int index) 542 public double llList2double(List<string> src, int index)
543 { 543 {
544 return Convert.ToDouble(src[index]); 544 return Convert.ToDouble(src[index]);
545 } 545 }
546 546
547 public float llList2Float(List<string> src, int index) 547 public float llList2Float(List<string> src, int index)
548 { 548 {
549 return Convert.ToSingle(src[index]); 549 return Convert.ToSingle(src[index]);
550 } 550 }
551 551
552 public string llList2String(List<string> src, int index) 552 public string llList2String(List<string> src, int index)
553 { 553 {
554 return src[index]; 554 return src[index];
555 } 555 }
556 556
557 public string llList2Key(List<string> src, int index) 557 public string llList2Key(List<string> src, int index)
558 { 558 {
559 //return OpenSim.Framework.Types.ToStringHyphenated(src[index]); 559 //return OpenSim.Framework.Types.ToStringHyphenated(src[index]);
560 return src[index].ToString(); 560 return src[index].ToString();
561 } 561 }
562 562
563 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 563 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
564 { 564 {
565 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2])); 565 return new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]));
566 } 566 }
567 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 567 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
568 { 568 {
569 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3])); 569 return new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]), double.Parse(src[index + 2]), double.Parse(src[index + 3]));
570 } 570 }
571 public List<string> llList2List(List<string> src, int start, int end) 571 public List<string> llList2List(List<string> src, int start, int end)
572 { 572 {
573 if (end > start) 573 if (end > start)
574 { 574 {
575 // Simple straight forward chunk 575 // Simple straight forward chunk
576 return src.GetRange(start, end - start); 576 return src.GetRange(start, end - start);
577 } 577 }
578 else 578 else
579 { 579 {
580 // Some of the end + some of the beginning 580 // Some of the end + some of the beginning
581 // First chunk 581 // First chunk
582 List<string> ret = new List<string>(); 582 List<string> ret = new List<string>();
583 ret.AddRange(src.GetRange(start, src.Count - start)); 583 ret.AddRange(src.GetRange(start, src.Count - start));
584 ret.AddRange(src.GetRange(0, end)); 584 ret.AddRange(src.GetRange(0, end));
585 return ret; 585 return ret;
586 } 586 }
587 587
588 588
589 589
590 590
591 } 591 }
592 public List<string> llDeleteSubList(List<string> src, int start, int end) 592 public List<string> llDeleteSubList(List<string> src, int start, int end)
593 { 593 {
594 List<string> ret = new List<string>(src); 594 List<string> ret = new List<string>(src);
595 ret.RemoveRange(start, end - start); 595 ret.RemoveRange(start, end - start);
596 return ret; 596 return ret;
597 } 597 }
598 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; } 598 public int llGetListEntryType(List<string> src, int index) { NotImplemented("llGetListEntryType"); return 0; }
599 public string llList2CSV(List<string> src) 599 public string llList2CSV(List<string> src)
600 { 600 {
601 string ret = ""; 601 string ret = "";
602 foreach (string s in src) 602 foreach (string s in src)
603 { 603 {
604 if (s.Length > 0) 604 if (s.Length > 0)
605 ret += ","; 605 ret += ",";
606 ret += s; 606 ret += s;
607 } 607 }
608 return ret; 608 return ret;
609 } 609 }
610 public List<string> llCSV2List(string src) 610 public List<string> llCSV2List(string src)
611 { 611 {
612 List<string> ret = new List<string>(); 612 List<string> ret = new List<string>();
613 foreach (string s in src.Split(",".ToCharArray())) 613 foreach (string s in src.Split(",".ToCharArray()))
614 { 614 {
615 ret.Add(s); 615 ret.Add(s);
616 } 616 }
617 return ret; 617 return ret;
618 } 618 }
619 public List<string> llListRandomize(List<string> src, int stride) 619 public List<string> llListRandomize(List<string> src, int stride)
620 { 620 {
621 int s = stride; 621 int s = stride;
622 if (s < 1) 622 if (s < 1)
623 s = 1; 623 s = 1;
624 624
625 // This is a cowardly way of doing it ;) 625 // This is a cowardly way of doing it ;)
626 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange 626 // TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange
627 List<List<string>> tmp = new List<List<string>>(); 627 List<List<string>> tmp = new List<List<string>>();
628 628
629 // Add chunks to an array 629 // Add chunks to an array
630 int c = 0; 630 int c = 0;
631 List<string> chunk = new List<string>(); 631 List<string> chunk = new List<string>();
632 foreach (string element in src) 632 foreach (string element in src)
633 { 633 {
634 c++; 634 c++;
635 if (c > s) 635 if (c > s)
636 { 636 {
637 tmp.Add(chunk); 637 tmp.Add(chunk);
638 chunk = new List<string>(); 638 chunk = new List<string>();
639 c = 0; 639 c = 0;
640 } 640 }
641 chunk.Add(element); 641 chunk.Add(element);
642 } 642 }
643 if (chunk.Count > 0) 643 if (chunk.Count > 0)
644 tmp.Add(chunk); 644 tmp.Add(chunk);
645 645
646 // Decreate (<- what kind of word is that? :D ) array back into a list 646 // Decreate (<- what kind of word is that? :D ) array back into a list
647 int rnd; 647 int rnd;
648 List<string> ret = new List<string>(); 648 List<string> ret = new List<string>();
649 while (tmp.Count > 0) 649 while (tmp.Count > 0)
650 { 650 {
651 rnd = Util.RandomClass.Next(tmp.Count); 651 rnd = Util.RandomClass.Next(tmp.Count);
652 foreach (string str in tmp[rnd]) 652 foreach (string str in tmp[rnd])
653 { 653 {
654 ret.Add(str); 654 ret.Add(str);
655 } 655 }
656 tmp.RemoveAt(rnd); 656 tmp.RemoveAt(rnd);
657 } 657 }
658 658
659 return ret; 659 return ret;
660 660
661 661
662 } 662 }
663 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 663 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
664 { 664 {
665 List<string> ret = new List<string>(); 665 List<string> ret = new List<string>();
666 int s = stride; 666 int s = stride;
667 if (s < 1) 667 if (s < 1)
668 s = 1; 668 s = 1;
669 669
670 int sc = s; 670 int sc = s;
671 for (int i = start; i < src.Count; i++) 671 for (int i = start; i < src.Count; i++)
672 { 672 {
673 sc--; 673 sc--;
674 if (sc == 0) 674 if (sc == 0)
675 { 675 {
676 sc = s; 676 sc = s;
677 // Addthis 677 // Addthis
678 ret.Add(src[i]); 678 ret.Add(src[i]);
679 } 679 }
680 if (i == end) 680 if (i == end)
681 break; 681 break;
682 } 682 }
683 return ret; 683 return ret;
684 } 684 }
685 685
686 public LSL_Types.Vector3 llGetRegionCorner() 686 public LSL_Types.Vector3 llGetRegionCorner()
687 { 687 {
688 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 688 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0);
689 } 689 }
690 690
691 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 691 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
692 { 692 {
693 693
694 List<string> ret = new List<string>(dest); 694 List<string> ret = new List<string>(dest);
695 //foreach (string s in src.Reverse()) 695 //foreach (string s in src.Reverse())
696 for (int ci = src.Count - 1; ci > -1; ci--) 696 for (int ci = src.Count - 1; ci > -1; ci--)
697 { 697 {
698 ret.Insert(start, src[ci]); 698 ret.Insert(start, src[ci]);
699 } 699 }
700 return ret; 700 return ret;
701 } 701 }
702 public int llListFindList(List<string> src, List<string> test) 702 public int llListFindList(List<string> src, List<string> test)
703 { 703 {
704 foreach (string s in test) 704 foreach (string s in test)
705 { 705 {
706 for (int ci = 0; ci < src.Count; ci++) 706 for (int ci = 0; ci < src.Count; ci++)
707 { 707 {
708 708
709 if (s == src[ci]) 709 if (s == src[ci])
710 return ci; 710 return ci;
711 } 711 }
712 } 712 }
713 return -1; 713 return -1;
714 } 714 }
715 715
716 public string llGetObjectName() 716 public string llGetObjectName()
717 { 717 {
718 return m_host.Name; 718 return m_host.Name;
719 } 719 }
720 720
721 public void llSetObjectName(string name) 721 public void llSetObjectName(string name)
722 { 722 {
723 m_host.Name = name; 723 m_host.Name = name;
724 } 724 }
725 725
726 public string llGetDate() 726 public string llGetDate()
727 { 727 {
728 DateTime date = DateTime.Now.ToUniversalTime(); 728 DateTime date = DateTime.Now.ToUniversalTime();
729 string result = date.ToString("yyyy-MM-dd"); 729 string result = date.ToString("yyyy-MM-dd");
730 return result; 730 return result;
731 } 731 }
732 732
733 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; } 733 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { NotImplemented("llEdgeOfWorld"); return 0; }
734 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; } 734 public int llGetAgentInfo(string id) { NotImplemented("llGetAgentInfo"); return 0; }
735 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); } 735 public void llAdjustSoundVolume(double volume) { NotImplemented("llAdjustSoundVolume"); }
736 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); } 736 public void llSetSoundQueueing(int queue) { NotImplemented("llSetSoundQueueing"); }
737 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); } 737 public void llSetSoundRadius(double radius) { NotImplemented("llSetSoundRadius"); }
738 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; } 738 public string llKey2Name(string id) { NotImplemented("llKey2Name"); return ""; }
739 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); } 739 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { NotImplemented("llSetTextureAnim"); }
740 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); } 740 public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east, LSL_Types.Vector3 bottom_south_west) { NotImplemented("llTriggerSoundLimited"); }
741 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); } 741 public void llEjectFromLand(string pest) { NotImplemented("llEjectFromLand"); }
742 742
743 public void llParseString2List() { NotImplemented("llParseString2List"); } 743 public void llParseString2List() { NotImplemented("llParseString2List"); }
744 744
745 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; } 745 public int llOverMyLand(string id) { NotImplemented("llOverMyLand"); return 0; }
746 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; } 746 public string llGetLandOwnerAt(LSL_Types.Vector3 pos) { NotImplemented("llGetLandOwnerAt"); return ""; }
747 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; } 747 public string llGetNotecardLine(string name, int line) { NotImplemented("llGetNotecardLine"); return ""; }
748 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); } 748 public LSL_Types.Vector3 llGetAgentSize(string id) { NotImplemented("llGetAgentSize"); return new LSL_Types.Vector3(); }
749 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; } 749 public int llSameGroup(string agent) { NotImplemented("llSameGroup"); return 0; }
750 public void llUnSit(string id) { NotImplemented("llUnSit"); } 750 public void llUnSit(string id) { NotImplemented("llUnSit"); }
751 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); } 751 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) { NotImplemented("llGroundSlope"); return new LSL_Types.Vector3(); }
752 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); } 752 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) { NotImplemented("llGroundNormal"); return new LSL_Types.Vector3(); }
753 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); } 753 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { NotImplemented("llGroundContour"); return new LSL_Types.Vector3(); }
754 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; } 754 public int llGetAttached() { NotImplemented("llGetAttached"); return 0; }
755 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; } 755 public int llGetFreeMemory() { NotImplemented("llGetFreeMemory"); return 0; }
756 756
757 public string llGetRegionName() 757 public string llGetRegionName()
758 { 758 {
759 return World.RegionInfo.RegionName; 759 return World.RegionInfo.RegionName;
760 } 760 }
761 761
762 public double llGetRegionTimeDilation() { return 1.0f; } 762 public double llGetRegionTimeDilation() { return 1.0f; }
763 public double llGetRegionFPS() { return 10.0f; } 763 public double llGetRegionFPS() { return 10.0f; }
764 public void llParticleSystem(List<Object> rules) { NotImplemented("llParticleSystem"); } 764 public void llParticleSystem(List<Object> rules) { NotImplemented("llParticleSystem"); }
765 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } 765 public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); }
766 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } 766 public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); }
767 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } 767 public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); }
768 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); } 768 public void llSetVehicledoubleParam(int param, double value) { NotImplemented("llSetVehicledoubleParam"); }
769 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); } 769 public void llSetVehicleVectorParam(int param, LSL_Types.Vector3 vec) { NotImplemented("llSetVehicleVectorParam"); }
770 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); } 770 public void llSetVehicleRotationParam(int param, LSL_Types.Quaternion rot) { NotImplemented("llSetVehicleRotationParam"); }
771 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); } 771 public void llSetVehicleFlags(int flags) { NotImplemented("llSetVehicleFlags"); }
772 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); } 772 public void llRemoveVehicleFlags(int flags) { NotImplemented("llRemoveVehicleFlags"); }
773 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); } 773 public void llSitTarget(LSL_Types.Vector3 offset, LSL_Types.Quaternion rot) { NotImplemented("llSitTarget"); }
774 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; } 774 public string llAvatarOnSitTarget() { NotImplemented("llAvatarOnSitTarget"); return ""; }
775 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); } 775 public void llAddToLandPassList(string avatar, double hours) { NotImplemented("llAddToLandPassList"); }
776 776
777 public void llSetTouchText(string text) 777 public void llSetTouchText(string text)
778 { 778 {
779 m_host.TouchName = text; 779 m_host.TouchName = text;
780 } 780 }
781 781
782 public void llSetSitText(string text) 782 public void llSetSitText(string text)
783 { 783 {
784 m_host.SitName = text; 784 m_host.SitName = text;
785 } 785 }
786 786
787 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); } 787 public void llSetCameraEyeOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraEyeOffset"); }
788 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); } 788 public void llSetCameraAtOffset(LSL_Types.Vector3 offset) { NotImplemented("llSetCameraAtOffset"); }
789 public void llDumpList2String() { NotImplemented("llDumpList2String"); } 789 public void llDumpList2String() { NotImplemented("llDumpList2String"); }
790 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); } 790 public void llScriptDanger(LSL_Types.Vector3 pos) { NotImplemented("llScriptDanger"); }
791 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); } 791 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { NotImplemented("llDialog"); }
792 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); } 792 public void llVolumeDetect(int detect) { NotImplemented("llVolumeDetect"); }
793 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); } 793 public void llResetOtherScript(string name) { NotImplemented("llResetOtherScript"); }
794 794
795 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; } 795 public int llGetScriptState(string name) { NotImplemented("llGetScriptState"); return 0; }
796 796
797 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); } 797 public void llRemoteLoadScript() { NotImplemented("llRemoteLoadScript"); }
798 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); } 798 public void llSetRemoteScriptAccessPin(int pin) { NotImplemented("llSetRemoteScriptAccessPin"); }
799 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); } 799 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { NotImplemented("llRemoteLoadScriptPin"); }
800 public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); } 800 public void llOpenRemoteDataChannel() { NotImplemented("llOpenRemoteDataChannel"); }
801 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; } 801 public string llSendRemoteData(string channel, string dest, int idata, string sdata) { NotImplemented("llSendRemoteData"); return ""; }
802 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); } 802 public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) { NotImplemented("llRemoteDataReply"); }
803 public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); } 803 public void llCloseRemoteDataChannel(string channel) { NotImplemented("llCloseRemoteDataChannel"); }
804 804
805 public string llMD5String(string src, int nonce) 805 public string llMD5String(string src, int nonce)
806 { 806 {
807 return Util.Md5Hash(src + ":" + nonce.ToString()); 807 return Util.Md5Hash(src + ":" + nonce.ToString());
808 } 808 }
809 809
810 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); } 810 public void llSetPrimitiveParams(List<string> rules) { NotImplemented("llSetPrimitiveParams"); }
811 public string llStringToBase64(string str) 811 public string llStringToBase64(string str)
812 { 812 {
813 813
814 try 814 try
815 { 815 {
816 byte[] encData_byte = new byte[str.Length]; 816 byte[] encData_byte = new byte[str.Length];
817 encData_byte = System.Text.Encoding.UTF8.GetBytes(str); 817 encData_byte = System.Text.Encoding.UTF8.GetBytes(str);
818 string encodedData = Convert.ToBase64String(encData_byte); 818 string encodedData = Convert.ToBase64String(encData_byte);
819 return encodedData; 819 return encodedData;
820 } 820 }
821 catch (Exception e) 821 catch (Exception e)
822 { 822 {
823 throw new Exception("Error in base64Encode" + e.Message); 823 throw new Exception("Error in base64Encode" + e.Message);
824 } 824 }
825 } 825 }
826 826
827 public string llBase64ToString(string str) 827 public string llBase64ToString(string str)
828 { 828 {
829 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 829 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
830 System.Text.Decoder utf8Decode = encoder.GetDecoder(); 830 System.Text.Decoder utf8Decode = encoder.GetDecoder();
831 try 831 try
832 { 832 {
833 833
834 byte[] todecode_byte = Convert.FromBase64String(str); 834 byte[] todecode_byte = Convert.FromBase64String(str);
835 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 835 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
836 char[] decoded_char = new char[charCount]; 836 char[] decoded_char = new char[charCount];
837 utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); 837 utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
838 string result = new String(decoded_char); 838 string result = new String(decoded_char);
839 return result; 839 return result;
840 } 840 }
841 catch (Exception e) 841 catch (Exception e)
842 { 842 {
843 throw new Exception("Error in base64Decode" + e.Message); 843 throw new Exception("Error in base64Decode" + e.Message);
844 } 844 }
845 } 845 }
846 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); } 846 public void llXorBase64Strings() { throw new Exception("Command deprecated! Use llXorBase64StringsCorrect instead."); }
847 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); } 847 public void llRemoteDataSetRegion() { NotImplemented("llRemoteDataSetRegion"); }
848 public double llLog10(double val) { return (double)Math.Log10(val); } 848 public double llLog10(double val) { return (double)Math.Log10(val); }
849 public double llLog(double val) { return (double)Math.Log(val); } 849 public double llLog(double val) { return (double)Math.Log(val); }
850 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); } 850 public List<string> llGetAnimationList(string id) { NotImplemented("llGetAnimationList"); return new List<string>(); }
851 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); } 851 public void llSetParcelMusicURL(string url) { NotImplemented("llSetParcelMusicURL"); }
852 852
853 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); } 853 public LSL_Types.Vector3 llGetRootPosition() { NotImplemented("llGetRootPosition"); return new LSL_Types.Vector3(); }
854 854
855 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); } 855 public LSL_Types.Quaternion llGetRootRotation() { NotImplemented("llGetRootRotation"); return new LSL_Types.Quaternion(); }
856 856
857 public string llGetObjectDesc() 857 public string llGetObjectDesc()
858 { 858 {
859 return m_host.Description; 859 return m_host.Description;
860 } 860 }
861 861
862 public void llSetObjectDesc(string desc) 862 public void llSetObjectDesc(string desc)
863 { 863 {
864 m_host.Description = desc; 864 m_host.Description = desc;
865 } 865 }
866 866
867 public string llGetCreator() 867 public string llGetCreator()
868 { 868 {
869 return m_host.ObjectCreator.ToStringHyphenated(); 869 return m_host.ObjectCreator.ToStringHyphenated();
870 } 870 }
871 871
872 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } 872 public string llGetTimestamp() { return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); }
873 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); } 873 public void llSetLinkAlpha(int linknumber, double alpha, int face) { NotImplemented("llSetLinkAlpha"); }
874 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; } 874 public int llGetNumberOfPrims() { NotImplemented("llGetNumberOfPrims"); return 0; }
875 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; } 875 public string llGetNumberOfNotecardLines(string name) { NotImplemented("llGetNumberOfNotecardLines"); return ""; }
876 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); } 876 public List<string> llGetBoundingBox(string obj) { NotImplemented("llGetBoundingBox"); return new List<string>(); }
877 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); } 877 public LSL_Types.Vector3 llGetGeometricCenter() { NotImplemented("llGetGeometricCenter"); return new LSL_Types.Vector3(); }
878 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); } 878 public void llGetPrimitiveParams() { NotImplemented("llGetPrimitiveParams"); }
879 public string llIntegerToBase64(int number) 879 public string llIntegerToBase64(int number)
880 { 880 {
881 NotImplemented("llIntegerToBase64"); return ""; 881 NotImplemented("llIntegerToBase64"); return "";
882 } 882 }
883 public int llBase64ToInteger(string str) 883 public int llBase64ToInteger(string str)
884 { 884 {
885 NotImplemented("llBase64ToInteger"); return 0; 885 NotImplemented("llBase64ToInteger"); return 0;
886 } 886 }
887 887
888 public double llGetGMTclock() 888 public double llGetGMTclock()
889 { 889 {
890 return DateTime.UtcNow.TimeOfDay.TotalSeconds; 890 return DateTime.UtcNow.TimeOfDay.TotalSeconds;
891 } 891 }
892 892
893 public string llGetSimulatorHostname() 893 public string llGetSimulatorHostname()
894 { 894 {
895 return System.Environment.MachineName; 895 return System.Environment.MachineName;
896 } 896 }
897 897
898 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); } 898 public void llSetLocalRot(LSL_Types.Quaternion rot) { NotImplemented("llSetLocalRot"); }
899 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); } 899 public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers) { NotImplemented("llParseStringKeepNulls"); return new List<string>(); }
900 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); } 900 public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Quaternion rot, int param) { NotImplemented("llRezAtRoot"); }
901 901
902 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; } 902 public int llGetObjectPermMask(int mask) { NotImplemented("llGetObjectPermMask"); return 0; }
903 903
904 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); } 904 public void llSetObjectPermMask(int mask, int value) { NotImplemented("llSetObjectPermMask"); }
905 905
906 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); } 906 public void llGetInventoryPermMask(string item, int mask) { NotImplemented("llGetInventoryPermMask"); }
907 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); } 907 public void llSetInventoryPermMask(string item, int mask, int value) { NotImplemented("llSetInventoryPermMask"); }
908 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; } 908 public string llGetInventoryCreator(string item) { NotImplemented("llGetInventoryCreator"); return ""; }
909 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); } 909 public void llOwnerSay(string msg) { NotImplemented("llOwnerSay"); }
910 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); } 910 public void llRequestSimulatorData(string simulator, int data) { NotImplemented("llRequestSimulatorData"); }
911 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); } 911 public void llForceMouselook(int mouselook) { NotImplemented("llForceMouselook"); }
912 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; } 912 public double llGetObjectMass(string id) { NotImplemented("llGetObjectMass"); return 0; }
913 public void llListReplaceList() { NotImplemented("llListReplaceList"); } 913 public void llListReplaceList() { NotImplemented("llListReplaceList"); }
914 914
915 public void llLoadURL(string avatar_id, string message, string url) 915 public void llLoadURL(string avatar_id, string message, string url)
916 { 916 {
917 LLUUID avatarId = new LLUUID(avatar_id); 917 LLUUID avatarId = new LLUUID(avatar_id);
918 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url); 918 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url);
919 } 919 }
920 920
921 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); } 921 public void llParcelMediaCommandList(List<string> commandList) { NotImplemented("llParcelMediaCommandList"); }
922 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); } 922 public void llParcelMediaQuery() { NotImplemented("llParcelMediaQuery"); }
923 923
924 public int llModPow(int a, int b, int c) 924 public int llModPow(int a, int b, int c)
925 { 925 {
926 Int64 tmp = 0; 926 Int64 tmp = 0;
927 Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); 927 Int64 val = Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
928 return Convert.ToInt32(tmp); 928 return Convert.ToInt32(tmp);
929 } 929 }
930 930
931 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; } 931 public int llGetInventoryType(string name) { NotImplemented("llGetInventoryType"); return 0; }
932 932
933 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); } 933 public void llSetPayPrice(int price, List<string> quick_pay_buttons) { NotImplemented("llSetPayPrice"); }
934 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); } 934 public LSL_Types.Vector3 llGetCameraPos() { NotImplemented("llGetCameraPos"); return new LSL_Types.Vector3(); }
935 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); } 935 public LSL_Types.Quaternion llGetCameraRot() { NotImplemented("llGetCameraRot"); return new LSL_Types.Quaternion(); }
936 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); } 936 public void llSetPrimURL() { NotImplemented("llSetPrimURL"); }
937 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); } 937 public void llRefreshPrimURL() { NotImplemented("llRefreshPrimURL"); }
938 938
939 public string llEscapeURL(string url) 939 public string llEscapeURL(string url)
940 { 940 {
941 try 941 try
942 { 942 {
943 return Uri.EscapeUriString(url); 943 return Uri.EscapeUriString(url);
944 } 944 }
945 catch (Exception ex) 945 catch (Exception ex)
946 { 946 {
947 return "llEscapeURL: " + ex.ToString(); 947 return "llEscapeURL: " + ex.ToString();
948 } 948 }
949 } 949 }
950 950
951 public string llUnescapeURL(string url) 951 public string llUnescapeURL(string url)
952 { 952 {
953 try 953 try
954 { 954 {
955 return Uri.UnescapeDataString(url); 955 return Uri.UnescapeDataString(url);
956 } 956 }
957 catch (Exception ex) 957 catch (Exception ex)
958 { 958 {
959 return "llUnescapeURL: " + ex.ToString(); 959 return "llUnescapeURL: " + ex.ToString();
960 } 960 }
961 } 961 }
962 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); } 962 public void llMapDestination(string simname, LSL_Types.Vector3 pos, LSL_Types.Vector3 look_at) { NotImplemented("llMapDestination"); }
963 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); } 963 public void llAddToLandBanList(string avatar, double hours) { NotImplemented("llAddToLandBanList"); }
964 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); } 964 public void llRemoveFromLandPassList(string avatar) { NotImplemented("llRemoveFromLandPassList"); }
965 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); } 965 public void llRemoveFromLandBanList(string avatar) { NotImplemented("llRemoveFromLandBanList"); }
966 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); } 966 public void llSetCameraParams(List<string> rules) { NotImplemented("llSetCameraParams"); }
967 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); } 967 public void llClearCameraParams() { NotImplemented("llClearCameraParams"); }
968 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; } 968 public double llListStatistics(int operation, List<string> src) { NotImplemented("llListStatistics"); return 0; }
969 969
970 public int llGetUnixTime() 970 public int llGetUnixTime()
971 { 971 {
972 return Util.UnixTimeSinceEpoch(); 972 return Util.UnixTimeSinceEpoch();
973 } 973 }
974 974
975 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; } 975 public int llGetParcelFlags(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelFlags"); return 0; }
976 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; } 976 public int llGetRegionFlags() { NotImplemented("llGetRegionFlags"); return 0; }
977 public string llXorBase64StringsCorrect(string str1, string str2) 977 public string llXorBase64StringsCorrect(string str1, string str2)
978 { 978 {
979 string ret = ""; 979 string ret = "";
980 string src1 = llBase64ToString(str1); 980 string src1 = llBase64ToString(str1);
981 string src2 = llBase64ToString(str2); 981 string src2 = llBase64ToString(str2);
982 int c = 0; 982 int c = 0;
983 for (int i = 0; i < src1.Length; i++) 983 for (int i = 0; i < src1.Length; i++)
984 { 984 {
985 ret += src1[i] ^ src2[c]; 985 ret += src1[i] ^ src2[c];
986 986
987 c++; 987 c++;
988 if (c > src2.Length) 988 if (c > src2.Length)
989 c = 0; 989 c = 0;
990 } 990 }
991 return llStringToBase64(ret); 991 return llStringToBase64(ret);
992 } 992 }
993 public void llHTTPRequest(string url, List<string> parameters, string body) 993 public void llHTTPRequest(string url, List<string> parameters, string body)
994 { 994 {
995 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body); 995 m_ScriptEngine.m_LSLLongCmdHandler.StartHttpRequest(m_localID, m_itemID, url, parameters, body);
996 } 996 }
997 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); } 997 public void llResetLandBanList() { NotImplemented("llResetLandBanList"); }
998 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); } 998 public void llResetLandPassList() { NotImplemented("llResetLandPassList"); }
999 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; } 999 public int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) { NotImplemented("llGetParcelPrimCount"); return 0; }
1000 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); } 1000 public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos) { NotImplemented("llGetParcelPrimOwners"); return new List<string>(); }
1001 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; } 1001 public int llGetObjectPrimCount(string object_id) { NotImplemented("llGetObjectPrimCount"); return 0; }
1002 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; } 1002 public int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide) { NotImplemented("llGetParcelMaxPrims"); return 0; }
1003 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); } 1003 public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param) { NotImplemented("llGetParcelDetails"); return new List<string>(); }
1004 1004
1005 // 1005 //
1006 // OpenSim functions 1006 // OpenSim functions
1007 // 1007 //
1008 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) 1008 public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer)
1009 { 1009 {
1010 if (dynamicID == "") 1010 if (dynamicID == "")
1011 { 1011 {
1012 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>(); 1012 IDynamicTextureManager textureManager = this.World.RequestModuleInterface<IDynamicTextureManager>();
1013 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer); 1013 LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer);
1014 return createdTexture.ToStringHyphenated(); 1014 return createdTexture.ToStringHyphenated();
1015 } 1015 }
1016 else 1016 else
1017 { 1017 {
1018 //TODO update existing dynamic textures 1018 //TODO update existing dynamic textures
1019 } 1019 }
1020 1020
1021 return LLUUID.Zero.ToStringHyphenated(); 1021 return LLUUID.Zero.ToStringHyphenated();
1022 } 1022 }
1023 1023
1024 private void NotImplemented(string Command) 1024 private void NotImplemented(string Command)
1025 { 1025 {
1026 if (throwErrorOnNotImplemented) 1026 if (throwErrorOnNotImplemented)
1027 throw new NotImplementedException("Command not implemented: " + Command); 1027 throw new NotImplementedException("Command not implemented: " + Command);
1028 } 1028 }
1029 1029
1030 } 1030 }
1031} 1031}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index a45de1e..8ab0c30 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -1,262 +1,262 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Threading; 4using System.Threading;
5using libsecondlife; 5using libsecondlife;
6using OpenSim.Region.ScriptEngine.Common; 6using OpenSim.Region.ScriptEngine.Common;
7 7
8namespace OpenSim.Region.ScriptEngine.DotNetEngine 8namespace OpenSim.Region.ScriptEngine.DotNetEngine
9{ 9{
10 /// <summary> 10 /// <summary>
11 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. 11 /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
12 /// </summary> 12 /// </summary>
13 class LSLLongCmdHandler 13 class LSLLongCmdHandler
14 { 14 {
15 private Thread cmdHandlerThread; 15 private Thread cmdHandlerThread;
16 private int cmdHandlerThreadCycleSleepms = 100; 16 private int cmdHandlerThreadCycleSleepms = 100;
17 17
18 private ScriptEngine m_ScriptEngine; 18 private ScriptEngine m_ScriptEngine;
19 public LSLLongCmdHandler(ScriptEngine _ScriptEngine) 19 public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
20 { 20 {
21 m_ScriptEngine = _ScriptEngine; 21 m_ScriptEngine = _ScriptEngine;
22 22
23 // Start the thread that will be doing the work 23 // Start the thread that will be doing the work
24 cmdHandlerThread = new Thread(CmdHandlerThreadLoop); 24 cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
25 cmdHandlerThread.Name = "CmdHandlerThread"; 25 cmdHandlerThread.Name = "CmdHandlerThread";
26 cmdHandlerThread.Priority = ThreadPriority.BelowNormal; 26 cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
27 cmdHandlerThread.IsBackground = true; 27 cmdHandlerThread.IsBackground = true;
28 cmdHandlerThread.Start(); 28 cmdHandlerThread.Start();
29 } 29 }
30 ~LSLLongCmdHandler() 30 ~LSLLongCmdHandler()
31 { 31 {
32 // Shut down thread 32 // Shut down thread
33 try 33 try
34 { 34 {
35 if (cmdHandlerThread != null) 35 if (cmdHandlerThread != null)
36 { 36 {
37 if (cmdHandlerThread.IsAlive == true) 37 if (cmdHandlerThread.IsAlive == true)
38 { 38 {
39 cmdHandlerThread.Abort(); 39 cmdHandlerThread.Abort();
40 cmdHandlerThread.Join(); 40 cmdHandlerThread.Join();
41 } 41 }
42 } 42 }
43 } 43 }
44 catch { } 44 catch { }
45 } 45 }
46 46
47 private void CmdHandlerThreadLoop() 47 private void CmdHandlerThreadLoop()
48 { 48 {
49 while (true) 49 while (true)
50 { 50 {
51 // Check timers 51 // Check timers
52 CheckTimerEvents(); 52 CheckTimerEvents();
53 // Check HttpRequests 53 // Check HttpRequests
54 CheckHttpRequests(); 54 CheckHttpRequests();
55 55
56 // Sleep before next cycle 56 // Sleep before next cycle
57 Thread.Sleep(cmdHandlerThreadCycleSleepms); 57 Thread.Sleep(cmdHandlerThreadCycleSleepms);
58 } 58 }
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// Remove a specific script (and all its pending commands) 62 /// Remove a specific script (and all its pending commands)
63 /// </summary> 63 /// </summary>
64 /// <param name="m_localID"></param> 64 /// <param name="m_localID"></param>
65 /// <param name="m_itemID"></param> 65 /// <param name="m_itemID"></param>
66 public void RemoveScript(uint localID, LLUUID itemID) 66 public void RemoveScript(uint localID, LLUUID itemID)
67 { 67 {
68 // Remove a specific script 68 // Remove a specific script
69 69
70 // Remove from: Timers 70 // Remove from: Timers
71 UnSetTimerEvents(localID, itemID); 71 UnSetTimerEvents(localID, itemID);
72 // Remove from: HttpRequest 72 // Remove from: HttpRequest
73 StopHttpRequest(localID, itemID); 73 StopHttpRequest(localID, itemID);
74 } 74 }
75 75
76 #region TIMER 76 #region TIMER
77 77
78 // 78 //
79 // TIMER 79 // TIMER
80 // 80 //
81 private class TimerClass 81 private class TimerClass
82 { 82 {
83 public uint localID; 83 public uint localID;
84 public LLUUID itemID; 84 public LLUUID itemID;
85 public double interval; 85 public double interval;
86 public DateTime next; 86 public DateTime next;
87 } 87 }
88 private List<TimerClass> Timers = new List<TimerClass>(); 88 private List<TimerClass> Timers = new List<TimerClass>();
89 private object TimerListLock = new object(); 89 private object TimerListLock = new object();
90 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) 90 public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec)
91 { 91 {
92 Console.WriteLine("SetTimerEvent"); 92 Console.WriteLine("SetTimerEvent");
93 93
94 // Always remove first, in case this is a re-set 94 // Always remove first, in case this is a re-set
95 UnSetTimerEvents(m_localID, m_itemID); 95 UnSetTimerEvents(m_localID, m_itemID);
96 if (sec == 0) // Disabling timer 96 if (sec == 0) // Disabling timer
97 return; 97 return;
98 98
99 // Add to timer 99 // Add to timer
100 TimerClass ts = new TimerClass(); 100 TimerClass ts = new TimerClass();
101 ts.localID = m_localID; 101 ts.localID = m_localID;
102 ts.itemID = m_itemID; 102 ts.itemID = m_itemID;
103 ts.interval = sec; 103 ts.interval = sec;
104 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 104 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
105 lock (TimerListLock) 105 lock (TimerListLock)
106 { 106 {
107 Timers.Add(ts); 107 Timers.Add(ts);
108 } 108 }
109 } 109 }
110 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) 110 public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID)
111 { 111 {
112 // Remove from timer 112 // Remove from timer
113 lock (TimerListLock) 113 lock (TimerListLock)
114 { 114 {
115 List<TimerClass> NewTimers = new List<TimerClass>(); 115 List<TimerClass> NewTimers = new List<TimerClass>();
116 foreach (TimerClass ts in Timers) 116 foreach (TimerClass ts in Timers)
117 { 117 {
118 if (ts.localID != m_localID && ts.itemID != m_itemID) 118 if (ts.localID != m_localID && ts.itemID != m_itemID)
119 { 119 {
120 NewTimers.Add(ts); 120 NewTimers.Add(ts);
121 } 121 }
122 } 122 }
123 Timers.Clear(); 123 Timers.Clear();
124 Timers = NewTimers; 124 Timers = NewTimers;
125 } 125 }
126 } 126 }
127 public void CheckTimerEvents() 127 public void CheckTimerEvents()
128 { 128 {
129 // Nothing to do here? 129 // Nothing to do here?
130 if (Timers.Count == 0) 130 if (Timers.Count == 0)
131 return; 131 return;
132 132
133 lock (TimerListLock) 133 lock (TimerListLock)
134 { 134 {
135 135
136 // Go through all timers 136 // Go through all timers
137 foreach (TimerClass ts in Timers) 137 foreach (TimerClass ts in Timers)
138 { 138 {
139 // Time has passed? 139 // Time has passed?
140 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 140 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
141 { 141 {
142 // Add it to queue 142 // Add it to queue
143 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); 143 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
144 // set next interval 144 // set next interval
145 145
146 146
147 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); 147 ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
148 } 148 }
149 } 149 }
150 } // lock 150 } // lock
151 } 151 }
152 #endregion 152 #endregion
153 153
154 #region HTTP REQUEST 154 #region HTTP REQUEST
155 155
156 // 156 //
157 // HTTP REAQUEST 157 // HTTP REAQUEST
158 // 158 //
159 private class HttpClass 159 private class HttpClass
160 { 160 {
161 public uint localID; 161 public uint localID;
162 public LLUUID itemID; 162 public LLUUID itemID;
163 public string url; 163 public string url;
164 public List<string> parameters; 164 public List<string> parameters;
165 public string body; 165 public string body;
166 public DateTime next; 166 public DateTime next;
167 167
168 public string response_request_id; 168 public string response_request_id;
169 public int response_status; 169 public int response_status;
170 public List<string> response_metadata; 170 public List<string> response_metadata;
171 public string response_body; 171 public string response_body;
172 172
173 public void SendRequest() 173 public void SendRequest()
174 { 174 {
175 // TODO: SEND REQUEST!!! 175 // TODO: SEND REQUEST!!!
176 } 176 }
177 public void Stop() 177 public void Stop()
178 { 178 {
179 // TODO: Cancel any ongoing request 179 // TODO: Cancel any ongoing request
180 } 180 }
181 public bool CheckResponse() 181 public bool CheckResponse()
182 { 182 {
183 // TODO: Check if we got a response yet, return true if so -- false if not 183 // TODO: Check if we got a response yet, return true if so -- false if not
184 return true; 184 return true;
185 185
186 // TODO: If we got a response, set the following then return true 186 // TODO: If we got a response, set the following then return true
187 //response_request_id 187 //response_request_id
188 //response_status 188 //response_status
189 //response_metadata 189 //response_metadata
190 //response_body 190 //response_body
191 191
192 } 192 }
193 } 193 }
194 private List<HttpClass> HttpRequests = new List<HttpClass>(); 194 private List<HttpClass> HttpRequests = new List<HttpClass>();
195 private object HttpListLock = new object(); 195 private object HttpListLock = new object();
196 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 196 public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
197 { 197 {
198 Console.WriteLine("StartHttpRequest"); 198 Console.WriteLine("StartHttpRequest");
199 199
200 HttpClass htc = new HttpClass(); 200 HttpClass htc = new HttpClass();
201 htc.localID = localID; 201 htc.localID = localID;
202 htc.itemID = itemID; 202 htc.itemID = itemID;
203 htc.url = url; 203 htc.url = url;
204 htc.parameters = parameters; 204 htc.parameters = parameters;
205 htc.body = body; 205 htc.body = body;
206 lock (HttpListLock) 206 lock (HttpListLock)
207 { 207 {
208 208
209 //ADD REQUEST 209 //ADD REQUEST
210 HttpRequests.Add(htc); 210 HttpRequests.Add(htc);
211 } 211 }
212 } 212 }
213 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 213 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
214 { 214 {
215 // Remove from list 215 // Remove from list
216 lock (HttpListLock) 216 lock (HttpListLock)
217 { 217 {
218 List<HttpClass> NewHttpList = new List<HttpClass>(); 218 List<HttpClass> NewHttpList = new List<HttpClass>();
219 foreach (HttpClass ts in HttpRequests) 219 foreach (HttpClass ts in HttpRequests)
220 { 220 {
221 if (ts.localID != m_localID && ts.itemID != m_itemID) 221 if (ts.localID != m_localID && ts.itemID != m_itemID)
222 { 222 {
223 // Keeping this one 223 // Keeping this one
224 NewHttpList.Add(ts); 224 NewHttpList.Add(ts);
225 } 225 }
226 else 226 else
227 { 227 {
228 // Shutting this one down 228 // Shutting this one down
229 ts.Stop(); 229 ts.Stop();
230 } 230 }
231 } 231 }
232 HttpRequests.Clear(); 232 HttpRequests.Clear();
233 HttpRequests = NewHttpList; 233 HttpRequests = NewHttpList;
234 } 234 }
235 } 235 }
236 public void CheckHttpRequests() 236 public void CheckHttpRequests()
237 { 237 {
238 // Nothing to do here? 238 // Nothing to do here?
239 if (HttpRequests.Count == 0) 239 if (HttpRequests.Count == 0)
240 return; 240 return;
241 241
242 lock (HttpListLock) 242 lock (HttpListLock)
243 { 243 {
244 foreach (HttpClass ts in HttpRequests) 244 foreach (HttpClass ts in HttpRequests)
245 { 245 {
246 246
247 if (ts.CheckResponse() == true) 247 if (ts.CheckResponse() == true)
248 { 248 {
249 // Add it to event queue 249 // Add it to event queue
250 //key request_id, integer status, list metadata, string body 250 //key request_id, integer status, list metadata, string body
251 object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; 251 object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body };
252 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); 252 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj);
253 // Now stop it 253 // Now stop it
254 StopHttpRequest(ts.localID, ts.itemID); 254 StopHttpRequest(ts.localID, ts.itemID);
255 } 255 }
256 } 256 }
257 } // lock 257 } // lock
258 } 258 }
259 #endregion 259 #endregion
260 260
261 } 261 }
262} 262}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 20300c0..e1989c4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -246,12 +246,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
246 ls.localID = localID; 246 ls.localID = localID;
247 ls.itemID = itemID; 247 ls.itemID = itemID;
248 unloadQueue.Enqueue(ls); 248 unloadQueue.Enqueue(ls);
249 } 249 }
250 public void ResetScript(uint localID, LLUUID itemID) 250 public void ResetScript(uint localID, LLUUID itemID)
251 { 251 {
252 string script = GetScript(localID, itemID).SourceCode; 252 string script = GetScript(localID, itemID).SourceCode;
253 StopScript(localID, itemID); 253 StopScript(localID, itemID);
254 StartScript(localID, itemID, script); 254 StartScript(localID, itemID, script);
255 } 255 }
256 256
257 private void _StartScript(uint localID, LLUUID itemID, string Script) 257 private void _StartScript(uint localID, LLUUID itemID, string Script)
@@ -288,8 +288,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
288 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); 288 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
289#if DEBUG 289#if DEBUG
290 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 290 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
291#endif 291#endif
292 292
293 CompiledScript.SourceCode = ScriptSource; 293 CompiledScript.SourceCode = ScriptSource;
294 // Add it to our script memstruct 294 // Add it to our script memstruct
295 SetScript(localID, itemID, CompiledScript); 295 SetScript(localID, itemID, CompiledScript);