diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 6b83dff..e211902 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
224 | 224 | ||
225 | #region Start/Stop/Reset script | 225 | #region Start/Stop/Reset script |
226 | 226 | ||
227 | Object startStopLock = new Object(); | 227 | private Object startStopLock = new Object(); |
228 | 228 | ||
229 | /// <summary> | 229 | /// <summary> |
230 | /// Fetches, loads and hooks up a script to an objects events | 230 | /// Fetches, loads and hooks up a script to an objects events |
@@ -261,7 +261,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
261 | } | 261 | } |
262 | 262 | ||
263 | // Create a new instance of the compiler (reuse) | 263 | // Create a new instance of the compiler (reuse) |
264 | Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); | 264 | private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); |
265 | |||
265 | private void _StartScript(uint localID, LLUUID itemID, string Script) | 266 | private void _StartScript(uint localID, LLUUID itemID, string Script) |
266 | { | 267 | { |
267 | lock (startStopLock) | 268 | lock (startStopLock) |
@@ -316,7 +317,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
316 | CompiledScript.Start(LSLB); | 317 | CompiledScript.Start(LSLB); |
317 | 318 | ||
318 | // Fire the first start-event | 319 | // Fire the first start-event |
319 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); | 320 | m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {}); |
320 | } | 321 | } |
321 | catch (Exception e) | 322 | catch (Exception e) |
322 | { | 323 | { |
@@ -327,12 +328,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
327 | string text = "Error compiling script:\r\n" + e.Message.ToString(); | 328 | string text = "Error compiling script:\r\n" + e.Message.ToString(); |
328 | if (text.Length > 1500) | 329 | if (text.Length > 1500) |
329 | text = text.Substring(0, 1500); | 330 | text = text.Substring(0, 1500); |
330 | World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | 331 | World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, |
332 | m_host.Name, m_host.UUID); | ||
331 | } | 333 | } |
332 | catch (Exception e2) | 334 | catch (Exception e2) |
333 | { | 335 | { |
334 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); | 336 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); |
335 | m_scriptEngine.Log.Error("ScriptEngine", "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); | 337 | m_scriptEngine.Log.Error("ScriptEngine", |
338 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); | ||
336 | } | 339 | } |
337 | } | 340 | } |
338 | } | 341 | } |
@@ -342,39 +345,39 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
342 | { | 345 | { |
343 | lock (startStopLock) | 346 | lock (startStopLock) |
344 | { | 347 | { |
345 | // Stop script | 348 | // Stop script |
346 | Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); | 349 | Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); |
347 | 350 | ||
348 | 351 | ||
349 | // Stop long command on script | 352 | // Stop long command on script |
350 | m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID); | 353 | m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID); |
351 | 354 | ||
352 | LSL_BaseClass LSLBC = GetScript(localID, itemID); | 355 | LSL_BaseClass LSLBC = GetScript(localID, itemID); |
353 | if (LSLBC == null) | 356 | if (LSLBC == null) |
354 | return; | 357 | return; |
355 | 358 | ||
356 | // TEMP: First serialize it | 359 | // TEMP: First serialize it |
357 | //GetSerializedScript(localID, itemID); | 360 | //GetSerializedScript(localID, itemID); |
358 | 361 | ||
359 | 362 | ||
360 | try | 363 | try |
361 | { | 364 | { |
362 | // Get AppDomain | 365 | // Get AppDomain |
363 | AppDomain ad = LSLBC.Exec.GetAppDomain(); | 366 | AppDomain ad = LSLBC.Exec.GetAppDomain(); |
364 | // Tell script not to accept new requests | 367 | // Tell script not to accept new requests |
365 | GetScript(localID, itemID).Exec.StopScript(); | 368 | GetScript(localID, itemID).Exec.StopScript(); |
366 | // Remove from internal structure | 369 | // Remove from internal structure |
367 | RemoveScript(localID, itemID); | 370 | RemoveScript(localID, itemID); |
368 | // Tell AppDomain that we have stopped script | 371 | // Tell AppDomain that we have stopped script |
369 | m_scriptEngine.m_AppDomainManager.StopScript(ad); | 372 | m_scriptEngine.m_AppDomainManager.StopScript(ad); |
370 | } | 373 | } |
371 | catch (Exception e) | 374 | catch (Exception e) |
372 | { | 375 | { |
373 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + | 376 | Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + |
374 | ": " + e.ToString()); | 377 | ": " + e.ToString()); |
378 | } | ||
375 | } | 379 | } |
376 | } | 380 | } |
377 | } | ||
378 | 381 | ||
379 | private string ProcessYield(string FileName) | 382 | private string ProcessYield(string FileName) |
380 | { | 383 | { |
@@ -435,4 +438,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
435 | 438 | ||
436 | #endregion | 439 | #endregion |
437 | } | 440 | } |
438 | } | 441 | } \ No newline at end of file |