Jump to content

Recommended Posts

Posted

Try this, run diablo in -w Mode I Run D2Loader, just change it to work on ur d2 window name

Global $yaxis = 3
Global $xaxis = 28

Start()

Func Start()

Opt( "MouseCoordMode", 0)

_MouseClickPlus( "D2Loader", "left",  396 - $yaxis, 328 - $xaxis, 1);Selects Single Player
Sleep(1000)
_MouseClickPlus( "D2Loader", "left", 172 - $yaxis, 151 - $xaxis, 2);Selects Character 1
EndFunc

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

Post Back

  • 3 months later...
Posted

I tried many ways, and nope not possible :)

"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.
Posted

I tried many ways, and nope not possible :)

<{POST_SNAPBACK}>

There is only one way I can think of but I have no ideal how to code it.

1. Do a screen capture.

2.Convert screen capture to a string.

3.Split the string in to the blocks of each pixels.

4.Give the blocks X,Y coordinates as to the location in the string.

This could be all wrong but what do I know.

P.S. Very nice _mouseclickplus().

.

Posted

Thank you, but all those methods are over kill.

I simply tried a DLLCall to the actual windows API to get the pixel, to no avail.

"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.
Posted

Virtual clicking thing?

It works just like AutoIt's clicking except it sends clicks in to a window, so it works minimized.

"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.
Posted

It's not clicking on the right place for me, or something, heres my code:

Global $X = "800"
Global $Y = "470"   

    $ErrorTitle = "Instruction"
    AdlibEnable ( "_WinCheck", 10 )
   
     HotKeySet("{PAUSE}", "EndScript")
    
      $start = MsgBox(4+16+0+4096+0, "Theivery Bot", "End Theivery 

Bot? Press 'No' to start the bot. Press the PAUSE key to stop the 

bot.")
      If $start = 6 Then
        Exit
      EndIf

    While 1
    _IfActive()
    WEnd

Func _MouseClickPlus($Window, $Button = "right", $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 _IfActive()

    Send('{F9}')
    _MouseClickPlus( "Monster&Me - MythOfOrient", "right", $X 

, $Y)
    Sleep(0)

    EndFunc

Func _WinCheck()
   If WinExists ( $ErrorTitle ) Then
      WinActivate ( $ErrorTitle )
      Send ( "o" )
   EndIf
EndFunc
    
   ; Function to exit script
    Func EndScript()
      $exit = MsgBox(4+16+0+4096+0, "Theivery Bot", "End Theivery 

Bot?")
      If $exit = 6 Then
        Exit
      EndIf
    EndFunc
Posted

Come on... I answered in at the bottom of the first post :)

"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.
Posted

Did you try? That's the only explination I have.

Try to figure it out... see where it's clicking and where your coord is...

"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.
  • 1 month later...
  • 1 month later...
Posted (edited)

Hmmmm I'm having some problems with this in Star Wars Galaxies, seems just to not click anything, I tried to not set coords and make it click where mouse was and still nothing.

Here is my code that I use now.

Opt("MouseClickDelay", 1)
Opt("MouseCoordMode", 0)
Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 2)
  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

$j = 0
While $j <= 10
    If WinExists("Windows Task Manager") Then
            Exit
    EndIf
    _MouseClickPlus("SwgClient", "left")
    _MouseClickPlus("SwgClient", "left", 430, 260)
    _MouseClickPlus("SwgClient", "left", 490, 260)
    _MouseClickPlus("SwgClient", "left", 360, 325)
    _MouseClickPlus("SwgClient", "left", 425, 325)
WEnd
Edited by Scorpius
  • 3 months later...
Posted (edited)

I have same problem with World of Warcraft, this function doesn't click when window is minimized, only when i activate window and move mouse over it.

Edited by fastnick1oo
SciTE - much better than notepad. ; ]
Posted

It wont right click for me :/ Heres my code...

;Theivery Bot V0.2
;By jackyyll
;11.5.05


;Stuff

$ErrorTitle = "Instruction"
AdlibEnable ( "_WinCheck", 10 )

HotKeySet("{PAUSE}", "EndScript") 
;End Stuff


;GUI
#include <GUIConstants.au3>

$MyGUI = GuiCreate("Theivery Bot", 250, 250)
GuiCtrlCreateTab(1, 1, 250, 250)
GuiCtrlCreateTabItem("About")
GuiCtrlCreateLabel("Theivery bot By jackyyll", 5, 40)
GuiCtrlCreateTabItem("Theivery")
GuiCtrlCreateLabel("Theivery Bot", 85, 40)
GuiCtrlCreateLabel("Instructions:", 88, 55)
GuiCtrlCreateLabel("Press F10 to launch the mouse locator.", 30, 70)
GuiCtrlCreateLabel("Put the X and Y values in the input boxes.", 25, 85)
GuiCtrlCreateLabel("X", 45, 135)
GuiCtrlCreateLabel("Y", 80, 135)
$x1 = GuiCtrlCreateInput("", 35, 150, 30, 20)
$y1 = GuiCtrlCreateInput("", 70, 150, 30, 20)
$start = GuiCtrlCreateCheckbox("Run", 175, 150, 50, 20)
GuiCtrlSetState(-1, $GUI_UNCHECKED)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        Case GUICtrlRead($start) <> 4
        While GUICtrlRead($start) <> 4
          Steal()
        WEnd
    Case GUICtrlRead($start) = -1
        ExitLoop
    EndSelect
WEnd

GUIDelete()

Exit

;Functions
;Mouse Locator
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMouse()
    If $T = 0 Then
        $T = 1
        Return
    EndIf
    If $T = 1 Then
        ToolTip("")
        $T = 0
        Return
    EndIf

EndFunc
;End Mouse Locator

;Close error
Func _WinCheck()
   If WinExists ( $ErrorTitle ) Then
      WinActivate ( $ErrorTitle )
      Send ( "o" )
   EndIf
EndFunc
;End Close Eror

;Steal
Func Steal()
Opt( "MouseCoordMode", 0)

Send('{F9}')
_MouseClickPlus( "Monster&Me - MythOfOrient", "right", $x1 , $y1 , 2)
Sleep(300)
EndFunc
;End Steal

;Exit Bot
Func EndScript()
   $exit = MsgBox(4+16+0+4096+0, "Theivery Bot", "End Theivery Bot?")
      If $exit = 6 Then
        Exit
      EndIf
  EndFunc
;End Exit Bot

;SilentMouse
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
;End SilentMouse
Posted

Works perfectly fine with diablo II but not World of Warcraft... What do I do wrong? I've tried alot of different things but without result...

Opt( "MouseCoordMode", 0)

Func Start()

_MouseClickPlus( "World of Warcraft", "left", 766 - $yaxis, 588 - $xaxis, 1)

_MouseClickPlus( "World of Warcraft", "left", 775 - $yaxis, 603 - $xaxis, 2)

EndFunc

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

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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