Jump to content

Hotkey Doesnt Work With A Certain Window Active


Recommended Posts

I have two hotkeys set up on a short script, using the tilde key (`) and the {end} key. They work fine any other time, but when my game window is the active window they will not work at all. The send keys work with thegame though, if I use the hotkey outside the game window, I have it set up to activate that window, and the send keys work fine with it activated, but I cannot use the hotkeys to stop the program or anything.

I am using version 3, no beta, and I just reinstalled it. For some reason when I try to install the beta it gives me an error, so using the release version. The script is below, hopefully someone can help.

Please keep in mind, that I am not a programmer, and I have no clue how to use DLL's and stuff, it is just a simple little macro I want to make.

; Auto Fastattack for DDO
; 

Opt("MouseCoordMode",2)
Opt("PixelCoordMode",2)
Opt("SendKeyDelay",20)
Opt("GUICloseonESC",0)
Opt("guioneventmode",1)
Opt("SendKeyDownDelay", 4)

#Include<GUIConstants.au3>

Global $Attack=0, $Taunt, $Delay=200, $GUI, $Button1, $GUIText, $LocX=Round(@DesktopWidth/2), $LocY=Round(@DesktopHeight/2)

HotKeySet("`", "OnOff")
HotKeySet("{end}", "Gameover")

$GUI=GUICreate("DDO Ultimate Attacker", 300, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "GAMEOVER")
GUICtrlCreateLabel("Set your Intimidate Skill on Hotkey #0!", 30, 20, 240, 30, $SS_Center)
GUICtrlCreateLabel("To use the auto attacker, simply click the Tilde Key (`) to turn it on and off! Keep the monsters in the center of your screen!", 30, 50, 240, 50, $SS_Center)
$GUIText=GUICtrlCreateInput("", 130, 220, 40, 20)
GUIctrlcreatelabel("Enter your delay between key presses in the box below! 1 Second = 1000, 1/4 second = 250, ETC ETC.", 30, 150, 240, 45, $SS_Center)
GUICtrlCreateLabel("Click END to exit the program at anytime!", 30, 100, 240, 30, $SS_Center)
$Button1=GUICtrlCreateButton("Start", 130, 250, 40, 20)
GUICtrlSetOnEvent(-1, "Start")
GUISetstate()

While 1
    Sleep(50)
WEnd

Func OnOff()
    If $Attack = 1 Then
        $Attack=0
    Else
        $Attack=1
        Attack()
    EndIf
EndFunc

Func Attack()
    WinActivate("Dungeons and Dragons Online")
    Sleep(1000)
    Send("0", 1)
    Sleep(500)
    While $Attack = 1
        MouseClick("Right", $LocX, $LocY)
        Sleep($Delay)
        Send("0", 1)
        Sleep($Delay)
    WEnd
EndFunc

Func Start()
    $Delay=GUIctrlRead($GUIText)
    GUISetState(@SW_HIDE, $GUI)
    WinActivate("Dungeons and Dragons Online")
EndFunc

Func Gameover()
    Exit
EndFunc
Link to comment
Share on other sites

The send keys work with thegame though, if I use the hotkey outside the game window, I have it set up to activate that window, and the send keys work fine with it activated, but I cannot use the hotkeys to stop the program or anything.

Ok, some games block the keyboard use when they are active... (in my case, when I play the Fifa :">

Optionally, you then should use the function IsPressed:

#Include <Misc.au3>
_IsPressed($s_hexKey)
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...