Page 4 of 23 FirstFirst ... 2 3 4 5 6 14 ... LastLast
Results 31 to 40 of 223

Thread: [WIP] GuiltySpark

  1. #31
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: [WIP] HaloBot

    The save button now serializes your graph into a file, which can be opened again later:
    (opened bg.wmap after clearing the old one, and continued editing with move 5)


    edit: I also added a little line to the "you" circle to show which direction you're facing
    Last edited by Con; May 6th, 2010 at 09:40 PM.
    Reply With Quote

  2. #32
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: [WIP] HaloBot

    Pathfinding is almost done. Here you can see it find and highlight the nodes you need to visit to reach the goal.



    It doesn't actually move the player yet, and it fails on any subsequent attempts because I forgot to reset node cost values at the end of the algorithm. Right now it's set up so that when the program can eventually follow a path, you can still type in goto # and it will start following the new path immediately. This will allow the final version of the program to make decisions on its own and change its destination when it does. I also have to correct the cost calculation for teleporter links, so the program will know their distance is 0 and will prefer them over walking to the destination.
    Last edited by Con; May 8th, 2010 at 09:33 PM.
    Reply With Quote

  3. #33
    Kid in the Hall Kornman00's Avatar
    Join Date
    Sep 2006
    Location
    ◕‿◕, ┌( ಠ_ಠ)┘
    Posts
    3,130

    Re: [WIP] HaloBot

    That or retain information about nearby vehicles which it can hop into and drive :P
    Reply With Quote

  4. #34
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: [WIP] HaloBot

    So I'm simulating key presses using keybd_event, but it won't move the player around. Only when I open up the ingame console does it type WWWWWWWWWWWW.

    Anyone know what's up?

    edit: I've tried the SendKeys class (says Halo isn't processing messages) and user32.dll's PostMessage function, but that always returns 0 meaning it didn't work. I've only had *success* with the keybd_event function.
    Last edited by Con; May 12th, 2010 at 10:57 AM.
    Reply With Quote

  5. #35
    Senior Member TEMPTii's Avatar
    Join Date
    Aug 2009
    Location
    Colorado Springs, CO
    Posts
    155

    Re: [WIP] HaloBot

    Quote Originally Posted by Con View Post
    So I'm simulating key presses using keybd_event, but it won't move the player around. Only when I open up the ingame console does it type WWWWWWWWWWWW.

    Anyone know what's up?

    edit: I've tried the SendKeys class (says Halo isn't processing messages) and user32.dll's PostMessage function, but that always returns 0 meaning it didn't work. I've only had *success* with the keybd_event function.
    I too want to know the problem with that. I used to have that problem while making one of those things that makes you jump up and down :X
    Reply With Quote

  6. #36
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: [WIP] HaloBot

    Used to? Does that mean you found an alternative or gave up?
    Reply With Quote

  7. #37
    Senior Member TEMPTii's Avatar
    Join Date
    Aug 2009
    Location
    Colorado Springs, CO
    Posts
    155

    Re: [WIP] HaloBot

    Gave up. :S
    Reply With Quote

  8. #38
    chilango Con's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, BC, Canada
    Posts
    8,397

    Re: [WIP] HaloBot

    Good news, I found the solution. Limited suggested I use SendInput instead.
    you'll need these

    Code:
            #region constants
            const int INPUT_MOUSE = 0;
            const int INPUT_KEYBOARD = 1;
            const int INPUT_HARDWARE = 2;
            const uint KEYEVENTF_EXTENDEDKEY = 0x0001;
            const uint KEYEVENTF_KEYUP = 0x0002;
            const uint KEYEVENTF_UNICODE = 0x0004;
            const uint KEYEVENTF_SCANCODE = 0x0008;
            const uint XBUTTON1 = 0x0001;
            const uint XBUTTON2 = 0x0002;
            const uint MOUSEEVENTF_MOVE = 0x0001;
            const uint MOUSEEVENTF_LEFTDOWN = 0x0002;
            const uint MOUSEEVENTF_LEFTUP = 0x0004;
            const uint MOUSEEVENTF_RIGHTDOWN = 0x0008;
            const uint MOUSEEVENTF_RIGHTUP = 0x0010;
            const uint MOUSEEVENTF_MIDDLEDOWN = 0x0020;
            const uint MOUSEEVENTF_MIDDLEUP = 0x0040;
            const uint MOUSEEVENTF_XDOWN = 0x0080;
            const uint MOUSEEVENTF_XUP = 0x0100;
            const uint MOUSEEVENTF_WHEEL = 0x0800;
            const uint MOUSEEVENTF_VIRTUALDESK = 0x4000;
            const uint MOUSEEVENTF_ABSOLUTE = 0x8000;
            #endregion
    
            #region structures
            struct MOUSEINPUT
            {
                public int dx;
                public int dy;
                public uint mouseData;
                public uint dwFlags;
                public uint time;
                public IntPtr dwExtraInfo;
            }
    
            struct KEYBDINPUT
            {
                public ushort wVk;
                public ushort wScan;
                public uint dwFlags;
                public uint time;
                public IntPtr dwExtraInfo;
            }
    
            struct HARDWAREINPUT
            {
                public int uMsg;
                public short wParamL;
                public short wParamH;
            }
    
            [StructLayout(LayoutKind.Explicit)]
            struct MOUSEKEYBDHARDWAREINPUT
            {
                [FieldOffset(0)]
                public MOUSEINPUT mi;
    
                [FieldOffset(0)]
                public KEYBDINPUT ki;
    
                [FieldOffset(0)]
                public HARDWAREINPUT hi;
            }
    
            struct INPUT
            {
                public int type;
                public MOUSEKEYBDHARDWAREINPUT mkhi;
            }
            #endregion
    
            [DllImport("user32.dll", SetLastError = true)]
            static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);


    Code:
                        INPUT structInput = new INPUT();
                        structInput.mkhi.ki.wScan = (ushort)0x11;
                        structInput.mkhi.ki.time = 0;
                        structInput.mkhi.ki.dwFlags = KEYEVENTF_SCANCODE;
                        structInput.mkhi.ki.wVk = 0;
                        structInput.type = INPUT_KEYBOARD;
                        SendInput(1, ref structInput, Marshal.SizeOf(new INPUT()));
    Here's a list of key codes.


    EDIT: success!
    HaloBot has just walked from one side of bloodgulch to the other following the paths perfectly. You can even look around while it does this; it calculates the right combination of WASD to use based on the angle you're looking and where the goal is.
    Last edited by Con; May 12th, 2010 at 09:58 PM.
    Reply With Quote

  9. #39

    Re: [WIP] HaloBot

    This will be awesome when it's finished... When I want to go idle or AFK for awhile I can just enable this plus an aimbot and auto-shoot bot!
    Reply With Quote

  10. #40

    Re: [WIP] HaloBot

    Quote Originally Posted by Freelancer View Post
    This will be awesome when it's finished... When I want to go idle or AFK for awhile I can just enable this plus an aimbot and auto-shoot bot!
    Wouldn't you also need some way to get it to lock onto people in the first place? :S

    Also, Conscars, what happens if you try to type while it's moving? Do you end up with a chatbox full of "wwwwwwwwwwwwwwwwwwwwwwwwwwsssssssssddddddddaaaaaa aaa"?
    Reply With Quote

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •