Mouse Clicking [solved]

Posts 1–9 of 9 · Page 1 of 1
Mouse Clicking [solved]
OK so last night was the first time i ever even looked at visual basic code so please take it easy on me. I am trying to make a very basic boxing bot for the game dark orbit just to learn basics. So far i am able to wright code to make the cursor move but i can't get it to click where it stops. Can any one give me a hand??
[highlight="VB.Net"]Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up

Public Sub SimulateClick()
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub[/highlight]

Execute the SimluateClick Sub after moving your mouse.

[highlight="VB.Net"]SimulateClick()[/highlight]
Umm I guess it's in a timer soo try timer1.stop()

@Blubb1337 he's trying to make it stop he said he already got the click part done
@cook91c

Quote Originally Posted by willrulz188 View Post
Umm I guess it's in a timer soo try timer1.stop()

@Blubb1337 he's trying to make it stop he said he already got the click part done
He shouldn't be using a timer at all if it's just for moving the mouse. If the timer runs all the code required for the bot, there is no need to stop the timer during clicking, I don't see a reason why.

Sure if he wants to stop his timer...

[highlight="VB.Net"]Timer1.Stop[/highlight]
I'm not using a timer. It moves the cursor to the spot i need it to go when i click the start button. But the problem is i need it to click on that spot it moved the cursor to and i can not figure out how to do that. Sorry for the confusion should of worded it better.
Quote Originally Posted by cook91c View Post
I'm not using a timer. It moves the cursor to the spot i need it to go when i click the start button. But the problem is i need it to click on that spot it moved the cursor to and i can not figure out how to do that. Sorry for the confusion should of worded it better.
See my first reply then.
Idk what I'm doing wrong
Code:
Public Class Form1


    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Cursor = New Cursor(Cursor.Current.Handle)
        Cursor.Position = New Point(Cursor.Position.X + 751, Cursor.Position.Y + 296)

    End Sub
    Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

    Public Const MOUSEEVENTF_LEFTDOWN = &H2
    Public Const MOUSEEVENTF_LEFTUP = &H4

    Public Sub SimulateClick()
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    End Sub
End Class
You are not executing the sub.

[highlight="VB.Net"]Public Class Form1


Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X + 751, Cursor.Position.Y + 296)
SimulateClick()
End Sub
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4

Public Sub SimulateClick()
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
End Class[/highlight]
Here is my advice. Read some tutorials. Learn the commands. From there on it's easy. Took me less than a day to learn enough to write a bot for Aika online.

If you can't find what you're looking for on the amazing collection of tutorials Here, then you can always try google :P

Good luck!
Posts 1–9 of 9 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us