diff --git a/Programs/examples/TestClient/ClientManager.cs b/Programs/examples/TestClient/ClientManager.cs index 0bbc21a0..26f7e35a 100644 --- a/Programs/examples/TestClient/ClientManager.cs +++ b/Programs/examples/TestClient/ClientManager.cs @@ -198,6 +198,9 @@ namespace OpenMetaverse.TestClient string[] tokens = cmd.Trim().Split(new char[] { ' ', '\t' }); string firstToken = tokens[0].ToLower(); + string[] args = new string[tokens.Length - 1]; + Array.Copy(tokens, 1, args, 0, args.Length); + if (tokens.Length == 0) return; @@ -205,8 +208,7 @@ namespace OpenMetaverse.TestClient { // Special login case: Only call it once, and allow it with // no logged in avatars - string[] args = new string[tokens.Length - 1]; - Array.Copy(tokens, 1, args, 0, args.Length); + Login(args); } else if (firstToken == "quit") @@ -214,6 +216,19 @@ namespace OpenMetaverse.TestClient Quit(); Logger.Log("All clients logged out and program finished running.", Helpers.LogLevel.Info); } + else if (firstToken == "help") + { + // No reason to pass this to all bots, and we also want to allow it when there are no bots + HelpCommand command = new HelpCommand(null); + command.Client = new TestClient(this); + Console.WriteLine(command.Execute(args, UUID.Zero)); + } + else if (firstToken == "script") + { + // No reason to pass this to all bots, and we also want to allow it when there are no bots + ScriptCommand command = new ScriptCommand(null); + Logger.Log(command.Execute(args, UUID.Zero), Helpers.LogLevel.Info); + } else { // Make an immutable copy of the Clients dictionary to safely iterate over diff --git a/Programs/examples/TestClient/TestClient.cs b/Programs/examples/TestClient/TestClient.cs index ef4ed153..6c175bfe 100644 --- a/Programs/examples/TestClient/TestClient.cs +++ b/Programs/examples/TestClient/TestClient.cs @@ -137,6 +137,9 @@ namespace OpenMetaverse.TestClient return; string firstToken = tokens[0].ToLower(); + + string[] args = new string[tokens.Length - 1]; + Array.Copy(tokens, 1, args, 0, args.Length); // "all balance" will send the balance command to all currently logged in bots if (firstToken == "all" && tokens.Length > 1) @@ -153,8 +156,6 @@ namespace OpenMetaverse.TestClient { // Special login case: Only call it once, and allow it with // no logged in avatars - string[] args = new string[tokens.Length - 1]; - Array.Copy(tokens, 1, args, 0, args.Length); ClientManager.Login(args); } else if (firstToken == "quit") @@ -162,10 +163,13 @@ namespace OpenMetaverse.TestClient ClientManager.Quit(); Logger.Log("All clients logged out and program finished running.", Helpers.LogLevel.Info); } + else if (firstToken == "script") + { + // Execute only once + Commands[firstToken].Execute(args, fromAgentID); + } else if (Commands.ContainsKey(firstToken)) { - string[] args = new string[tokens.Length - 1]; - Array.Copy(tokens, 1, args, 0, args.Length); string response = Commands[firstToken].Execute(args, fromAgentID); if (!String.IsNullOrEmpty(response))