Hold RMB when LButton hold Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Brokchus
Posts: 13
Joined: 05 Aug 2017, 08:41

Hold RMB when LButton hold

Post by Brokchus » 16 Oct 2021, 07:27

Hi, basicly im trying to create script that will allow me to shot arrows with only left click. Normally you have to hold right mouse button in order to aim your bow then you have to hold left mouse button in order to draw the arrow and relase lmb to release arrow.

Code: Select all

$LButton::
send {f down}
send {click down left}
sleep 5000
send {f up}
return
Got something like this so far and the problem is that if i release left mouse button it still hold the F key wich take over right mouse button function since i rebinded it in the game.

What i want to create:

When i press and hold left mouse button
My F key is hold untill i hold left mouse button
Then after F key is down my left click have to press and hold left click in the game
When i release left mouse button my F key and left mouse button in the game is released.

Also would be nice to get some different solution for sleep thing since it only allows me to aim for 5 seconds and if i wont shoot in this time my F key will be released.

Please help. :)

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Hold RMB when LButton hold

Post by mikeyww » 16 Oct 2021, 07:55

Code: Select all

LButton::Send {f down}{LButton down}
~LButton Up::Send {f up}

Brokchus
Posts: 13
Joined: 05 Aug 2017, 08:41

Re: Hold RMB when LButton hold

Post by Brokchus » 16 Oct 2021, 08:06

Works almost perfect but sometimes it relase F key before left mouse button and arrow dont shot when it happens.

Tried to add sleep in between lines to prevent F beign released first but didnt work.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Hold RMB when LButton hold

Post by mikeyww » 16 Oct 2021, 08:12

KeyHistory will show you what is happening with the keys.
What the release does: "When i release left mouse button my F key and left mouse button in the game is released."
If you need something different, you would need specify it, step by step.

Test the following in Notepad, to see if it works there (a demonstration).

Code: Select all

LButton::Send {f down}{LButton down}
~LButton Up::
Sleep, 5000
Send {f up}x
KeyHistory
Return

Brokchus
Posts: 13
Joined: 05 Aug 2017, 08:41

Re: Hold RMB when LButton hold

Post by Brokchus » 16 Oct 2021, 08:19

Ahh okey i get it now why it happens.

Well then i guess i need to change
"When i release left mouse button my F key and left mouse button in the game is released."
To
"When i relaese left mouse button my F key is beign released first and after let sey 50 ms left mouse button is released"

Edit:

OkAy nevermind i modify a bit your code

Code: Select all

LButton::Send {f down}{LButton down}
~LButton Up::
Sleep, 50
Send {f up}
Return
It works wonderfully now. :D
Last edited by Brokchus on 16 Oct 2021, 08:23, edited 1 time in total.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Hold RMB when LButton hold  Topic is solved

Post by mikeyww » 16 Oct 2021, 08:22

Code: Select all

LButton::Send {f down}{LButton down}
LButton Up::
Send {f up}
Sleep, 50
Click, U
Return
Now you see how it works, so you can change the sleep, change the order of events, etc.

Post Reply

Return to “Gaming Help (v1)”