timer function

Ask gaming related questions (AHK v1.1 and older)
Twinbrow
Posts: 6
Joined: 14 Jan 2017, 13:41

timer function

16 Oct 2019, 08:40

It never gets to to the "Send" portion. Can't seem to find that last elusive issue. Seems to be the timer setup but I can't find the issue. Any help on this would be great. I tracked it through with the tooltip function and it never enters after the timer check.

Thanks,

Code: Select all

KeyList1 := 1
SLEEP1 = 300
KeyList2 := 2
SLEEP2 = 1500
KeyList3 := Numpad7
SLEEP3 = 1000
KeyList4 = 1
KeyList5 = 1
KeyList6 = 1
KeyList7 = 1
KeyList8 = 1

CooldownList1 = 96000 
CooldownList2 = 19700
CooldownList3 = 10000

KeyCount = 3 



Loop 
{  
GetKeyState, state, 4
if state = D
{
   Loop %KeyCount% 
   {  
;tooltip, %A_Index%
      k := KeyList%A_Index% ;<-- get the next key
      If (KeyIsOffCooldown%A_Index% = True) ;<-- see if it's off cooldown
      {  
tooltip, "made it in"
Send, {%k%} ;<-- if so, send it
	SLEEP, SLEEP%A_Index%
         keyIsOffCooldown%A_Index% := False 
         SetTimer, KeyTimer%A_Index%, - CooldownList%A_Index% 
      }
sleep, 100

      ; and go to the next key
   }
}
}
Return
 

KeyTimer1:
KeyIsOffCooldown1 := True 
Return
 
KeyTimer2:
KeyIsOffCooldown2 := True
Return
 
KeyTimer3:
KeyIsOffCooldown3 := True
Return
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: timer function

16 Oct 2019, 09:14

You have it set up so that KeyIsOffCooldown[1-2-3] would need to be true in order for your timers to run which is the only place that they actually get set to that value.
Twinbrow
Posts: 6
Joined: 14 Jan 2017, 13:41

Re: timer function

16 Oct 2019, 18:40

Thanks, Did not know these needed to be preset. Will give it a go.
Twinbrow
Posts: 6
Joined: 14 Jan 2017, 13:41

Re: timer function

18 Oct 2019, 09:38

Yep, That was it. Preset at the beginning and now it works like a charm. Thanks again.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 45 guests