Spam button after 100 ms delay?

Ask gaming related questions
Posts: 7
Joined: 08 Jul 2018, 15:52

Spam button after 100 ms delay?

11 Jul 2018, 16:21

I made one code and I am almost happy with how it works:

Code: [Select all] [Download] GeSHi © Codebox Plus

While GetKeyState("LButton","P")
Send {Blind}l
random, time, 25, 50
sleep, time

I would like to add there LButton spam only if the LButton is pressed for a time longer than 100 ms. In the same time it should anyway spam L every 25-50 ms as seen above.

Also I would like to make a code which allows the same longer press function for keyboard F button. When i press it for less than 100 ms it should just click F, but after 100 ms it should spam F until I release it.

Please help me with that so I could give you the blessing of a sacred duck.
User avatar
Posts: 4235
Joined: 27 Feb 2014, 12:30

Re: Spam button after 100 ms delay?

13 Jul 2018, 10:31

If you want one script with two spam loops in it, you cannot use a While GetKeyState() loop
AHK can only run one loop at one time.
You would need to use SetTimer instead.

This doubly applies if you want to do long press type functionality

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 4 guests