From 5a149084d4429a327b4fb3b9a97ced462653621c Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Tue, 28 Aug 2007 18:22:48 +0000 Subject: startup event on script added to object, not all inside object. --- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 1944025..71916b0 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -32,6 +32,8 @@ using System.Text; using System.Threading; using System.Reflection; using System.Runtime.Remoting; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; @@ -267,19 +269,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); // Compile (We assume LSL) FileName = LSLCompiler.CompileFromLSLText(Script); - Console.WriteLine("Compilation of " + FileName + " done"); + //Console.WriteLine("Compilation of " + FileName + " done"); // * Insert yield into code FileName = ProcessYield(FileName); #if DEBUG long before; - before = GC.GetTotalMemory(false); + before = GC.GetTotalMemory(true); #endif LSL_BaseClass CompiledScript; CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); #if DEBUG - Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(false) - before); + Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); #endif // Add it to our script memstruct @@ -295,13 +297,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CompiledScript.Start(LSLB); // Fire the first start-event - m_scriptEngine.myEventQueueManager.AddToObjectQueue(localID, "state_entry", new object[] { }); + m_scriptEngine.myEventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); } catch (Exception e) { - m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); + //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); try { // DISPLAY ERROR INWORLD @@ -325,6 +327,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Stop script Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); + // Stop long command on script m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID); @@ -332,6 +335,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine if (LSLBC == null) return; + // TEMP: First serialize it + //GetSerializedScript(localID, itemID); + + try { // Get AppDomain @@ -382,8 +389,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public void GetSerializedScript(uint localID, LLUUID itemID) { // Serialize the script and return it - // Should not be a problem + System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID); + BinaryFormatter b = new BinaryFormatter(); + b.Serialize(fs, GetScript(localID,itemID)); + fs.Close(); + + } public void PutSerializedScript(uint localID, LLUUID itemID) { -- cgit v1.1