diff options
author | Tedd Hansen | 2007-08-28 18:22:48 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-08-28 18:22:48 +0000 |
commit | 5a149084d4429a327b4fb3b9a97ced462653621c (patch) | |
tree | e25894fa74c81dbf45d84a9aa403afe9c4f6c3be /OpenSim | |
parent | As part of our "we aim to please" commitment, have added the ability to creat... (diff) | |
download | opensim-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 'OpenSim')
4 files changed, 19 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs index 63e1844..14343b1 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs | |||
@@ -128,7 +128,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
128 | // Remove from internal list | 128 | // Remove from internal list |
129 | AppDomains.Remove(ads); | 129 | AppDomains.Remove(ads); |
130 | #if DEBUG | 130 | #if DEBUG |
131 | |||
132 | long m = GC.GetTotalMemory(true); | 131 | long m = GC.GetTotalMemory(true); |
133 | #endif | 132 | #endif |
134 | // Unload | 133 | // Unload |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index d57b9eb..90004b5 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -13,6 +13,7 @@ using rotation = OpenSim.Region.ScriptEngine.Common.LSL_Types.Quaternion; | |||
13 | 13 | ||
14 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 14 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
15 | { | 15 | { |
16 | //[Serializable] | ||
16 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript | 17 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript |
17 | { | 18 | { |
18 | 19 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 9c8c29a..61a43e4 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs | |||
@@ -67,10 +67,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
67 | } | 67 | } |
68 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 68 | public void OnRezScript(uint localID, LLUUID itemID, string script) |
69 | { | 69 | { |
70 | // TODO: Add code to compile script and wire up script to object | ||
71 | // Either the script is a stand-alone entity with a reference to public host, | ||
72 | // Or the host has a reference to the script because it was in its inventory. | ||
73 | |||
74 | //myScriptEngine.myScriptManager.StartScript( | 70 | //myScriptEngine.myScriptManager.StartScript( |
75 | // Path.Combine("ScriptEngines", "Default.lsl"), | 71 | // Path.Combine("ScriptEngines", "Default.lsl"), |
76 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() | 72 | // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() |
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; | |||
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Runtime.Remoting; | 34 | using System.Runtime.Remoting; |
35 | using System.Runtime.Serialization; | ||
36 | using System.Runtime.Serialization.Formatters.Binary; | ||
35 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
36 | using OpenSim.Region.Environment.Scenes.Scripting; | 38 | using OpenSim.Region.Environment.Scenes.Scripting; |
37 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 39 | using 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 | { |