aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs54
1 files changed, 49 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 965101a..828f2fb 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
304 304
305 MainConsole.Instance.Commands.AddCommand( 305 MainConsole.Instance.Commands.AddCommand(
306 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information", 306 "Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
307 "Show information on all scripts known to the script engine." 307 "Show information on all scripts known to the script engine.\n"
308 + "If a <script-item-uuid> is given then only information on that script will be shown.", 308 + "If a <script-item-uuid> is given then only information on that script will be shown.",
309 HandleShowScripts); 309 HandleShowScripts);
310 310
@@ -323,22 +323,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine
323 MainConsole.Instance.Commands.AddCommand( 323 MainConsole.Instance.Commands.AddCommand(
324 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts", 324 "Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts",
325 "Resumes all currently suspended scripts.\n" 325 "Resumes all currently suspended scripts.\n"
326 + "Resumed scripts will process all events accumulated whilst suspended." 326 + "Resumed scripts will process all events accumulated whilst suspended.\n"
327 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.", 327 + "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
328 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript)); 328 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript));
329 329
330 MainConsole.Instance.Commands.AddCommand( 330 MainConsole.Instance.Commands.AddCommand(
331 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts", 331 "Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts",
332 "Stops all running scripts." 332 "Stops all running scripts.\n"
333 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.", 333 + "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
334 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript)); 334 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript));
335 335
336 MainConsole.Instance.Commands.AddCommand( 336 MainConsole.Instance.Commands.AddCommand(
337 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts", 337 "Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts",
338 "Starts all stopped scripts." 338 "Starts all stopped scripts.\n"
339 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", 339 + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
340 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 340 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
341 341
342 MainConsole.Instance.Commands.AddCommand(
343 "Scripts", false, "debug script log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script",
344 "Activates or deactivates extra debug logging for the given script.\n"
345 + "Level == 0, deactivate extra debug logging.\n"
346 + "Level >= 1, log state changes.\n"
347 + "Level >= 2, log event invocations.\n",
348 HandleDebugScriptLogCommand);
349
342// MainConsole.Instance.Commands.AddCommand( 350// MainConsole.Instance.Commands.AddCommand(
343// "Debug", false, "debug xengine", "debug xengine [<level>]", 351// "Debug", false, "debug xengine", "debug xengine [<level>]",
344// "Turn on detailed xengine debugging.", 352// "Turn on detailed xengine debugging.",
@@ -347,6 +355,41 @@ namespace OpenSim.Region.ScriptEngine.XEngine
347// HandleDebugLevelCommand); 355// HandleDebugLevelCommand);
348 } 356 }
349 357
358 private void HandleDebugScriptLogCommand(string module, string[] args)
359 {
360 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
361 return;
362
363 if (args.Length != 5)
364 {
365 MainConsole.Instance.Output("Usage: debug script log <item-id> <log-level>");
366 return;
367 }
368
369 UUID itemId;
370
371 if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, args[3], out itemId))
372 return;
373
374 int newLevel;
375
376 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out newLevel))
377 return;
378
379 IScriptInstance si;
380
381 lock (m_Scripts)
382 {
383 // XXX: We can't give the user feedback on a bad item id because this may apply to a different script
384 // engine
385 if (!m_Scripts.TryGetValue(itemId, out si))
386 return;
387 }
388
389 si.DebugLevel = newLevel;
390 MainConsole.Instance.OutputFormat("Set debug level of {0} {1} to {2}", si.ScriptName, si.ItemID, newLevel);
391 }
392
350 /// <summary> 393 /// <summary>
351 /// Change debug level 394 /// Change debug level
352 /// </summary> 395 /// </summary>
@@ -418,7 +461,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
418 461
419 if (!UUID.TryParse(rawItemId, out itemId)) 462 if (!UUID.TryParse(rawItemId, out itemId))
420 { 463 {
421 MainConsole.Instance.OutputFormat("Error - {0} is not a valid UUID", rawItemId); 464 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid UUID", rawItemId);
422 return; 465 return;
423 } 466 }
424 467
@@ -542,6 +585,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
542 sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued); 585 sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued);
543 sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed); 586 sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed);
544 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); 587 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID);
588 sb.AppendFormat("Asset UUID : {0}\n", instance.AssetID);
545 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); 589 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName);
546 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID); 590 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
547 sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition); 591 sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition);