MantisBT - opensim
View Issue Details
0005705opensim[REGION] OpenSim Corepublic2011-09-23 08:412011-09-23 08:41
Quin3y 
 
normalmajoralways
newopen 
master (dev code) 
 
41616ca 2011-09-22 01:11:19 +0100
Standalone (1 Region)
BasicPhysics
Mono / Windows
trunk
Second Life 3.0.3
0005705: Bot AutoPilot() Issue
I tried to move the bot to a specific position using AutoPilot() function, however it seems to be problematic. The bot can move towards the right direction but never stops until it reaches the bound of the region. I adjusted the z value in moveTo() function by commenting out the line z -= 2, the bot flies to the right direction and continues flying to the bound. Actually the moveto command in TestClient.exe has the same problem. I'm using libomv 0.9.0. How to fix this bug?

If you want to test my code, just use your own bot's account to log in to your own region and set a start location startLoc, it should work. The function moveTo(100, 100, 24) means to move the bot to position (100, 100, 24).
// Need to add the following References if using VC# 2010:
// OpenMetaverse, OpenMetaverseTypes
// These can be found in your opensim\bin folder

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using OpenMetaverse;
using OpenMetaverse.Packets;

namespace PetBot
{
    class PetBot
    {
        public static GridClient client = new GridClient();
        public static System.Timers.Timer updateTimer;

        // login
        private static string firstName = BOT'S FIRST NAME;
        private static string lastName = BOT'S LAST NAME;
        private static string password = PASSWORD;
        private static string userAgent = "test";
        private static string version = "1.0";
        private static string URI = "http://127.0.0.1:9000/"; [^]
        public static Vector3 startLoc = new Vector3(135, 135, 24);
        private static string startRegion = YOUR REGION;


        public static void Main()
        {
            client.Settings.SEND_AGENT_UPDATES = true;

            string startLocation = NetworkManager.StartLocation(startRegion, (int)startLoc.X, (int)startLoc.Y, (int)startLoc.Z);
            LoginParams loginParams = client.Network.DefaultLoginParams(firstName, lastName, password, userAgent, version);
            loginParams.URI = URI;
            loginParams.Start = startLocation;

            client.Network.LoginProgress += new EventHandler<LoginProgressEventArgs>(Network_LoginProgress);

            if (client.Network.Login(loginParams))
            {
                Console.WriteLine("Bot Login Message: " + client.Network.LoginMessage);
                client.Self.Chat("Hello World!", 0, ChatType.Normal);
                Thread.Sleep(8000);

                moveTo(100, 100, 24);
            }
            else
            {
                Console.WriteLine("Login failed: {0}", client.Network.LoginMessage);
            }
        }

        public static void Network_LoginProgress(object sender, LoginProgressEventArgs e)
        {
            if (e.Status == LoginStatus.Success)
            {
                Console.WriteLine("Yeahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!");
            }
        }

        public static void moveTo(double x, double y, double z)
        {
            uint regionX, regionY;
            Utils.LongToUInts(client.Network.CurrentSim.Handle, out regionX, out regionY);

            x += (double)regionX;
            y += (double)regionY;
            z -= 2;
            client.Self.Chat("Moving to", 0, ChatType.Normal);
            client.Self.AutoPilot(x, y, z);
        }
    }
}
No tags attached.
Issue History
2011-09-23 08:41Quin3yNew Issue
2011-09-23 08:41Quin3yGit Revision => 41616ca 2011-09-22 01:11:19 +0100
2011-09-23 08:41Quin3yRun Mode => Standalone (1 Region)
2011-09-23 08:41Quin3yPhysics Engine => BasicPhysics
2011-09-23 08:41Quin3yEnvironment => Mono / Windows
2011-09-23 08:41Quin3yMono Version => trunk
2011-09-23 08:41Quin3yViewer => Second Life 3.0.3

There are no notes attached to this issue.