Sign in to follow this  
Followers 0

DAOC and MouseClickPlus

2 posts in this topic

Ok, I have been trying to send either keypresses or mouseclicks to an inactive Dark Ages of Camelot window for the past couple of hours.

I have read nearly every post on sending keys/mouseclicks to an inactive window. This may not be possible with this particular game... I'm not sure.

Here is what I have tried:

ControlSend() - This will send the appropriate keys only AFTER I activate the window that it was supposed to send them to. So if I send them to Client B while Client A is active .. they keys arent actually taken into effect until I activate Client B.

There was a _SendKeys() function somewhere on the boards.. it had the same effect ControlSend did.

So, after exhausting the keys methods I thought that maybe some udf involved in minimized clicking/inactive clicking would do the trick.

I came across a post where Smoke_N got his inactive mouse clicks to work with SWG. Using the code in that topic I came up with this:

Opt("MouseClickDelay", 1)
Opt("MouseCoordMode", 0)

Global $primary="left", $secondary="right"
_MouseButton($primary, $secondary)

MsgBox(262144, "DAOC Remote Send", "Activate the DAOC window that will be inactive during normal game play.")
WinSetTitle("Dark Age of Camelot", "", "DAOC - Inactive Account")
WinSetTitle("Dark Age of Camelot", "", "DAOC - Active Account")
$h_inactive = WinGetHandle("DAOC - Inactive Account")
$h_active = WinGetHandle("DAOC - Active Account")

While 1
    If _IsPressed('33') Then 
        _MouseClickPlus("DAOC - Inactive Account", $primary, 25, 77, 1)
    ;If _IsPressed('34') Then FastSwitch()
    Sleep(10) ; take load off the processor

;Func FastSwitch()
;   WinActivate($h_inactive)
;   WinActivate($h_active)

Func _MouseClickPlus($Window, $primary, $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

  Case $primary
     $Button     =  $MK_LBUTTON
     $ButtonDown =  $WM_LBUTTONDOWN
     $ButtonUp   =  $WM_LBUTTONUP
  Case $Button = $secondary
     $Button     =  $MK_RBUTTON
     $ButtonDown =  $WM_RBUTTONDOWN
     $ButtonUp   =  $WM_RBUTTONUP

  If $X = "" OR $Y = "" Then
     $MouseCoord = MouseGetPos()
     $X = $MouseCoord[0]
     $Y = $MouseCoord[1]

  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))

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

Func _MouseButton(ByRef $primary, ByRef $secondary)
   Local $k
   $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
   If $k = 1 Then
      $primary = "right"
      $secondary = "left"
      $primary = "left"
      $secondary = "right"
EndFunc ;==>_MouseButton

Func _IsPressed($hexKey)
 ; $hexKey must be the value of one of the keys.
 ; _IsPressed will return 0 if the key is not pressed, 1 if it is.
 ; $hexKey should entered as a string, don't forget the quotes!
 ; (yeah, layer. This is for you)
  Local $aR, $bO
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
     $bO = 0
  Return $bO
EndFunc  ;==>_IsPressed

However, it isnt working. I cant really tell if it is even clicking at all. I can tell you it isnt clicking on X=25, Y=77 (Relative Window Coordinates).

Am I doing something dumb here? I just wanted to ensure I wasnt missing the obvious before I went in other directions. If I absolutely CANT get it to work by sending keys/clicks to the inactive window I'll use the ControlSend method and have it fast switch between windows. This is a hack I would like to avoid though.

Any insight on this matter would be appreciated.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post

Link to post
Share on other sites

I've had the same problem.. With a P2P program called ares. Some programs uses a method to prevent bots of this sort. (So a friend told me).

So that is what im guessing...


unless i was doing something wrong too, i hate feeling stupid :D lol.

Share this post

Link to post
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
Sign in to follow this  
Followers 0