Pause function specific moment if the key is hold

Ask gaming related questions
Gonzalo94
Posts: 32
Joined: 17 Jul 2017, 12:56

Pause function specific moment if the key is hold

29 Oct 2018, 14:57

Hello guys! i have this code and i want a different function if the key is hold for 1 second, so for example if the F8 is hold in that time, the function will be paused at the moment of

Code: Select all

KeyWait, LButton, D, t0.100
. And if the key is up, the code will continue will normal.

any help i will be very gratefull!!
sorry for my bad english :/!

Code: Select all

f8::
Send {F4}{F10}
SetMouseDelay, -1
CoordMode, Mouse, Window
BlockInput, MouseMove
MouseMove, 586,  424, 0
KeyWait, LButton, D, t0.100
sleep, 10
MouseMove, 526,  279, 0
BlockInput, MouseMoveOFF
DllCall("Sleep","UInt",30)
Send {F12}{F1}{End}{F7}
return
Last edited by Gonzalo94 on 29 Oct 2018, 15:13, edited 1 time in total.
User avatar
SL5
Posts: 493
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: CHANGE FUNCTION IF THE KEY IS HOLD

29 Oct 2018, 15:10

I can understand your English well.

I think you need a loop or an interval (SetTimer)

So you can always check the state of the button

if( GetKeyState("F8","P") ){
Gonzalo94
Posts: 32
Joined: 17 Jul 2017, 12:56

Re: CHANGE FUNCTION IF THE KEY IS HOLD

29 Oct 2018, 15:24

SL5 wrote:
29 Oct 2018, 15:10
I can understand your English well.

I think you need a loop or an interval (SetTimer)

So you can always check the state of the button

if( GetKeyState("F8","P") ){
I make it in this way and not working :(

Code: Select all

f8::
Send {F4}{F10}
SetMouseDelay, -1
CoordMode, Mouse, Window
BlockInput, MouseMove
MouseMove, 586,  424, 0
If( GetKeyState("F8","P")) {
KeyWait, LButton, D, t0.100
return
}
else
MouseMove, 526,  279, 0
BlockInput, MouseMoveOFF
DllCall("Sleep","UInt",30)
Send {F12}{F1}{End}{F7}
return
User avatar
SL5
Posts: 493
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: CHANGE FUNCTION IF THE KEY IS HOLD

29 Oct 2018, 15:34

Gonzalo94 wrote:
29 Oct 2018, 15:24
I make it in this way and not working :(
I can not see where you have implemented my suggestion somehow?

Do you expect me to completely program now?

Did you understand my suggestion?
Gonzalo94
Posts: 32
Joined: 17 Jul 2017, 12:56

Re: CHANGE FUNCTION IF THE KEY IS HOLD

29 Oct 2018, 15:45

SL5 wrote:
29 Oct 2018, 15:34
Gonzalo94 wrote:
29 Oct 2018, 15:24
I make it in this way and not working :(
I can not see where you have implemented my suggestion somehow?

Do you expect me to completely program now?

Did you understand my suggestion?
Sorry if i didint understand well... all i now of programing ahk i learn myselft.
Can u explain me how to implement ur suggestion?
sorry for the annoying and thanks for the help
User avatar
SL5
Posts: 493
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: CHANGE FUNCTION IF THE KEY IS HOLD

29 Oct 2018, 15:59

while(a_index < 9999){
if(GetKeyState("F8","P"))
tooltip,i down
else
tooltip,
sleep,50
}




SetTimer,checkit,50
checkit:

if(GetKeyState("F8","P"))
tooltip,i down
else
tooltip,
sleep,50
retun
User avatar
SL5
Posts: 493
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: CHANGE FUNCTION IF THE KEY IS HOLD

30 Oct 2018, 02:43

Gonzalo94 wrote:
29 Oct 2018, 15:45

Sorry if i didint understand well... all i now of programing ahk i learn myselft.
Can u explain me how to implement ur suggestion?
sorry for the annoying and thanks for the help

sorry i didnt read your script. only your question.

did it works now?

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 10 guests