Issues with Repeating Input

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Yobi
Posts: 1
Joined: 25 Apr 2017, 20:48

Issues with Repeating Input

25 Apr 2017, 21:08

I'm writing a AHK script for Blade and Soul to address a bug with mouse input - that is, mouse input isn't received reliably when the camera isn't moving. To get around this, I bound the left and right click to R and T keys respectively.
The game has two modes, Combat and Menu I'll call them. In combat you can move around and attack things, interact with the world and do mmo character things. The cursor isn't visible in this mode. It's in this mode I want the mouse buttons to be assigned to keys so that the input from my mouse is better prioritized.

Menu mode is when a menu or dialog is on screen and you have a cursor on screen. Opening a menu with a hotkey, or holding the alt key down brings up the cursor and you character controls are suspended.

My goal with this script is to have it so when you are moving around (press a WASD key) the script is running. When Menu mode is active, the script should suspend and allow the mouse to act normally.
(I tried messing around with a toggle variable and using control statements to alter what the mouse input was, but this was highly unreliable. This may be due to a lack of understanding of how the modifiers on keys works)

The way the program works is this:
While script is running, Left and Right mouse buttons fire a R or T key press.
Hitting one of the various Menu shortcut keys suspends the script.
Hitting Left Alt also suspends the script. I originally wanted it so when the alt key is released it would resume the script, but this caused odd behavior I'll get to in a bit.
Hitting Escape toggles suspending the script on and off. This keybind is problematic due to order of operations issues, Escape brings up it's own menu, but it also closes menus and returns to "Combat" mode, so sometimes it resumes when it should suspend.
Pressing a movement key (WASD) resumes the script.
I also played around with tooltips to help inform me whether the script is running or not.

I've come upon several issues while running this script though:
Input begins to fire like a mouse button was held down. In game this usually means I'm wasting combat resource (Focus) which leaves me unable to fight, and also uses a sub par skill order (right mouse for example is meant to be cast twice to trigger a powerful nuke, not spammed continuously). Mashing my suspend unsuspend buttons and the mouse buttons eventually gets it to stop spamming.

When alt tabbing in and out of the game, sometimes the Mouse becomes unable to click on anything outside of the game. I.e. I alt tab out (or hit windows key and click off the game) and clicks do not register on any applications. Sometimes mashing left click returns the ability to click on non-game applications. Otherwise, logging out and back into the computer fixes this issue.

Any suggestions or advice to solve or mitigate these issues?

Code: Select all

toggle := 0

; Toggles the script on and off, in case you get stuck in the wrong mode
~Escape::
Suspend
if toggle := !toggle
 Tooltip Suspending
else
 Tooltip Resuming
SetTimer, HideTooltip, -800
return

#ifwinactive
; Suspend the script when you're opening a menu
~`::
~F1::
~F2::
~F3::
~F4::
~F5::
~F6::
~F7::
~F8::
~F9::
~F10::
~F11::
~F12::
~I::
~O::
~P::
~B::
~K::
~L::
~J::
~H::
~M::
~LAlt::
Suspend, on
Tooltip Suspending
SetTimer, HideTooltip, -800
return
#ifwinactive

; Turns the script back on when you move
#ifwinactive Blade & Soul
~W::
~A::
~S::
~D::
Suspend, off
return
#ifwinactive

#ifwinactive Blade & Soul
$LButton::
Send {r down}
return
#ifwinactive

; Mouseclicks are bound to R and T, since Blade and Soul has a bug where
; mouseclicks are received slower than key presses.
; This is the whole reason the script exists.
#ifwinactive Blade & Soul
$LButton UP::
Send {r up}
return
#ifwinactive

#ifwinactive Blade & Soul
$RButton::
Send {t down}
return
#ifwinactive

#ifwinactive Blade & Soul
$RButton UP::
Send {t up}
return
#ifwinactive

HideTooltip:
Tooltip,,
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Performance, Rohwedder and 115 guests