Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP] Visual Basic
#1
Hey guys, I'm tring to make a bot in visual basic, but im have no clue on what i need to do. This is what i NEED it to do....


::: Get a box cord. (checks for a box on the screen)
::: If (xcolor) is in the box
::: MouseClick on a button.. (Not in the box)

So pretty much, theres a box on the screen with a color moving when it gets to a certian place (in the box) the mouse will click a button..


Any help?
Reply
#2
What are you trying to make the bot for? It might be better if you just say that...
Reply
#3
its an online block stacking game. blocks go from left to right, and you stack them to the top. I already have the correct color. and the coords of the field that needs checked and the mouse coord.
Reply
#4
(11-01-2011, 02:31 PM)JusCaus Wrote: its an online block stacking game. blocks go from left to right, and you stack them to the top. I already have the correct color. and the coords of the field that needs checked and the mouse coord.

The click on it from a point. Or, get the ID of the button and make the webbrowser click it.
Reply
#5
I have tried and tried.....

Code:
Import System.Runtime.InteropServices
'...

<DllImport("user32.dll")> _
Public Shared Sub mouse_event(ByVal dwFlags As UInt32, ByVal dx As UInt32, ByVal dy As UInt32, ByVal dwData As UInt32, ByVal dwExtraInfo As UIntPtr)
End Sub

Public Sub TryClick(ByVal clickPosition As Point, ByVal checkPositions As Point(), ByVal col As Color)
If ReadyToClick(checkPositions, col) Then 'make sure the positions hold the color.
Dim dx As Int32 = clickPosition.X * 65535 / Screen.PrimaryScreen.Bounds.Width 'calculate the absolute position of the x-axis
Dim dy As Int32 = clickPosition.Y * 65535 / Screen.PrimaryScreen.Bounds.Width ' " " " y-axis
mouse_event(&H8000 Or &H1 Or &H2 Or &H4, dx, dy, 0, UIntPtr.Zero) 'move the mouse to an absolute position and click.
End If
End Sub

Private Function CaptureScreen() As Bitmap
Dim screenSize As Size = Screen.PrimaryScreen.Bounds.Size 'calculate the size of the screen
Dim bmp As New Bitmap(screenSize.Width, screenSize.Height) 'make a buffer bitmap to hold the screen data
Using g As Graphics = Graphics.FromImage(bmp) 'create a graphics object to link to our bitmap
g.CopyFromScreen(Point.Empty, Point.Empty, screenSize) 'copy the screen data into the bitmap.
End Using
Return bmp
End Function

Private Function ReadyToClick(ByVal pts As Point(), ByVal c As Color) As Boolean
Dim screen As Bitmap = CaptureScreen()
For Each pt As Point In pts
If Not screen.GetPixel(pt.X, pt.Y) = c Then Return False 'if the color are the current point <> the correct color exit immediately
Next
Return True
End Function

[/code]
Private CheckPoints As Point() = New Point() {New Point(550, 609), _
New Point(550, 583), _
New Point(550, 556), _
New Point(550, 554), _
New Point(550, 500), _
New Point(550, 474), _
New Point(550, 449), _
New Point(550, 423), _
New Point(550, 393), _
New Point(550, 368), _
New Point(550, 339), _
New Point(550, 313), _
New Point(550, 287), _
New Point(550, 258)} 'array of points to look for the color at.

Private CheckColor As Color = Color.FromArgb(177, 11, 60) 'color to check for (in RBG)
Private ClickPosition As New Point(637, 690) 'position to click at when it's ready to do so

'...some method
TryClick(Me.ClickPosition, Me.CheckPoints, Me.CheckColor)
'...end method

Still no luck.....
Reply
#6
Maybe try to pay a professional coder to help you complete this task.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How To make an advanced Operating System in Visual Basic 2010 ? Mohamed Samir 9 11,430 01-15-2013, 09:30 PM
Last Post: Resistance
  [Visual Basic] FTP Uploader [Tutorial] Coding Support 6 2,701 08-12-2012, 12:36 AM
Last Post: Kenneth
  Visual Studio Bill Nye The Science Guy 1 885 03-19-2012, 09:08 AM
Last Post: BreShiE
  Visual Basic Guide - Buttons Death Demise 9 4,626 03-09-2012, 06:46 PM
Last Post: BreShiE
  Visual Basic Guides, Tutorials, Web Resources, and E-books Compilation simply_mark 1 1,603 11-16-2011, 06:30 AM
Last Post: TalishHF

Forum Jump:


Users browsing this thread: 1 Guest(s)