aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
diff options
context:
space:
mode:
authorTedd Hansen2007-08-28 18:22:48 +0000
committerTedd Hansen2007-08-28 18:22:48 +0000
commit5a149084d4429a327b4fb3b9a97ced462653621c (patch)
treee25894fa74c81dbf45d84a9aa403afe9c4f6c3be /OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
parentAs part of our "we aim to please" commitment, have added the ability to creat... (diff)
downloadopensim-SC_OLD-5a149084d4429a327b4fb3b9a97ced462653621c.zip
opensim-SC_OLD-5a149084d4429a327b4fb3b9a97ced462653621c.tar.gz
opensim-SC_OLD-5a149084d4429a327b4fb3b9a97ced462653621c.tar.bz2
opensim-SC_OLD-5a149084d4429a327b4fb3b9a97ced462653621c.tar.xz
startup event on script added to object, not all inside object.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs24
1 files changed, 18 insertions, 6 deletions
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;
32using System.Threading; 32using System.Threading;
33using System.Reflection; 33using System.Reflection;
34using System.Runtime.Remoting; 34using System.Runtime.Remoting;
35using System.Runtime.Serialization;
36using System.Runtime.Serialization.Formatters.Binary;
35using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
36using OpenSim.Region.Environment.Scenes.Scripting; 38using OpenSim.Region.Environment.Scenes.Scripting;
37using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; 39using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
@@ -267,19 +269,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
267 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); 269 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler();
268 // Compile (We assume LSL) 270 // Compile (We assume LSL)
269 FileName = LSLCompiler.CompileFromLSLText(Script); 271 FileName = LSLCompiler.CompileFromLSLText(Script);
270 Console.WriteLine("Compilation of " + FileName + " done"); 272 //Console.WriteLine("Compilation of " + FileName + " done");
271 // * Insert yield into code 273 // * Insert yield into code
272 FileName = ProcessYield(FileName); 274 FileName = ProcessYield(FileName);
273 275
274 276
275#if DEBUG 277#if DEBUG
276 long before; 278 long before;
277 before = GC.GetTotalMemory(false); 279 before = GC.GetTotalMemory(true);
278#endif 280#endif
279 LSL_BaseClass CompiledScript; 281 LSL_BaseClass CompiledScript;
280 CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); 282 CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
281#if DEBUG 283#if DEBUG
282 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(false) - before); 284 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
283#endif 285#endif
284 286
285 // Add it to our script memstruct 287 // Add it to our script memstruct
@@ -295,13 +297,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
295 CompiledScript.Start(LSLB); 297 CompiledScript.Start(LSLB);
296 298
297 // Fire the first start-event 299 // Fire the first start-event
298 m_scriptEngine.myEventQueueManager.AddToObjectQueue(localID, "state_entry", new object[] { }); 300 m_scriptEngine.myEventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { });
299 301
300 302
301 } 303 }
302 catch (Exception e) 304 catch (Exception e)
303 { 305 {
304 m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); 306 //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString());
305 try 307 try
306 { 308 {
307 // DISPLAY ERROR INWORLD 309 // DISPLAY ERROR INWORLD
@@ -325,6 +327,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
325 // Stop script 327 // Stop script
326 Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); 328 Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
327 329
330
328 // Stop long command on script 331 // Stop long command on script
329 m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID); 332 m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID);
330 333
@@ -332,6 +335,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
332 if (LSLBC == null) 335 if (LSLBC == null)
333 return; 336 return;
334 337
338 // TEMP: First serialize it
339 //GetSerializedScript(localID, itemID);
340
341
335 try 342 try
336 { 343 {
337 // Get AppDomain 344 // Get AppDomain
@@ -382,8 +389,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
382 public void GetSerializedScript(uint localID, LLUUID itemID) 389 public void GetSerializedScript(uint localID, LLUUID itemID)
383 { 390 {
384 // Serialize the script and return it 391 // Serialize the script and return it
385
386 // Should not be a problem 392 // Should not be a problem
393 System.IO.FileStream fs = System.IO.File.Create("SERIALIZED_SCRIPT_" + itemID);
394 BinaryFormatter b = new BinaryFormatter();
395 b.Serialize(fs, GetScript(localID,itemID));
396 fs.Close();
397
398
387 } 399 }
388 public void PutSerializedScript(uint localID, LLUUID itemID) 400 public void PutSerializedScript(uint localID, LLUUID itemID)
389 { 401 {