Need help - Holding RButton = Holding Xbutton1, then after a very short delay also Hold RButton Topic is solved

Ask gaming related questions (AHK v1.1 and older)
TiesA
Posts: 4
Joined: 06 May 2021, 13:05

Need help - Holding RButton = Holding Xbutton1, then after a very short delay also Hold RButton

06 May 2021, 13:31

I'm trying to create a script that does the following:

1) Upon holding the right mouse Button, set XButton1 as down as long as the right mouse button is down
(So to clarify: RButton should not be set as down at this point, only XButton1)

2) After a very short delay (10 ms), also set RButton as down as long as the right mouse button is held down

3) When right mouse button is released / up, release both Mouse Button 4 as well as RButton



Additionally, it would be nice if when I hold the physical Right Click button down, thén physically hold down Mouse Button 4, thén release the Right Click button, the script does not set XButton1 as Up while I'm holding it down



So far I've only been able to create a loop, but this doesn't seem to work in the game.
Instead it seems to acts as a toggle: clicking the Right Mouse Button sets Mouse Button 4 as down until I click the RMB again and is a bit janky (that's why I want the short 10ms delay)

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

RButton::
  Loop {
    Send {XButton1 Down}
  } Until !GetKeyState("RButton","P")
Return
RButton Up:: Send {XButton1 Up}
Thank you in advance for any assistance!
User avatar
mikeyww
Posts: 26847
Joined: 09 Sep 2014, 18:38

Re: Need help - Holding RButton = Holding Xbutton1, then after a very short delay also Hold RButton  Topic is solved

06 May 2021, 20:59

Code: Select all

RButton::
SoundBeep, 1500
Click, X1 D
Sleep, 10
Click, R D
KeyWait, RButton
Click, R U
Click, X1 U
SoundBeep, 1000
Return
TiesA
Posts: 4
Joined: 06 May 2021, 13:05

Re: Need help - Holding RButton = Holding Xbutton1, then after a very short delay also Hold RButton

08 May 2021, 03:11

Hi Mikey,

Initially that didn't work either, but it turns out the game seems to catch multiple mouse commands.
Replacing the mouse buttons with keys in script (and some rebinding in-game) did the job. Thanks!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 31 guests