Elegant Single Scripauto keypresser for Bloon TD 6?

Ask gaming related questions (AHK v1.1 and older)
hexdragon
Posts: 3
Joined: 31 Jan 2021, 11:24

Elegant Single Scripauto keypresser for Bloon TD 6?

Post by hexdragon » 25 Jul 2021, 04:28

Hello!

So I'm playing Bloon TD6 and I want to automate ability uses (which are on the numbers). So I started using multiple similar scripts:

Code: Select all

#MaxThreadsPerHotkey 2
F5::
	toggle:=!toggle
	While toggle{
		Send 1
		Sleep 1000
	}
return
I tried making it so only one script runs but when I try to stack these the script simply cannot press 2 differnet keys periodically. Is there a way to make all the autokeyboard pressign into one single scrip file. For example if I press F5 then F6 then F7, the keys 1,2,3 get autopressed every few seconds.

Also is there a way to make a script stop if the window which it started on looses focus? It would be really nice if there was a solution for that.

Wish you all a nice day!

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Elegant Single Scripauto keypresser for Bloon TD 6?

Post by mikeyww » 25 Jul 2021, 07:17

Code: Select all

map := {F5: 1, F6: 2}, list := {}

F5::
F6::
If list[A_ThisHotkey]
 list.Delete(A_ThisHotkey)
Else list[A_ThisHotkey] := WinActive("A")
SetTimer, Go, % list.Count() ? 250 : "Off"
Return

Go:
For key, uid in list
 If WinActive("A") = uid
  Send % map[key]
 Else SetTimer,, % ("Off", list := {})
Return

Post Reply

Return to “Gaming Help (v1)”