aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs31
1 files changed, 24 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 5e68d69..3797683 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -121,6 +121,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
121 121
122 public bool Running { get; set; } 122 public bool Running { get; set; }
123 123
124 public bool Run { get; set; }
125
124 public bool Suspended 126 public bool Suspended
125 { 127 {
126 get { return m_Suspended; } 128 get { return m_Suspended; }
@@ -216,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
216 m_postOnRez = postOnRez; 218 m_postOnRez = postOnRez;
217 m_AttachedAvatar = part.ParentGroup.AttachedAvatar; 219 m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
218 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; 220 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
221 Run = true;
219 222
220 if (part != null) 223 if (part != null)
221 { 224 {
@@ -232,7 +235,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
232 foreach (string api in am.GetApis()) 235 foreach (string api in am.GetApis())
233 { 236 {
234 m_Apis[api] = am.CreateApi(api); 237 m_Apis[api] = am.CreateApi(api);
235 m_Apis[api].Initialize(engine, part, LocalID, itemID); 238 m_Apis[api].Initialize(engine, part, ScriptTask);
236 } 239 }
237 240
238 try 241 try
@@ -330,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
330 } 333 }
331 else 334 else
332 { 335 {
333 m_log.ErrorFormat( 336 m_log.WarnFormat(
334 "[SCRIPT INSTANCE]: Unable to load script state from assembly {0}: Memory limit exceeded", 337 "[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). Memory limit exceeded",
335 assembly); 338 savedState, ScriptName, ItemID, PrimName, ObjectID, assembly);
336 } 339 }
337 } 340 }
338 catch (Exception e) 341 catch (Exception e)
339 { 342 {
340 m_log.ErrorFormat( 343 m_log.ErrorFormat(
341 "[SCRIPT INSTANCE]: Unable to load script state from assembly {0}. XML is {1}. Exception {2}{3}", 344 "[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). XML is {6}. Exception {7}{8}",
342 assembly, xml, e.Message, e.StackTrace); 345 savedState, ScriptName, ItemID, PrimName, ObjectID, assembly, xml, e.Message, e.StackTrace);
343 } 346 }
344 } 347 }
345// else 348// else
@@ -354,10 +357,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
354 357
355 public void Init() 358 public void Init()
356 { 359 {
357 if (!m_startOnInit) return; 360 if (!m_startOnInit)
361 return;
358 362
359 if (m_startedFromSavedState) 363 if (m_startedFromSavedState)
360 { 364 {
365 if (!Run)
366 return;
367
361 Start(); 368 Start();
362 if (m_postOnRez) 369 if (m_postOnRez)
363 { 370 {
@@ -390,6 +397,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
390 } 397 }
391 else 398 else
392 { 399 {
400 if (!Run)
401 return;
402
393 Start(); 403 Start();
394 PostEvent(new EventParams("state_entry", 404 PostEvent(new EventParams("state_entry",
395 new Object[0], new DetectParams[0])); 405 new Object[0], new DetectParams[0]));
@@ -966,7 +976,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
966 public IScriptApi GetApi(string name) 976 public IScriptApi GetApi(string name)
967 { 977 {
968 if (m_Apis.ContainsKey(name)) 978 if (m_Apis.ContainsKey(name))
979 {
980// m_log.DebugFormat("[SCRIPT INSTANCE]: Found api {0} in {1}@{2}", name, ScriptName, PrimName);
981
969 return m_Apis[name]; 982 return m_Apis[name];
983 }
984
985// m_log.DebugFormat("[SCRIPT INSTANCE]: Did not find api {0} in {1}@{2}", name, ScriptName, PrimName);
986
970 return null; 987 return null;
971 } 988 }
972 989