Page 1 of 1

Hold Key> Keypresses

Posted: 18 Feb 2018, 22:01
by Kades
XButton2::
lbutton_count++
If (lbutton_count = 1)
{
Send {3}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)
{
Send {4}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)w
{
lbutton_count := 0
}
return



So basically I'm using M5 but I need to repeatedly hit m5 over and over to switch between weapons and kill someone.
I was wondering if there was a way to make it so I hold m5 button and it does it automatically instead of constant pressing
when I release m5 it goes back to normal, so a toggle in a way but not a proper toggle? xd

Re: Hold Key> Keypresses

Posted: 18 Feb 2018, 22:52
by Exaskryz
You may want While GetKeyState("XButton2","P")

Re: Hold Key> Keypresses

Posted: 18 Feb 2018, 23:04
by Kades
While GetKeyState("XButton2","P")::
lbutton_count++
If (lbutton_count = 1)
{
Send {3}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)
{
Send {4}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)w
{
lbutton_count := 0
}
return


if I try

While GetKeyState("XButton2","P")
lbutton_count++
If (lbutton_count = 1)
{
Send {3}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)
{
Send {4}
Sleep, 600
Send {LButton}
}
If (lbutton_count = 2)w
{
lbutton_count := 0
}
return

It doesn't open :()
I tried running it but I'm not familiar on what needs to be changed to work, thanks .