From 82f0e193494e939d34950dda3dd108c5cfc26124 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 14 Jan 2012 00:44:19 +0000 Subject: Extend scripts show command to accept a single item UUID parameter to display one script's status Usage is now scripts show [] --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 87 ++++++++++++++------------ 1 file changed, 47 insertions(+), 40 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 12e1a78..c9bbf0e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -273,11 +273,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine } MainConsole.Instance.Commands.AddCommand( - "scripts", false, "scripts show", "scripts show", "Show script information", - "Show information on all scripts known to the script engine", HandleShowScripts); + "scripts", false, "scripts show", "scripts show []", "Show script information", + "Show information on all scripts known to the script engine." + + "If a is given then only information on that script will be shown.", + HandleShowScripts); MainConsole.Instance.Commands.AddCommand( - "scripts", false, "show scripts", "show scripts", "Show script information", + "scripts", false, "show scripts", "show scripts []", "Show script information", "Synonym for scripts show command", HandleShowScripts); MainConsole.Instance.Commands.AddCommand( @@ -308,43 +310,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); } - public void HandleShowScripts(string module, string[] cmdparams) - { - lock (m_Scripts) - { - MainConsole.Instance.OutputFormat( - "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName); - - foreach (IScriptInstance instance in m_Scripts.Values) - { - SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); - string status; - - if (instance.ShuttingDown) - { - status = "shutting down"; - } - else if (instance.Suspended) - { - status = "suspended"; - } - else if (!instance.Running) - { - status = "stopped"; - } - else - { - status = "running"; - } - - MainConsole.Instance.OutputFormat( - "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", - instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, - sop.AbsolutePosition, status); - } - } - } - /// /// Parse the raw item id into a script instance from the command params if it's present. /// @@ -394,6 +359,48 @@ namespace OpenSim.Region.ScriptEngine.XEngine } } + public void HandleShowScripts(string module, string[] cmdparams) + { + if (cmdparams.Length == 2) + { + lock (m_Scripts) + { + MainConsole.Instance.OutputFormat( + "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName); + } + } + + HandleScriptsAction(cmdparams, HandleShowScript); + } + + private void HandleShowScript(IScriptInstance instance) + { + SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); + string status; + + if (instance.ShuttingDown) + { + status = "shutting down"; + } + else if (instance.Suspended) + { + status = "suspended"; + } + else if (!instance.Running) + { + status = "stopped"; + } + else + { + status = "running"; + } + + MainConsole.Instance.OutputFormat( + "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", + instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, + sop.AbsolutePosition, status); + } + private void HandleSuspendScript(IScriptInstance instance) { if (!instance.Suspended) -- cgit v1.1