Results 1 to 12 of 12
  1. #1
    LastOnInHell's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0

    Question trying to make bot for game.

    hey guys

    i want to make bot for game on vb.net i have problem that how i can move the mouse on the game and how to work on color pixel or x y ?

    i tried before Blue eye macro and i want make like his system .

    anyone have idea how to do that?

    thanks.
    Last edited by LastOnInHell; 09-23-2013 at 06:19 PM.

  2. #2
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    https://www.google.com/search?q=move+cursor+in+vb.net

    vb.net - Programatically moving the mouse - Stack Overflow

    Windows.Forms.Cursor.Position = New Point(x, y)

    answered Oct 5 '09 at 23:35, David Rutten
    Wow, how'd I miss that? Thanks so much!!!! Jeez, that was easy lol... – Cyclone
    ----------------

    Blue Eye Macro • View topic - Simple D3 bot
    The rest (from 1 example script I just googled) looks like keyboard/mouse/screen stuff, and Sleeps. Totally doable. Do you have a specific question?
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  3. #3
    LastOnInHell's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    thanks for reply
    but this not what i need |.
    i need something like moving mouse on hex color or something can Distinguish between other stuff on screen i don't want make on my screen only.

  4. #4
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    how i can move the mouse on the game...
    Cursor.Position = aPoint ''a way to move the mouse

    ----- you want --
    1. take screenshot
    2. scan screenshot for specific color / pattern
    3. set cursor position there

    ... now learn to do each item : ) Well, you know # 3 now ; )

    Have you ever worked with loops before? Otherwise 'looping' over the image data might seem 'complex' by itsself ..?


    It's not much code. You can look it up, and ask a specific question here if you have one.
    Last edited by abuckau907; 09-23-2013 at 07:31 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  5. #5
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    Hopefully this gets you started. : )

    screenshot of program in action:


     

    Windows API
    Code:
    Public Class WinApi
    #Region "API Declarations"
        'Public Declare Function GetWindowRect Lib "user32.dll" (ByVal hWnd As IntPtr, ByRef lpRect As Rect) As Boolean
        Public Declare Function GetClientRect Lib "user32.dll" (ByVal hWnd As IntPtr, ByRef lpRect As Rect) As Boolean
        Public Declare Function GetDesktopWindow Lib "user32" () As IntPtr
        Public Declare Function GetPixel Lib "gdi32" (ByVal hDC As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer
        Public Declare Function GetWindowDC Lib "user32" (ByVal hWnd As IntPtr) As IntPtr
        Public Declare Function ReleaseDC Lib "user32" (ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Integer
        Public Declare Function ClientToScreen Lib "user32.dll" (ByVal hWnd As IntPtr, ByRef lpPoint As Point) As Boolean
        'Public Declare Function GetForegroundWindow Lib "user32.dll" () As IntPtr
    
    #End Region
    #Region "Structs"
        Public Structure Rect
            ''NOT compatible with System.Drawing.Rectangle. Items are declared differently | different order.
            Dim Left As Int32
            Dim Top As Int32
            Dim Right As Int32
            Dim Bottom As Int32
            Public ReadOnly Property Width As Int32
                Get
                    Return Right - Left
                End Get
            End Property
            Public ReadOnly Property Height As Int32
                Get
                    Return Bottom - Top
                End Get
            End Property
        End Structure
    #End Region
    End Class
    ScreenManager code
    Code:
    Public Class ScreenManager
        ''' <summary>
        ''' Gets the color of a single pixel and returns as a Color.
        ''' </summary>
        Public Shared Function GetPixel(ByVal x As Int32, ByVal y As Int32) As Color
            Dim hWnd As IntPtr = WinApi.GetDesktopWindow()
            Dim hDC As IntPtr = WinApi.GetWindowDC(hWnd)
            Dim lColor As Int32 = WinApi.GetPixel(hDC, x, y)
            WinApi.ReleaseDC(hWnd, hDC)
            Return ColorTranslator.FromWin32(lColor) '<--nice converter function : Color struct is BIG :/ 20 something bytes.
        End Function
    
        ''' <summary>
        ''' Takes a screenshot of the screen and returns as a Bitmap.
        ''' </summary>
        ''' <param name="tl">Top-Left point of the region to copy</param>
        ''' <param name="width">Width of the region to copy</param>
        ''' <param name="height">Height of the region to copy</param>
        Public Shared Function GetScreenArea(ByVal tl As Point, ByVal width As Int32, ByVal height As Int32) As Bitmap
            Dim _rtnBmp As New Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb)
            Dim _gr As Graphics = Graphics.FromImage(_rtnBmp)
            _gr.CopyFromScreen(tl, New Point(0, 0), New System.Drawing.Size(width, height), CopyPixelOperation.SourceCopy)
            _gr.Dispose()
            Return _rtnBmp
        End Function
    
        ''' <summary>
        ''' Returns a WinApi.Rect (left,top,right,bottom) for the given window's client area. Does Not include Form Borders.
        ''' </summary>
        ''' <param name="hWnd">Handle to the window</param>
        Public Shared Function GetWindowClientRect(ByVal hWnd As IntPtr) As WinApi.Rect
            Dim _rtnRect As New WinApi.Rect
            Dim _tl As New Point(0, 0)
            WinApi.GetClientRect(hWnd, _rtnRect) '' only fills  Right and Bottom --> is Width and Height.
            WinApi.ClientToScreen(hWnd, _tl)
            _rtnRect.Top = _tl.Y
            _rtnRect.Left = _tl.X
            _rtnRect.Right += _rtnRect.Left
            _rtnRect.Bottom += _rtnRect.Top
            Return _rtnRect
        End Function
    
        ''' <summary>
        ''' Scans through a bitmap for 1 specific color
        ''' </summary>
        ''' <param name="aBitmap">The bitmap to be searched.</param>
        ''' <param name="searchColor">The color to search for.</param>
        Public Shared Function FindColorLocations(ByRef aBitmap As Bitmap, ByVal searchColor As Color) As Point()
            Dim _rtnPts As New List(Of Point)
            Dim _tmpColor As New Color
            For xx As Int32 = 0 To aBitmap.Width - 1
                For yy As Int32 = 0 To aBitmap.Height - 1
                    _tmpColor = aBitmap.GetPixel(xx, yy)
                    If _tmpColor.R = searchColor.R And _tmpColor.G = searchColor.G And _tmpColor.B = searchColor.B Then
                        _rtnPts.Add(New Point(xx, yy)) ''image's pixel-color matched searchColor. Add x,y to the list.
                    End If
                Next
            Next
            If _rtnPts.Count = 0 Then
                _rtnPts.Add(New Point(-1, -1)) '' FAILURE. No points found.
            End If
            Return _rtnPts.ToArray()
        End Function
    
    End Class
    Usage: Form1
    Code:
    Public Class Form1
        Private _ss As Bitmap '' Screenshot image
        Private _searchColor As Color = Color.FromArgb(255, 0, 0) '' Search Color. Defaulted to pure red.
    
    
        Private Sub cmdTakeSS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTakeSS.Click
            _ss = ScreenManager.GetScreenArea(New Point(0, 0), Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)
            pbxSS.Image = _ss
            pbxSS.Refresh()
        End Sub
    
        Private Sub cmdSetSearchColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSetSearchColor.Click
            _searchColor = ScreenManager.GetPixel(Cursor.Position.X, Cursor.Position.Y)
            Panel1.BackColor = _searchColor
            Panel1.Refresh()
        End Sub
    
        Private Sub cmdFindColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFindColor.Click
            Dim _foundPoints() As Point = ScreenManager.FindColorLocations(_ss, _searchColor)
    
            If _foundPoints(0).X = -1 Then
                ''fail. todo: add proper documentation. FindColorLocations() returns a single point of (-1,-1) on failure.
                MessageBox.Show("No points found of that color.")
            Else
                Dim _outStr As New System.Text.StringBuilder
    
                For Each pp As Point In _foundPoints
                    _outStr.Append(pp.ToString & "  ") '' displays as {X,Y}
                Next
                MessageBox.Show(_foundPoints.Length & " points found. " & Environment.NewLine _
                            & _outStr.ToString)
            End If
        End Sub
    
    End Class

     

     



     




     





    and a pastebin: [VB.NET] Basic Pixel Operations in vb.net - Pastebin.com



    Last edited by abuckau907; 09-24-2013 at 12:11 AM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  6. #6
    LastOnInHell's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    thanks man agine

    but when i make picurebox on stretchimage its not show anything only when i put in normal

    i think it will get to much point in stretchimage for that not show anything.

    anyother idea ? :P

  7. #7
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold


    That's how I did it.

    Not sure what you're talking about, sorry.

    An image is worth 1,000 words : )
    Last edited by abuckau907; 09-24-2013 at 01:24 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  8. #8
    LastOnInHell's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    can u upload the source then ?

  9. #9
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    @LastOnInHell

    are you serious?

    ...yeah, in a minute.


    edit:

    download link: https://www.fileswap.com/dl/Wz9QlmzWfB/

    Jotti AV Results: https://virusscan.jotti.org/en/scanre...f8166281180880

    VirusTotal AV Results: https://www.virustotal.com/en/file/4...is/1380052923/


    -I'm not sure people are allowed to upload like this, because it basically encourages spreading viruses, but I included the usual AV scans, so hopefully it can slide. I tried my hardest to make the source clean and clear in previous post..
    Last edited by abuckau907; 09-24-2013 at 02:27 PM. Reason: typosss
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  10. #10
    LastOnInHell's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    Thanks abuckau907 its clean :P

    now what i do if i get more then one Point ?

    i mean how the mouse move on this more then one point ?

    the Blue Eye macro work on xy and RGB in the some time>

    sorry for alot of asking

  11. #11
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    Sorry, I can't teach you everything from scratch. You have to learn to store (and retrieve) the data somehow. Basic language stuff. Good luck.




    Orig. from above
    Code:
    Private Sub cmdFindColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFindColor.Click
            Dim _foundPoints() As Point = ScreenManager.FindColorLocations(_ss, _searchColor)
    
            If _foundPoints(0).X = -1 Then
                ''fail. todo: add proper documentation. FindColorLocations() returns a single point of (-1,-1) on failure.
                MessageBox.Show("No points found of that color.")
            Else
                Dim _outStr As New System.Text.StringBuilder
    
                For Each pp As Point In _foundPoints
                    _outStr.Append(pp.ToString & "  ") '' displays as {X,Y}
                Next
                MessageBox.Show(_foundPoints.Length & " points found. " & Environment.NewLine _
                            & _outStr.ToString)
            End If
        End Sub
    Something Different
    Code:
    Private Sub cmdFindColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFindColor.Click
            Dim _foundPoints() As Point = ScreenManager.FindColorLocations(_ss, _searchColor)
    
            If _foundPoints(0).X = -1 Then
                ''fail. todo: add proper documentation. FindColorLocations() returns a single point of (-1,-1) on failure.
                MessageBox.Show("No points found of that color.")
            Else
    
                For Each pp As Point In _foundPoints
                   Cursor.Position = pp
                   Threading.Thread.Sleep(1500) '' so you can actually see it for a moment.
                Next
            End If
        End Sub
    Dim _foundPoints() As Point = ScreenManager.FindColorLocations(_ss, _searchColor)

    If _foundPoints(0).X = -1 Then
    ''fail. todo: add proper documentation. FindColorLocations() returns a single point of (-1,-1) on failure.
    MessageBox.Show("No points found of that color.")
    Else

    For Each pp As Point In _foundPoints
    Cursor.Position = pp '' move the cursor to each point
    Threading.Thread.Sleep(1500) '' so you can actually see it for a moment.
    Next
    End If

    '' Careful. Moving the mouse to 1000+ points will take a long time. JUST AN EXERCISE.

    ..I'm not giving you an entire framework...the function FindColorLocations() isn't actually that useful. You're more likely interested in knowing if a specific location of the screen is a certain color (the GetPixe() function). It was just to show you some code so you'd have an idea of what it looks like.
    Last edited by abuckau907; 09-24-2013 at 04:46 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  12. #12
    LastOnInHell's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    0
    ok ^^

    u helped me alots i will search more and learn more about it

    i think this thread is ended for now :P

    i will back for u later on other thread :P

    ty agine^^

Similar Threads

  1. [Tutorial] Making bots for your trainer
    By zerobrium in forum Adventure Quest Worlds (AQW) Hacks / Cheats / Trainers
    Replies: 8
    Last Post: 04-02-2013, 03:05 PM
  2. **Instant Emails to make ALTS for gaming/hacking**
    By restless1092 in forum General
    Replies: 12
    Last Post: 07-26-2012, 08:10 PM
  3. [Request] How to make bots for beginners
    By somethingxx in forum Team Fortress 2 Hacks
    Replies: 0
    Last Post: 05-30-2012, 02:40 AM
  4. [Help Request] Making Bots For SA-MP
    By Mr-x Winner in forum Visual Basic Programming
    Replies: 2
    Last Post: 02-25-2012, 10:53 PM
  5. [SOLVED] Can anyone make BOTS for alteriwnet
    By r3dcomet in forum Call of Duty Modern Warfare 2 Help
    Replies: 8
    Last Post: 09-03-2010, 09:44 PM