Mbutton Triggers LButton with delay

Ask gaming related questions (AHK v1.1 and older)
Pacifista
Posts: 46
Joined: 17 Jan 2022, 16:17

Mbutton Triggers LButton with delay

Post by Pacifista » 06 Feb 2023, 22:39

İ need to a script that works like this.

I will press Mbutton and hold it. As long as i keep it pressed down it will do this;

keep lmb pressed down for 1.5 secs and release, also repeat this as long as i keep mbutton hold down (pressed)

plus i need to merge these scripts instead of starting 2 separate instances and combine with the one above

Code: Select all

~LButton::
Gosub, Key
SetTimer, Key, 1000
KeyWait, LButton
SetTimer, Key, Off
Return
Key:
Send q
Return

Code: Select all

~LButton::
Key:
Send {Rbutton}
Return
first one; this script just presses to the "q" key as long as i press Lbutton everytime.

second one; this just presses rmb once as long as i click lmb once to shoot.

Thx in advance..

off
Posts: 176
Joined: 18 Nov 2022, 21:54

Re: Mbutton Triggers LButton with delay

Post by off » 09 Feb 2023, 21:38

Hello!, Perhaps:
Pacifista wrote:
06 Feb 2023, 22:39
I will press Mbutton and hold it. As long as i keep it pressed down it will do this;
keep lmb pressed down for 1.5 secs and release, also repeat this as long as i keep mbutton hold down (pressed)

Code: Select all

SetTimer, Click, 1

Click:
SetTimer, Click, 1
if GetKeyState("MButton")
{
Click, Down Left
Sleep, 1500
Click, Up Left
}
return

Esc::ExitApp
And the merged script:
Pacifista wrote:
06 Feb 2023, 22:39
first one; this script just presses to the "q" key as long as i press Lbutton everytime.

second one; this just presses rmb once as long as i click lmb once to shoot.

Code: Select all

~LButton::
Click, Right
Gosub, Key
SetTimer, Key, 1
KeyWait, LButton
SetTimer, Key, Off
Return
Key:
Send q
Return

Pacifista
Posts: 46
Joined: 17 Jan 2022, 16:17

Re: Mbutton Triggers LButton with delay

Post by Pacifista » 10 Feb 2023, 14:39

Thank you so much. To be honest when i use this the first shot is taking time more than it should. it is releasing the button a bit late everytime.

Now imagine i will use this script again and again, this way it is a bit lacking.

Plus when i release mbutton it wont cancel the operation. The moment i release m button it should quit doing anything too but it still holding the left button.


The combined script is not working like it should at all. it is clicking the lmb so many times.

off
Posts: 176
Joined: 18 Nov 2022, 21:54

Re: Mbutton Triggers LButton with delay

Post by off » 16 Feb 2023, 20:38

Pacifista wrote:
10 Feb 2023, 14:39
The combined script is not working like it should at all. it is clicking the lmb so many times.
how it click LMB? It should use LMB as the button to trigger Click RMB once and send q as long you press it.

Note:
I only test it with notepad and cps counter (to test is it really click), your game maybe process the input differently
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess

Post Reply

Return to “Gaming Help (v1)”