ask

Ask gaming related questions (AHK v1.1 and older)
Joo Se Hyuk
Posts: 69
Joined: 05 Sep 2016, 12:52

ask

12 Feb 2018, 22:20

hi

how i can prevent sending 5 button again when i push w for 7.5 sec?

my script send 22t5ssee when i push w then wait half sec and send g, and after 7.5 sec when i push w it push 5 again, and its working fine
what i want is how i can prevent send 5 when i pushing w after the fist push for 7.5 sec
only the 5 button what i wanna prevent not the others when i push w
i want the timer start again like now when i push w


i push w i want this:
------------------------------------
timer start
------------------------------------
send 22t5ssee
sleep 500
send g



now this time period when i push w i wanna send only this:
------------------------------------
the timer start again (its working fine)
------------------------------------
send 22tssee
sleep 500
send g




------------------------------------
this is when 7.5 sec expire
------------------------------------
send w



this is my code and ty


*$w::

Settimer, Send_5, 7500

send 22t5ssee
sleep 500
send g

return

Send_5:
sendinput 5
Settimer, Send_5, off

return
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: ask

13 Feb 2018, 14:39

The real question is how do YOU know when you want to send the 5 again and when not to send it. That's the knowledge you have to teach your script.
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.
Joo Se Hyuk
Posts: 69
Joined: 05 Sep 2016, 12:52

Re: ask

14 Feb 2018, 22:15

i want send 22t5ssee when i push w and if the timer is running when i push w again (no matter how many times) i only want to send 22tssee
if the timer ends (7.5 sec) and i push w i wanna send 22t5ssee again and start the timer again
i think its clear.
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: ask

15 Feb 2018, 09:35

i want send 22t5ssee when i push w and if the timer is running when i push w again (no matter how many times) i only want to send 22tssee
if the timer ends (7.5 sec) and i push w i wanna send 22t5ssee again and start the timer again
i think its clear.
  • i want send 22t5ssee when i push w
  • if the timer is running when i push w again (no matter how many times) i only want to send 22tssee
  • if the timer ends (7.5 sec) and i push w i wanna send 22t5ssee again and start the timer again
so lets see if i have this right
This code is untested,

Code: Select all

#NoEnv
#SingleInstance, Force
#MaxThreads, 100
#MaxThreadsPerHotkey, 2
#Persistent
SetBatchLines, -1
DetectHiddenWindows, On
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen
SetTitleMatchMode, 2
SetTitleMatchMode, slow
SetKeyDelay, 100,100
SetMouseDelay 10
SetDefaultMouseSpeed, 0
SendMode Event
#InstallKeybdHook
#InstallMouseHook
#UseHook, On

t_mr := A_Tickcount - 1
return

w::
	If (A_Tickcount > t_mr)
	{	send, 22t5ssee
		t_mr := (A_Tickcount + 7500)
	}
	else
	{	send 22tssee
	}
	return
This code is untested,
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.
Joo Se Hyuk
Posts: 69
Joined: 05 Sep 2016, 12:52

Re: ask

16 Feb 2018, 03:05

its seems good, but it have one problem
this one not start the timer again when i push w (in this if i push w every 1.5 sec then after 7.5 sec the next one will send 22t5ssee not 22tssee
i dont want that
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: ask

16 Feb 2018, 06:44

this is what you said
want send 22t5ssee when i push w and if the timer is running when i push w again (no matter how many times) i only want to send 22tssee
if the timer ends (7.5 sec) and i push w i wanna send 22t5ssee again and start the timer again
i think its clear. [/quote

this is what i understood
i want send 22t5ssee when i push w
if the timer is running when i push w again (no matter how many times) i only want to send 22tssee
if the timer ends (7.5 sec) and i push w i wanna send 22t5ssee again and start the timer again
if this is wrong please correct the pseudocode

--PseudoCode--
step 1. use the w key to start the sequence and the timer
step 2 if the timer has timed out send the 22t5ssee
and reset the timer for 7-1/2 seconds
and exit the routine
otherwise...
step 3. while the timer is still running
send the 22tssee sequence
and exit the routine
if this sequence is not correct please correct it

this is what the code above looks like now

Code: Select all

t_mr := (A_Tickcount - 1) ;<- make sure timer has elapsed to get a clean start
return

w:: ;step 1. hotkey to start the timer and send the first series
	If (A_Tickcount > t_mr) ;<- if the timer has timed out
	{	send, 22t5ssee ;<- then send the sequence with the 5
		t_mr := (A_Tickcount + 7500) ;<- and restart the timer
	}
	else ;<- otherwise the timer is still running so
	{	send 22tssee ;<- just send the sequence without the 5
	}
	return ;<- and exit the routine
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Xeokis and 90 guests