aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs69
1 files changed, 38 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 05dd7ab..34fcf0c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -237,6 +237,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
237 } 237 }
238 } 238 }
239 239
240 private ScriptEngineConsoleCommands m_consoleCommands;
241
240 public string ScriptEngineName 242 public string ScriptEngineName
241 { 243 {
242 get { return "XEngine"; } 244 get { return "XEngine"; }
@@ -386,50 +388,53 @@ namespace OpenSim.Region.ScriptEngine.XEngine
386 OnObjectRemoved += m_XmlRpcRouter.ObjectRemoved; 388 OnObjectRemoved += m_XmlRpcRouter.ObjectRemoved;
387 } 389 }
388 390
391 m_consoleCommands = new ScriptEngineConsoleCommands(this);
392 m_consoleCommands.RegisterCommands();
393
389 MainConsole.Instance.Commands.AddCommand( 394 MainConsole.Instance.Commands.AddCommand(
390 "Scripts", false, "xengine status", "xengine status", "Show status information", 395 "Scripts", false, "xengine status", "xengine status", "Show status information",
391 "Show status information on the script engine.", 396 "Show status information on the script engine.",
392 HandleShowStatus); 397 HandleShowStatus);
393 398
394 MainConsole.Instance.Commands.AddCommand( 399 MainConsole.Instance.Commands.AddCommand(
395 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", 400 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>+]", "Show script information",
396 "Show information on all scripts known to the script engine.\n" 401 "Show information on all scripts known to the script engine.\n"
397 + "If a <script-item-uuid> is given then only information on that script will be shown.", 402 + "If one or more <script-item-uuid>s are given then only information on that script will be shown.",
398 HandleShowScripts); 403 HandleShowScripts);
399 404
400 MainConsole.Instance.Commands.AddCommand( 405 MainConsole.Instance.Commands.AddCommand(
401 "Scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information", 406 "Scripts", false, "show scripts", "show scripts [<script-item-uuid>+]", "Show script information",
402 "Synonym for scripts show command", HandleShowScripts); 407 "Synonym for scripts show command", HandleShowScripts);
403 408
404 MainConsole.Instance.Commands.AddCommand( 409 MainConsole.Instance.Commands.AddCommand(
405 "Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts", 410 "Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>+]", "Suspends all running scripts",
406 "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a" 411 "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a"
407 + " script that is currently processing an event.\n" 412 + " script that is currently processing an event.\n"
408 + "Suspended scripts will continue to accumulate events but won't process them.\n" 413 + "Suspended scripts will continue to accumulate events but won't process them.\n"
409 + "If a <script-item-uuid> is given then only that script will be suspended. Otherwise, all suitable scripts are suspended.", 414 + "If one or more <script-item-uuid>s are given then only that script will be suspended. Otherwise, all suitable scripts are suspended.",
410 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript)); 415 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript));
411 416
412 MainConsole.Instance.Commands.AddCommand( 417 MainConsole.Instance.Commands.AddCommand(
413 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts", 418 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>+]", "Resumes all suspended scripts",
414 "Resumes all currently suspended scripts.\n" 419 "Resumes all currently suspended scripts.\n"
415 + "Resumed scripts will process all events accumulated whilst suspended.\n" 420 + "Resumed scripts will process all events accumulated whilst suspended.\n"
416 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.", 421 + "If one or more <script-item-uuid>s are given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
417 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript)); 422 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript));
418 423
419 MainConsole.Instance.Commands.AddCommand( 424 MainConsole.Instance.Commands.AddCommand(
420 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts", 425 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>+]", "Stops all running scripts",
421 "Stops all running scripts.\n" 426 "Stops all running scripts.\n"
422 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.", 427 + "If one or more <script-item-uuid>s are given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
423 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript)); 428 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript));
424 429
425 MainConsole.Instance.Commands.AddCommand( 430 MainConsole.Instance.Commands.AddCommand(
426 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts", 431 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>+]", "Starts all stopped scripts",
427 "Starts all stopped scripts.\n" 432 "Starts all stopped scripts.\n"
428 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", 433 + "If one or more <script-item-uuid>s are given then only that script will be started. Otherwise, all suitable scripts are started.",
429 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 434 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
430 435
431 MainConsole.Instance.Commands.AddCommand( 436 MainConsole.Instance.Commands.AddCommand(
432 "Scripts", false, "debug script log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script", 437 "Scripts", false, "debug scripts log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script",
433 "Activates or deactivates extra debug logging for the given script.\n" 438 "Activates or deactivates extra debug logging for the given script.\n"
434 + "Level == 0, deactivate extra debug logging.\n" 439 + "Level == 0, deactivate extra debug logging.\n"
435 + "Level >= 1, log state changes.\n" 440 + "Level >= 1, log state changes.\n"
@@ -546,29 +551,31 @@ namespace OpenSim.Region.ScriptEngine.XEngine
546 return; 551 return;
547 } 552 }
548 553
549 rawItemId = cmdparams[2]; 554 for (int i = 2; i < cmdparams.Length; i++)
550
551 if (!UUID.TryParse(rawItemId, out itemId))
552 { 555 {
553 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid UUID", rawItemId); 556 rawItemId = cmdparams[i];
554 return; 557
555 } 558 if (!UUID.TryParse(rawItemId, out itemId))
556
557 if (itemId != UUID.Zero)
558 {
559 IScriptInstance instance = GetInstance(itemId);
560 if (instance == null)
561 { 559 {
562 // Commented out for now since this will cause false reports on simulators with more than 560 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid UUID", rawItemId);
563 // one scene where the current command line set region is 'root' (which causes commands to 561 continue;
564 // go to both regions... (sigh)
565// MainConsole.Instance.OutputFormat("Error - No item found with id {0}", itemId);
566 return;
567 } 562 }
568 else 563
564 if (itemId != UUID.Zero)
569 { 565 {
570 action(instance); 566 IScriptInstance instance = GetInstance(itemId);
571 return; 567 if (instance == null)
568 {
569 // Commented out for now since this will cause false reports on simulators with more than
570 // one scene where the current command line set region is 'root' (which causes commands to
571 // go to both regions... (sigh)
572 // MainConsole.Instance.OutputFormat("Error - No item found with id {0}", itemId);
573 continue;
574 }
575 else
576 {
577 action(instance);
578 }
572 } 579 }
573 } 580 }
574 } 581 }