How to pause multiple toggle scripts with the same hotkey

Ask gaming related questions (AHK v1.1 and older)
genjuro
Posts: 43
Joined: 06 Jun 2020, 23:25

How to pause multiple toggle scripts with the same hotkey

30 Jun 2020, 15:10

I've two different toggle scripts I would like to pause with the same hotkey.
I've tried some some and either they didn't work for both the same time or just didn't stopped the current one from spamming the keys that were toggled.

Anyway I was hoping someone with experience could help me please.

My first script

Code: Select all

n1status := 0
n2status := 0
n3status := 0
n4status := 0
Send, {Numpad1 up}
Send, {Numpad2 up}
Send, {Numpad3 up}
Send, {Numpad4 up}


F1:: 
If( n1status = 0 ){
	Send, {Numpad1 down}
	n1status = 1
} Else If ( n1status = 1){
	Send, {Numpad1 up}
	n1status = 0
}
Return

F2::
If( n2status = 0 ){
	Send, {Numpad2 down}
	n2status = 1
} Else If ( n2status = 1){
	Send, {Numpad2 up}
	n2status = 0
}
Return


F3::
If( n3status = 0 ){
	Send, {Numpad3 down}
	n3status = 1
} Else If ( n3status = 1){
	Send, {Numpad3 up}
	n3status = 0
}
Return


F4::
If( n4status = 0 ){
	Send, {Numpad4 down}
	n4status = 1
} Else If ( n4status = 1){
	Send, {Numpad4 up}
	n4status = 0
}
Return
And my second one

Code: Select all

toggle=0 
    F5::
    If (toggle := !toggle)
    	SetTimer, Timer, -1
    return
     
    timer:
    while toggle
    {
    	send 5
	Random, Time, 4900, 5000
	Sleep, Time
    }
    return
Any help would be greatly appreciated :)
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to pause multiple toggle scripts with the same hotkey

30 Jun 2020, 19:36

I can't see the same hotkey in your scripts?
Anyway you can use e.g. ~F5:: so each script and system will see the key: https://www.autohotkey.com/docs/Hotkeys.htm
Otherwise you will need to use the hotkey in only one script and that script will need to toggle pause all other scripts!
genjuro
Posts: 43
Joined: 06 Jun 2020, 23:25

Re: How to pause multiple toggle scripts with the same hotkey

30 Jun 2020, 22:27

HotKeyIt wrote:
30 Jun 2020, 19:36
I can't see the same hotkey in your scripts?
I've deleted it as it was not working properly.

How do I do this sir ?
you will need to use the hotkey in only one script and that script will need to toggle pause all other scripts!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: doanmvu, mikeyww and 50 guests