Jump to content

Diablo 2 teleport problem


 Share

Recommended Posts

Hi, im new to autoit, so at the moment, im trying to make it send "Right Click" to the minimized window, the good thing, it works ONCE

but its suppose to do it 3 times, but it only right clicks one no matter how many clicks I tell it to do.

Global $yaxis = 3
Global $xaxis = 28


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

Func Start()

_Mouseclickplus("Diablo II", "right", 8 - $yaxis, 94 - $xaxis, 400)
EndFunc

As you can see, i supplied 400 click, still only does 1....

If anyone can help me, please.

Link to comment
Share on other sites

Maybe your overloading the click function, so maybe insert a sleep somewhere in the Click loop like so:

Global $yaxis = 3
Global $xaxis = 28


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))
        sleep(20)
  Next
EndFunc




Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

Func Start()

_Mouseclickplus("Diablo II", "right", 8 - $yaxis, 94 - $xaxis, 400)
EndFunc

untested

Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
Link to comment
Share on other sites

@SW_MAXIMIZE
Maximizes the specified window.
[edit = Thats command, makes it as if the diablo window was full screen, but its window mode, anyway to fix that?]

I don't want to make the window pop up at all ^_^ defeats the purpose kind of, but ill try. IF anyone can please help, im willing to pay 5$ or more for help!!

Edited by Coins
Link to comment
Share on other sites

I don't want to make the window pop up at all ^_^ defeats the purpose kind of, but ill try. IF anyone can please help, im willing to pay 5$ or more for help!!

Good luck making a Diablo 2 Bot in AutoIt, Oh and good ****** luck making a bot in autoit which can have the d2 window minimized.
Link to comment
Share on other sites

Very accurate sarcasm by the sound of it.

Im guessing if its hard, then ok, but Maximize makes the wndow act as if it was fullscreen, but its really window mod, anyway to set the actual size?

Link to comment
Share on other sites

  • Developers

Im guessing if its hard, then ok, but Maximize makes the wndow act as if it was fullscreen, but its really window mod, anyway to set the actual size?

What is with typing all your replies with bold characters?

Can't be that everything you type has to stand out ...right?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What is with typing all your replies with bold characters?

Can't be that everything you type has to stand out ...right?

Sorry ^^ I perfer bold on anything really.

Still looking to get this done, its only the teleport part, it wont send multiple click to the window while minimized, everything else is easy, so it can be ran minimized.

Link to comment
Share on other sites

Sorry ^^ I perfer bold on anything really.

Still looking to get this done, its only the teleport part, it wont send multiple click to the window while minimized, everything else is easy, so it can be ran minimized.

Uh..

@SW_SHOW
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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