aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-14 00:44:19 +0000
committerJustin Clark-Casey (justincc)2012-01-14 00:44:19 +0000
commit82f0e193494e939d34950dda3dd108c5cfc26124 (patch)
treef28716aeb431adaae22f8efe33bc51c3a86857f3 /OpenSim
parentRegister the UrlModule for script engine events OnScriptRemoved and OnObjectR... (diff)
downloadopensim-SC_OLD-82f0e193494e939d34950dda3dd108c5cfc26124.zip
opensim-SC_OLD-82f0e193494e939d34950dda3dd108c5cfc26124.tar.gz
opensim-SC_OLD-82f0e193494e939d34950dda3dd108c5cfc26124.tar.bz2
opensim-SC_OLD-82f0e193494e939d34950dda3dd108c5cfc26124.tar.xz
Extend scripts show command to accept a single item UUID parameter to display one script's status
Usage is now scripts show [<script-item-uuid>]
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs87
1 files changed, 47 insertions, 40 deletions
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
273 } 273 }
274 274
275 MainConsole.Instance.Commands.AddCommand( 275 MainConsole.Instance.Commands.AddCommand(
276 "scripts", false, "scripts show", "scripts show", "Show script information", 276 "scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
277 "Show information on all scripts known to the script engine", HandleShowScripts); 277 "Show information on all scripts known to the script engine."
278 + "If a <script-item-uuid> is given then only information on that script will be shown.",
279 HandleShowScripts);
278 280
279 MainConsole.Instance.Commands.AddCommand( 281 MainConsole.Instance.Commands.AddCommand(
280 "scripts", false, "show scripts", "show scripts", "Show script information", 282 "scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information",
281 "Synonym for scripts show command", HandleShowScripts); 283 "Synonym for scripts show command", HandleShowScripts);
282 284
283 MainConsole.Instance.Commands.AddCommand( 285 MainConsole.Instance.Commands.AddCommand(
@@ -308,43 +310,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
308 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 310 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
309 } 311 }
310 312
311 public void HandleShowScripts(string module, string[] cmdparams)
312 {
313 lock (m_Scripts)
314 {
315 MainConsole.Instance.OutputFormat(
316 "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName);
317
318 foreach (IScriptInstance instance in m_Scripts.Values)
319 {
320 SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
321 string status;
322
323 if (instance.ShuttingDown)
324 {
325 status = "shutting down";
326 }
327 else if (instance.Suspended)
328 {
329 status = "suspended";
330 }
331 else if (!instance.Running)
332 {
333 status = "stopped";
334 }
335 else
336 {
337 status = "running";
338 }
339
340 MainConsole.Instance.OutputFormat(
341 "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})",
342 instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID,
343 sop.AbsolutePosition, status);
344 }
345 }
346 }
347
348 /// <summary> 313 /// <summary>
349 /// Parse the raw item id into a script instance from the command params if it's present. 314 /// Parse the raw item id into a script instance from the command params if it's present.
350 /// </summary> 315 /// </summary>
@@ -394,6 +359,48 @@ namespace OpenSim.Region.ScriptEngine.XEngine
394 } 359 }
395 } 360 }
396 361
362 public void HandleShowScripts(string module, string[] cmdparams)
363 {
364 if (cmdparams.Length == 2)
365 {
366 lock (m_Scripts)
367 {
368 MainConsole.Instance.OutputFormat(
369 "Showing {0} scripts in {1}", m_Scripts.Count, m_Scene.RegionInfo.RegionName);
370 }
371 }
372
373 HandleScriptsAction(cmdparams, HandleShowScript);
374 }
375
376 private void HandleShowScript(IScriptInstance instance)
377 {
378 SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
379 string status;
380
381 if (instance.ShuttingDown)
382 {
383 status = "shutting down";
384 }
385 else if (instance.Suspended)
386 {
387 status = "suspended";
388 }
389 else if (!instance.Running)
390 {
391 status = "stopped";
392 }
393 else
394 {
395 status = "running";
396 }
397
398 MainConsole.Instance.OutputFormat(
399 "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})",
400 instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID,
401 sop.AbsolutePosition, status);
402 }
403
397 private void HandleSuspendScript(IScriptInstance instance) 404 private void HandleSuspendScript(IScriptInstance instance)
398 { 405 {
399 if (!instance.Suspended) 406 if (!instance.Suspended)