Jump to content

Minimized clicking -- Great for game-bots


Insolence
 Share

Recommended Posts

;===============================================================================
  ;
  ; Function Name:  _MouseClickPlus()
  ; Version added:  0.1
  ; Description:    Sends a click to window, not entirely accurate, but works 
  ;                 minimized.
  ; Parameter(s):   $Window     =  Title of the window to send click to
  ;                 $Button     =  "left" or "right" mouse button
  ;                 $X          =  X coordinate
  ;                 $Y          =  Y coordinate
  ;                 $Clicks     =  Number of clicks to send
  ; Remarks:        You MUST be in "MouseCoordMode" 0 to use this without bugs.
  ; Author(s):      Insolence <insolence_9@yahoo.com>
  ;
  ;===============================================================================
 Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
    Local $MK_LBUTTON       =  0x0001
    Local $WM_LBUTTONDOWN   =  0x0201
    Local $WM_LBUTTONUP     =  0x0202
    
    Local $MK_RBUTTON       =  0x0002   
    Local $WM_RBUTTONDOWN   =  0x0204
    Local $WM_RBUTTONUP     =  0x0205
 
    Local $WM_MOUSEMOVE     =  0x0200
    
    Local $i                = 0
    
    Select 
    Case $Button = "left"
       $Button     =  $MK_LBUTTON
       $ButtonDown =  $WM_LBUTTONDOWN
       $ButtonUp   =  $WM_LBUTTONUP
    Case $Button = "right"
       $Button     =  $MK_RBUTTON
       $ButtonDown =  $WM_RBUTTONDOWN
       $ButtonUp   =  $WM_RBUTTONUP
    EndSelect
    
    If $X = "" OR $Y = "" Then
       $MouseCoord = MouseGetPos()
       $X = $MouseCoord[0]
       $Y = $MouseCoord[1]
    EndIf
    
    For $i = 1 to $Clicks
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $WM_MOUSEMOVE, _
          "int",   0, _
          "long",  _MakeLong($X, $Y))
          
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $ButtonDown, _
          "int",   $Button, _
          "long",  _MakeLong($X, $Y))
          
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $ButtonUp, _
          "int",   $Button, _
          "long",  _MakeLong($X, $Y))
    Next
 EndFunc
 
 
 
 
 Func _MakeLong($LoWord,$HiWord)
    Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
 EndFunc

I think Larry made the _MakeLong function, so credit goes to him on that. I got a lot of help on the entire thing, I just threw it into a function.

I'll have to figure out how to get the actual area size of the window excluding the title bar for some games, atleast in Diablo II.

EDIT: To get D2 offsets use this code:

$winsize = WinGetPos("Diablo II")
 $borderwidth = ($winsize[2] - 800) / 2
 $titleheight = $winsize[3] - 600 - (2 * $borderwidth)
 
 msgbox("", "", $borderwidth & " " & $titleheight)

And use it like so:

_MouseClickPlus( "Diablo II", "left", 525 - $borderwidth, 585 - $TitleHeight )
Edited by Jon
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Pointless by NO means!

I do this to help people, my personal benefit is minimal seeing as how I don't play the game.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

I posted an example at the bottom of my script, just include that function inside your script and call it.

All you gotta do :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

very nice @insolence :D very nice !!!!!!!!! can u also use pixelgetcolor in a minimized window ?

:idiot:

<{POST_SNAPBACK}>

Nope, sadly you cannot.

[EDIT]

Delete what???

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

wtf ? it wont click in the d2 window at alll dunno why ...

do i have to use borderwidht and title height ?

Edit: Insolence reply plz :idiot: it wont click man .. or if it clicks it clicks like 5 extra pixels in X axis and about 30 extra pixels in Y axis

Edited by pcdestroyer
Link to comment
Share on other sites

You have to use the offsets thing I supplied at the bottom.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Alright :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Yeah I knew that was the problem -.- I mentioned it in the first post.

$winsize = WinGetPos("Diablo II")
$borderwidth = ($winsize[2] - 800) / 2
$titleheight = $winsize[3] - 600 - (2 * $borderwidth)

msgbox("", "", $borderwidth & " " & $titleheight)

But you need to automize that, does the above code not find those values?

If not maybe this will work:

$winsize = WinGetPos("Diablo II")
$borderwidth = $winsize[2] - 800
$titleheight = $winsize[3] - 600

msgbox("", "", $borderwidth & " " & $titleheight)
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

hmm... it seems that , when i use $borderwidth and $titleheight it clicks on a completely different place BUT if i use their real values which are "3" and "26" it works .... :idiot: if i use them as a variable it wont work ... is this a bug or something ?!

Edited by pcdestroyer
Link to comment
Share on other sites

No it's gotta be something in your script, why don't you post it in support.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...