dont send if it was sent in last 5sec Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

dont send if it was sent in last 5sec

26 Apr 2018, 06:02

hi buds,

i want a macro like this:


1::
send, 1
send, 2
return

but i dont want the the 2 gets send if i press the key again in the next 5 seconds

like when i press it again after 1 second it should send without the "send, 2", and if i send it after for example 6 seconds it should send the whole script.
mqbluo7

Re: dont send if it was sent in last 5sec

26 Apr 2018, 07:29

DO YOU WANT TO SWITCh between two gun with one key if yes try this
but you must change your 1 (pick axe ) to another key i make x so you can change x in code to pick axe key do not use the same key .

~2::
~3::
~4::
~5::
~6::
~WheelDown::
~WheelUp::
return

1::
+1::
^1::
if ( A_ThisHotkey == A_PriorHotkey ) {
toggle := !toggle
} else {
toggle := True
}

if ( toggle ) {
send {x} ; is the pick axe key
} else {
send {2}
}
return
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: dont send if it was sent in last 5sec

26 Apr 2018, 08:22

Hallo,
try:

Code: Select all

~1::
If (A_TickCount > Next2)
{
	send, 2
	Next2 := A_TickCount + 5000
}
return
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: dont send if it was sent in last 5sec

26 Apr 2018, 14:21

perfect, rohwedder, its exactly what i was searching for

thanks a lot! :D
Aso
Posts: 17
Joined: 10 Nov 2016, 14:00

Re: dont send if it was sent in last 5sec

03 May 2018, 19:43

hi rohwedder,

i think all the time about my next question, i cant figure it out

F5::
send, 1

if the last press of the F5 button happened in the last 4 seconds:
send, 2
send, 3

return

so if i press F5 first time it should just
send 1

if i press F5 in the next 4seconds it should send
23
and reset the timer so when i press it again in the next 4 seconds it should send
23 again and again and so on

if i wait for more then 4 seconds, then it should start from beginning, like
send, 1

i hope i could explain it ;d
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: dont send if it was sent in last 5sec  Topic is solved

04 May 2018, 01:00

Hallo,
try:

Code: Select all

F5::
If (A_TickCount > LastF5 + 4000)
	Send, 1
Else
	Send, 23
LastF5 := A_TickCount
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 104 guests