toggle spam with sleep messing things up?

Ask gaming related questions (AHK v1.1 and older)
jk_9982
Posts: 1
Joined: 23 Jul 2017, 11:10

toggle spam with sleep messing things up?

23 Jul 2017, 11:23

So my script just mashes a key when I press mouse button scroll down to toggle it on and off. But I think the sleep command is preventing me from doing other stuff in my program to where I have to hit keys or clicks several times before it goes through.
To circumvent this, I tried to bind another command to F: mainly to toggle off all the spamming and sleep, push some keys in succession, and then toggle back on the spam. For all intents and purposes it works. However, now when I click the toggle button, it sometimes triggers the actions scripted to F.

So my question is: how do I make the two actions (XButton1 and F) to where they don't interfere with each other but F still is able to toggle Xbutton1 off and back on?
OR
Is there another delay command other than sleep which doesn't interfere with mouseclicks or keypresses when it is being spammed?

A solution to the former is actually more preferred.

Code: Select all

toggle = 0
#MaxThreadsPerHotkey 5
XButton1::
    Toggle := !Toggle
     While Toggle{
        Send, {r}
		sleep 200
        If !Toggle
         Break
    }

f::
Send, {XButton1}
sleep 25
Send {Shift down}{LButton down}
KeyWait, f
Send {Shift up}{LButton up}
Send, {RButton}
Send, {Xbutton1}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 37 guests