Sleep function won't work

Ask gaming related questions
nisan
Posts: 4
Joined: 20 Jan 2016, 18:44

Sleep function won't work

20 Jan 2016, 18:46

Hi all !
I have altered a script and its all working expect the delay part.
Shortly, I need it to delay the whole script when key 2 or 3 are pressed once, for 4 seconds.
Thing is it does not delay, however it does enter startdelay() function when pressed.

Help would be appreciated !

Thanks!

Code: Select all

#NoEnv
SendMode Input

_norecoil := true ;

F3::ExitApp ; 	
F4::_norecoil := ! _norecoil 
~2::startdelay()
~3::startdelay()

startdelay()
{
_norecoil := false ;
Sleep, 4000
_norecoil := true 
}

~LButton::startloop() 	

startloop()
{
	
 
		Loop
	global _norecoil
	global _weapon
	
	if _norecoil
	{
		
		if GetKeyState("LButton", "P")
			{ 
				SendInput {WheelDown}
				SendInput {LButton DownTemp}
				Sleep 1
				SendInput {LButton Up}
				Sleep 125				
			}
			else
			{
				break ;
			}
		
		
	}
}


	
nisan
Posts: 4
Joined: 20 Jan 2016, 18:44

Re: Sleep function won't work

21 Jan 2016, 08:30

Thanks I will try and let you know.
nisan
Posts: 4
Joined: 20 Jan 2016, 18:44

Re: Sleep function won't work

21 Jan 2016, 20:18

Hi !
I have tried what you are saying and it now changes the var.

But, it does not change it back IN-GAME. only when im on desktop.

Code: Select all

#NoEnv
SendMode Input

_norecoil := true ;

F3::ExitApp ; 	
F4::_norecoil := ! _norecoil 
~2::startdelay2()
~3::startdelay3()

startdelay2()
{
	global _norecoil
	_norecoil := false ;
	Sleep, 4000
	_norecoil := true ;
	Return
}
startdelay3()
{
	global _norecoil
	_norecoil := false ;
	Sleep, 2000
	_norecoil := true ;
	Return
}
~LButton::startloop() 	

startloop()
{
	
 
		Loop
	global _norecoil
	global _weapon
	
	if _norecoil
	{
		
		if GetKeyState("LButton", "P")
			{ 
				SendInput {WheelDown}
				SendInput {LButton DownTemp}
				Sleep 1
				SendInput {LButton Up}
				Sleep 125				
			}
			else
			{
				break ;
			}
		
		
	}
}


	
nisan
Posts: 4
Joined: 20 Jan 2016, 18:44

Re: Sleep function won't work

22 Jan 2016, 14:29

Please help me

Return to “Gaming”

Who is online

Users browsing this forum: vinilzord and 9 guests