aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Instance
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-12-12 23:13:34 +0000
committerJustin Clark-Casey (justincc)2012-12-12 23:13:34 +0000
commit047270bdc83d029486215a418fada27b225dbab0 (patch)
tree8bb1b091b67d322a56ae1d25bb5511a23369c03a /OpenSim/Region/ScriptEngine/Shared/Instance
parentAdd asset id to "show script" and "show scripts" command output to make it ea... (diff)
downloadopensim-SC_OLD-047270bdc83d029486215a418fada27b225dbab0.zip
opensim-SC_OLD-047270bdc83d029486215a418fada27b225dbab0.tar.gz
opensim-SC_OLD-047270bdc83d029486215a418fada27b225dbab0.tar.bz2
opensim-SC_OLD-047270bdc83d029486215a418fada27b225dbab0.tar.xz
Add "debug script log" command to allow setting a numeric debug level on individual IScriptInstances for debugging purposes.
Current, state changes and event fires can be logged for individual scripts. See command help for more details.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs37
1 files changed, 29 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 5ad6eeb..435e9dc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -93,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
93 private UUID m_CurrentStateHash; 93 private UUID m_CurrentStateHash;
94 private UUID m_RegionID; 94 private UUID m_RegionID;
95 95
96 public int DebugLevel { get; set; }
97
96 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } 98 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
97 99
98 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); 100 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@@ -703,21 +705,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
703 if (data.EventName == "collision") 705 if (data.EventName == "collision")
704 m_CollisionInQueue = false; 706 m_CollisionInQueue = false;
705 } 707 }
706 708
707// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this); 709 SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
710
711 if (DebugLevel >= 2)
712 m_log.DebugFormat(
713 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
714 data.EventName,
715 ScriptName,
716 part.Name,
717 part.LocalId,
718 part.ParentGroup.Name,
719 part.ParentGroup.UUID,
720 part.AbsolutePosition,
721 part.ParentGroup.Scene.Name);
708 722
709 m_DetectParams = data.DetectParams; 723 m_DetectParams = data.DetectParams;
710 724
711 if (data.EventName == "state") // Hardcoded state change 725 if (data.EventName == "state") // Hardcoded state change
712 { 726 {
713 // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
714 // PrimName, ScriptName, data.Params[0].ToString());
715 State = data.Params[0].ToString(); 727 State = data.Params[0].ToString();
728
729 if (DebugLevel >= 1)
730 m_log.DebugFormat(
731 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
732 State,
733 ScriptName,
734 part.Name,
735 part.LocalId,
736 part.ParentGroup.Name,
737 part.ParentGroup.UUID,
738 part.AbsolutePosition,
739 part.ParentGroup.Scene.Name);
740
716 AsyncCommandManager.RemoveScript(Engine, 741 AsyncCommandManager.RemoveScript(Engine,
717 LocalID, ItemID); 742 LocalID, ItemID);
718 743
719 SceneObjectPart part = Engine.World.GetSceneObjectPart(
720 LocalID);
721 if (part != null) 744 if (part != null)
722 { 745 {
723 part.SetScriptEvents(ItemID, 746 part.SetScriptEvents(ItemID,
@@ -729,8 +752,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
729 if (Engine.World.PipeEventsForScript(LocalID) || 752 if (Engine.World.PipeEventsForScript(LocalID) ||
730 data.EventName == "control") // Don't freeze avies! 753 data.EventName == "control") // Don't freeze avies!
731 { 754 {
732 SceneObjectPart part = Engine.World.GetSceneObjectPart(
733 LocalID);
734 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 755 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
735 // PrimName, ScriptName, data.EventName, State); 756 // PrimName, ScriptName, data.EventName, State);
736 757