Gaming script send key

Ask gaming related questions (AHK v1.1 and older)
Pokan
Posts: 3
Joined: 11 Oct 2017, 11:38

Gaming script send key

11 Oct 2017, 12:28

Hi, i need help for my script game.

I try to make a bot that auto key when image is here on inactive window.

So that work but the key is only send on the chat of the game but still do nothing if not in the chat.

Ex : Press 4 for heal -> not work
Press 4 in chat -> Work


Thanks for the help.

Code: Select all

#NoEnv
#InstallKeybdHook
DetectHiddenWindows, On
CoordMode, Tooltip, Screen
SetBatchLines, -1
Process, Priority,, High
;download gdip_all.ahk here http://www.autohotkey.com/forum/topic32238.html 

#include *i gdip_all.ahk

#include gdip_imagesearch.ahk

OnExit, EXIT_LABEL

If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}

needle=%a_scriptdir%\Capture3.png  ;you need testimage needle.png


F4::
id := WinExist("ahk_exe game169.exe")
WinGetPos, x, y, w, h, ahk_id %id%
screen:= x "|" y "|" w "|" h 
raster:= 0x40000000 + 0x00CC0020
bmpHaystack := Gdip_BitmapFromScreen(screen,raster)  ;you need the handle of the window to search in
bmpNeedle := Gdip_CreateBitmapFromFile(needle)
RET := Gdip_ImageSearch(bmpHaystack,bmpNeedle,LIST,0,0,0,0,0,0xFFFFFF,1,0)
Gdip_DisposeImage(bmpHaystack)
Gdip_DisposeImage(bmpNeedle)
Gdip_Shutdown(pToken)
tooltip %list%
ControlSend, ahk_parent, {4 down}, ahk_exe game169.exe
Sleep 500
ControlSend, ahk_parent, {4 up}, ahk_exe game169.exe
return

esc::
EXIT_LABEL: 
Gdip_Shutdown(pToken)
EXITAPP

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: mikeyww and 91 guests