Hey guys I'm going to release a norecoil AHK script on the forum soon with a lot of additional goodies and it's all for PUBG, but I'm having a little problem in regards to the toggles. I've already posted my problem on AHK forum and I'm waiting for a response and if there are AHK people among us I'd love to hear your response as well.

This is just a small part of my script, but it's enough for demonstrating my problem. Here's how my script works:

1. We start the script by pressing the button "P" (P for play), if the script started it's gonna say "mouse on" out loud.
2. Now when we LClick somewhere on our screen it calls a mouse event function
3. ALSO... I'm able to change how many times do I want the LClick to call my mouse event function, so I made a toggle function, which toggles between "5" and "infinity". I made a variable for it called "n" which has a value of 5. In order to toggle between those I made a keybind for the toggle and assigned it to the button "K"

My main problem was the toggle, so I decided to give it a " #MaxThreadsPerHotkey [Value] "
It made it all work, but not how I expected, because " #MaxThreadsPerHotkey [Value] " 's value is limited to something like 10, so after toggling it 10 times it stops but I'd like to be able to toggle as much as I want.

Any help would be appreciated

Respectfully yours,
Class1

Code:
dc = 0
dyRecoil = 22
n = 5

;Turn it on/off
P::
Loop {
	If(GetKeyState("P", "p"))
	{
		if dc = 0
		{
			dc = 1
			ComObjCreate("SAPI.SpVoice").Speak("mouse on")
		}
		else
		{
			dc = 0
			ComObjCreate("SAPI.SpVoice").Speak("mouse off")
		}
		Break
	}
}
return

;Toggle between 5 and infinity
#MaxThreadsPerHotkey 20
K::
toggle := !toggle
Loop
{
	If toggle
	{
		n++
	}
	else
	{
		n := 5
	}

}
return

;By pressing LButton it repeats %n% rounds
LButton:: 
Loop %n%
{ 
	If (dc = True)
	{
		Sleep 6
		Click
		DllCall("mouse_event", "UInt", 0x0001, "UInt", 0, "UInt", dyRecoil, "UInt", 0, "UPtr", 0)
		If (GetKeyState("LButton","p")=False)
		Break 
	}
	else
	{
		Click
		Break
	}
}
return

f9::Exitapp
f8::Reload