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.cs50
1 files changed, 25 insertions, 25 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 7129c8a..9d72b1c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
88 88
89 // The following is for setting a minimum delay between events 89 // The following is for setting a minimum delay between events
90 private double m_minEventDelay; 90 private double m_minEventDelay;
91 91
92 private long m_eventDelayTicks; 92 private long m_eventDelayTicks;
93 private long m_nextEventTimeTicks; 93 private long m_nextEventTimeTicks;
94 private bool m_startOnInit = true; 94 private bool m_startOnInit = true;
@@ -122,7 +122,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
122 { 122 {
123 if (value > 0.001) 123 if (value > 0.001)
124 m_minEventDelay = value; 124 m_minEventDelay = value;
125 else 125 else
126 m_minEventDelay = 0.0; 126 m_minEventDelay = 0.0;
127 127
128 m_eventDelayTicks = (long)(m_minEventDelay * 10000000L); 128 m_eventDelayTicks = (long)(m_minEventDelay * 10000000L);
@@ -154,7 +154,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
154 { 154 {
155 bool wasSuspended = m_Suspended; 155 bool wasSuspended = m_Suspended;
156 m_Suspended = value; 156 m_Suspended = value;
157 157
158 if (wasSuspended && !m_Suspended) 158 if (wasSuspended && !m_Suspended)
159 { 159 {
160 lock (EventQueue) 160 lock (EventQueue)
@@ -201,11 +201,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
201 201
202 public long EventsQueued 202 public long EventsQueued
203 { 203 {
204 get 204 get
205 { 205 {
206 lock (EventQueue) 206 lock (EventQueue)
207 return EventQueue.Count; 207 return EventQueue.Count;
208 } 208 }
209 } 209 }
210 210
211 public long EventsProcessed { get; private set; } 211 public long EventsProcessed { get; private set; }
@@ -221,7 +221,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
221 private static readonly int MeasurementWindow = 30 * 1000; // show the *recent* time used by the script, to find currently active scripts 221 private static readonly int MeasurementWindow = 30 * 1000; // show the *recent* time used by the script, to find currently active scripts
222 222
223 private bool m_coopTermination; 223 private bool m_coopTermination;
224 224
225 private EventWaitHandle m_coopSleepHandle; 225 private EventWaitHandle m_coopSleepHandle;
226 226
227 public void ClearQueue() 227 public void ClearQueue()
@@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
281 /// <param name='stateSource'></param> 281 /// <param name='stateSource'></param>
282 /// <returns>false if load failed, true if suceeded</returns> 282 /// <returns>false if load failed, true if suceeded</returns>
283 public bool Load( 283 public bool Load(
284 IScript script, EventWaitHandle coopSleepHandle, string assemblyPath, 284 IScript script, EventWaitHandle coopSleepHandle, string assemblyPath,
285 string dataPath, StateSource stateSource, bool coopTermination) 285 string dataPath, StateSource stateSource, bool coopTermination)
286 { 286 {
287 m_Script = script; 287 m_Script = script;
@@ -324,13 +324,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
324 return false; 324 return false;
325 } 325 }
326 326
327 // For attachments, XEngine saves the state into a .state file when XEngine.SetXMLState() is called. 327 // For attachments, XEngine saves the state into a .state file when XEngine.SetXMLState() is called.
328 string savedState = Path.Combine(m_dataPath, ItemID.ToString() + ".state"); 328 string savedState = Path.Combine(m_dataPath, ItemID.ToString() + ".state");
329 329
330 if (File.Exists(savedState)) 330 if (File.Exists(savedState))
331 { 331 {
332 // m_log.DebugFormat( 332 // m_log.DebugFormat(
333 // "[SCRIPT INSTANCE]: Found state for script {0} for {1} ({2}) at {3} in {4}", 333 // "[SCRIPT INSTANCE]: Found state for script {0} for {1} ({2}) at {3} in {4}",
334 // ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name); 334 // ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name);
335 335
336 string xml = String.Empty; 336 string xml = String.Empty;
@@ -395,7 +395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
395 // else 395 // else
396 // { 396 // {
397 // m_log.DebugFormat( 397 // m_log.DebugFormat(
398 // "[SCRIPT INSTANCE]: Did not find state for script {0} for {1} ({2}) at {3} in {4}", 398 // "[SCRIPT INSTANCE]: Did not find state for script {0} for {1} ({2}) at {3} in {4}",
399 // ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name); 399 // ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name);
400 // } 400 // }
401 401
@@ -407,11 +407,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
407 if (ShuttingDown) 407 if (ShuttingDown)
408 return; 408 return;
409 409
410 if (m_startedFromSavedState) 410 if (m_startedFromSavedState)
411 { 411 {
412 if (m_startOnInit) 412 if (m_startOnInit)
413 Start(); 413 Start();
414 if (m_postOnRez) 414 if (m_postOnRez)
415 { 415 {
416 PostEvent(new EventParams("on_rez", 416 PostEvent(new EventParams("on_rez",
417 new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0])); 417 new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
@@ -439,13 +439,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
439 new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0])); 439 new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0]));
440 } 440 }
441 } 441 }
442 else 442 else
443 { 443 {
444 if (m_startOnInit) 444 if (m_startOnInit)
445 Start(); 445 Start();
446 PostEvent(new EventParams("state_entry", 446 PostEvent(new EventParams("state_entry",
447 new Object[0], new DetectParams[0])); 447 new Object[0], new DetectParams[0]));
448 if (m_postOnRez) 448 if (m_postOnRez)
449 { 449 {
450 PostEvent(new EventParams("on_rez", 450 PostEvent(new EventParams("on_rez",
451 new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0])); 451 new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
@@ -462,7 +462,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
462 private void ReleaseControls() 462 private void ReleaseControls()
463 { 463 {
464 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); 464 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
465 465
466 if (part != null) 466 if (part != null)
467 { 467 {
468 int permsMask; 468 int permsMask;
@@ -508,8 +508,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
508 { 508 {
509 m_log.Warn( 509 m_log.Warn(
510 string.Format( 510 string.Format(
511 "[SCRIPT INSTANCE]: Could not delete script state {0} for script {1} (id {2}) in part {3} (id {4}) in object {5} in {6}. Exception ", 511 "[SCRIPT INSTANCE]: Could not delete script state {0} for script {1} (id {2}) in part {3} (id {4}) in object {5} in {6}. Exception ",
512 savedState, ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name), 512 savedState, ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name),
513 e); 513 e);
514 } 514 }
515 } 515 }
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
631 if (!m_InSelfDelete) 631 if (!m_InSelfDelete)
632 { 632 {
633 m_log.DebugFormat( 633 m_log.DebugFormat(
634 "[SCRIPT INSTANCE]: Aborting unstopped script {0} {1} in prim {2}, localID {3}, timeout was {4} ms", 634 "[SCRIPT INSTANCE]: Aborting unstopped script {0} {1} in prim {2}, localID {3}, timeout was {4} ms",
635 ScriptName, ItemID, PrimName, LocalID, timeout); 635 ScriptName, ItemID, PrimName, LocalID, timeout);
636 636
637 workItem.Abort(); 637 workItem.Abort();
@@ -709,7 +709,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
709 lock (EventQueue) 709 lock (EventQueue)
710 { 710 {
711 // The only events that persist across state changes are timers 711 // The only events that persist across state changes are timers
712 if (m_StateChangeInProgress && data.EventName != "timer") 712 if (m_StateChangeInProgress && data.EventName != "timer")
713 return; 713 return;
714 714
715 if (EventQueue.Count >= m_MaxScriptQueue) 715 if (EventQueue.Count >= m_MaxScriptQueue)
@@ -784,7 +784,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
784 return 0; 784 return 0;
785 785
786 ExecutionTimer.Restart(); 786 ExecutionTimer.Restart();
787 787
788 try 788 try
789 { 789 {
790 return EventProcessorInt(); 790 return EventProcessorInt();
@@ -927,7 +927,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
927 927
928 if(e.InnerException != null && e.InnerException is ScriptException) 928 if(e.InnerException != null && e.InnerException is ScriptException)
929 { 929 {
930 string text = e.InnerException.Message + 930 string text = e.InnerException.Message +
931 "(script: " + ScriptName + 931 "(script: " + ScriptName +
932 " event: " + data.EventName + 932 " event: " + data.EventName +
933 " at " + Part.AbsolutePosition + ")"; 933 " at " + Part.AbsolutePosition + ")";
@@ -945,10 +945,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
945 Part.UUID, 945 Part.UUID,
946 Part.AbsolutePosition, 946 Part.AbsolutePosition,
947 Part.ParentGroup.Scene.Name)); 947 Part.ParentGroup.Scene.Name));
948 948
949 } 949 }
950 else 950 else
951 { 951 {
952 952
953 // DISPLAY ERROR INWORLD 953 // DISPLAY ERROR INWORLD
954 string text = FormatException(e); 954 string text = FormatException(e);
@@ -1217,7 +1217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1217 1217
1218 return null; 1218 return null;
1219 } 1219 }
1220 1220
1221 public override string ToString() 1221 public override string ToString()
1222 { 1222 {
1223 return String.Format("{0} {1} on {2}", ScriptName, ItemID, PrimName); 1223 return String.Format("{0} {1} on {2}", ScriptName, ItemID, PrimName);