aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler
diff options
context:
space:
mode:
authorTedd Hansen2007-08-25 19:08:15 +0000
committerTedd Hansen2007-08-25 19:08:15 +0000
commitb75c1b2191640f4a140dc4cd0e8ce35ab64863d9 (patch)
tree05a5194e8e304df86897003bdbceca68fd65fd80 /OpenSim/Region/ScriptEngine/DotNetEngine/Compiler
parentScripts no longer crash sim after 5 minutes (override InitializeLifetimeServi... (diff)
downloadopensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.zip
opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.tar.gz
opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.tar.bz2
opensim-SC_OLD-b75c1b2191640f4a140dc4cd0e8ce35ab64863d9.tar.xz
Added class for "long commands" (command that returns as event) with dedicated thread for processing. Added support for llSetTimerEvent(). Deleting old compiled scripts before new compile is attempted (avoids loading wrong script on compile error).
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs25
3 files changed, 26 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index b58e996..f24eb63 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -51,6 +51,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
51 // Output assembly name 51 // Output assembly name
52 ScriptCompileCounter++; 52 ScriptCompileCounter++;
53 string OutFile = Path.Combine("ScriptEngines", "Script_" + ScriptCompileCounter + ".dll"); 53 string OutFile = Path.Combine("ScriptEngines", "Script_" + ScriptCompileCounter + ".dll");
54 try
55 {
56 System.IO.File.Delete(OutFile);
57 }
58 catch (Exception e)
59 {
60 Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString());
61 }
54 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); 62 //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
55 63
56 // DEBUG - write source to disk 64 // DEBUG - write source to disk
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index cb0f9ba..9af9c82 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -15,7 +15,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
15 // Object never expires 15 // Object never expires
16 public override Object InitializeLifetimeService() 16 public override Object InitializeLifetimeService()
17 { 17 {
18 Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()"); 18 //Console.WriteLine("LSL_BaseClass: InitializeLifetimeService()");
19 // return null; 19 // return null;
20 ILease lease = (ILease)base.InitializeLifetimeService(); 20 ILease lease = (ILease)base.InitializeLifetimeService();
21 21
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 187ac59..bfee3e5 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
@@ -19,15 +19,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
19 { 19 {
20 20
21 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 21 private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
22 private ScriptManager m_manager; 22 private ScriptEngine m_ScriptEngine;
23 private IScriptHost m_host; 23 private IScriptHost m_host;
24 private uint m_localID;
25 private LLUUID m_itemID;
24 26
25 public LSL_BuiltIn_Commands(ScriptManager manager, IScriptHost host) 27 public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, IScriptHost host, uint localID, LLUUID itemID)
26 { 28 {
27 m_manager = manager; 29 m_ScriptEngine = ScriptEngine;
28 m_host = host; 30 m_host = host;
31 m_localID = localID;
32 m_itemID = itemID;
33
29 34
30 MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 35 //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
31 } 36 }
32 37
33 38
@@ -39,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
39 // Object never expires 44 // Object never expires
40 public override Object InitializeLifetimeService() 45 public override Object InitializeLifetimeService()
41 { 46 {
42 Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()"); 47 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
43 // return null; 48 // return null;
44 ILease lease = (ILease)base.InitializeLifetimeService(); 49 ILease lease = (ILease)base.InitializeLifetimeService();
45 50
@@ -55,7 +60,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
55 60
56 public Scene World 61 public Scene World
57 { 62 {
58 get { return m_manager.World; } 63 get { return m_ScriptEngine.World; }
59 } 64 }
60 65
61 //These are the implementations of the various ll-functions used by the LSL scripts. 66 //These are the implementations of the various ll-functions used by the LSL scripts.
@@ -258,7 +263,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
258 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { } 263 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { }
259 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { } 264 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { }
260 public void llStopLookAt() { } 265 public void llStopLookAt() { }
261 public void llSetTimerEvent(double sec) { } 266 public void llSetTimerEvent(double sec)
267 {
268 // Setting timer repeat
269 m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
270 }
262 public void llSleep(double sec) { System.Threading.Thread.Sleep((int)(sec * 1000)); } 271 public void llSleep(double sec) { System.Threading.Thread.Sleep((int)(sec * 1000)); }
263 public double llGetMass() { return 0; } 272 public double llGetMass() { return 0; }
264 public void llCollisionFilter(string name, string id, int accept) { } 273 public void llCollisionFilter(string name, string id, int accept) { }
@@ -416,7 +425,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
416 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return new LSL_Types.Vector3(); } 425 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) { return new LSL_Types.Vector3(); }
417 public int llGetAttached() { return 0; } 426 public int llGetAttached() { return 0; }
418 public int llGetFreeMemory() { return 0; } 427 public int llGetFreeMemory() { return 0; }
419 public string llGetRegionName() { return m_manager.RegionName; } 428 public string llGetRegionName() { return World.RegionInfo.RegionName; }
420 public double llGetRegionTimeDilation() { return 1.0f; } 429 public double llGetRegionTimeDilation() { return 1.0f; }
421 public double llGetRegionFPS() { return 10.0f; } 430 public double llGetRegionFPS() { return 10.0f; }
422 public void llParticleSystem(List<Object> rules) { } 431 public void llParticleSystem(List<Object> rules) { }