diff --git a/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs index 70ee4468..dd446156 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs @@ -11,7 +11,7 @@ namespace libsecondlife.TestClient public FollowCommand() { Name = "follow"; - Description = "Follow another avatar. (usage: follow FirstName LastName)"; + Description = "Follow another avatar. (usage: follow [FirstName LastName]) If no target is set then will follow master."; } public override string Execute(SecondLife Client, string[] args, LLUUID fromAgentID) @@ -20,6 +20,9 @@ namespace libsecondlife.TestClient for (int ct = 0; ct < args.Length;ct++) target = target + args[ct] + " "; target = target.TrimEnd(); + + if (target.Length == 0) + target = TestClient.Master; if (Follow(target)) return "Following " + target; @@ -50,13 +53,13 @@ namespace libsecondlife.TestClient { if (vecDist(followAvatar.Position, Client.Self.Position) > DISTANCE_BUFFER) { - if (followAvatar.CurrentRegion.GridRegionData != null) - { - // move toward target - ulong x = (ulong)(followAvatar.Position.X + (followAvatar.CurrentRegion.GridRegionData.X * 256)); - ulong y = (ulong)(followAvatar.Position.Y + (followAvatar.CurrentRegion.GridRegionData.Y * 256)); - Client.Self.AutoPilotLocal(Convert.ToInt32(followAvatar.Position.X), Convert.ToInt32(followAvatar.Position.Y), followAvatar.Position.Z); - } + //move toward target + if (followAvatar.CurrentRegion.GridRegionData != null) + { + ulong x = (ulong)(followAvatar.Position.X + (followAvatar.CurrentRegion.GridRegionData.X * 256)); + ulong y = (ulong)(followAvatar.Position.Y + (followAvatar.CurrentRegion.GridRegionData.Y * 256)); + Client.Self.AutoPilotLocal(Convert.ToInt32(followAvatar.Position.X), Convert.ToInt32(followAvatar.Position.Y), followAvatar.Position.Z); + } } //else //{ diff --git a/libsecondlife-cs/examples/TestClient/Program.cs b/libsecondlife-cs/examples/TestClient/Program.cs index d5c42460..5bb5e42d 100644 --- a/libsecondlife-cs/examples/TestClient/Program.cs +++ b/libsecondlife-cs/examples/TestClient/Program.cs @@ -41,7 +41,7 @@ namespace libsecondlife.TestClient lineNumber++; string[] tokens = line.Trim().Split(new char[] { ' ', ',' }); - if (tokens.Length == 3) + if (tokens.Length >= 3) { account = new LoginDetails(); account.FirstName = tokens[0]; @@ -49,6 +49,11 @@ namespace libsecondlife.TestClient account.Password = tokens[2]; accounts.Add(account); + + if (tokens.Length == 5) + { + master = tokens[3] + " " + tokens[4]; + } } else { @@ -58,11 +63,12 @@ namespace libsecondlife.TestClient } } } - catch (Exception) - { - Console.WriteLine("Error reading from " + args[1]); - return; - } + catch (Exception e) + { + Console.WriteLine("Error reading from " + args[1]); + Console.WriteLine(e.ToString()); + return; + } if (args.Length == 4) {