Help me with this script

Ask gaming related questions (AHK v1.1 and older)
Future168
Posts: 2
Joined: 06 Mar 2018, 13:37

Help me with this script

06 Mar 2018, 13:43

See i have this fps game strafe script. However it has one problem on it, if i want duck/crouch on game it requires me press ctrl and when i use this script it sometimes dont take ctrl click.
Anyone can help me solve this problem ?
Heres full script : :headwall: :headwall:

Code: Select all

ScriptActive = 1



~w up::
If ScriptActive = 1 
{
if(GetKeyState("s","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=50
Send {s down}
While (!GetKeyState("s","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("s","P") ; if you are holding w down physically, you don't want to send a w up keystroke
Send {s up}

}
return

~a up::
If ScriptActive = 1
{
if(GetKeyState("d","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=50
Send {d down}
While (!GetKeyState("d","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("d","P") ; if you are holding w down physically, you don't want to send a w up keystroke
Send {d up}
}
return

~d up::
If ScriptActive = 1
{
if(GetKeyState("a","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=50
Send {a down}
While (!GetKeyState("a","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("a","P") ; if you are holding w down physically, you don't want to send a w up keystroke
Send {a up}
}
return

~s up::
If ScriptActive = 1
{
if(GetKeyState("w","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=50
Send {w down}
While (!GetKeyState("w","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("w","P") ; if you are holding w down physically, you don't want to send a w up keystroke
Send {w up}

}
return
CAPSLOCK:: SUSPEND
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help me with this script

07 Mar 2018, 11:13

Hallo,
only a try:

Code: Select all

ScriptActive = 1
~w up::
If ScriptActive = 1
{
	if(GetKeyState("s","P")) ; if w is pressed, do not perform sub
		return
	start:=A_TickCount
	start+=50
	Send {Blind}{s down}
	While (!GetKeyState("s","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
		Sleep 1
	If !GetKeyState("s","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
		Send {Blind}{s up}
}
return
~a up::
If ScriptActive = 1
{
	if(GetKeyState("d","P")) ; if w is pressed, do not perform sub
		return
	start:=A_TickCount
	start+=50
	Send {Blind}{d down}
	While (!GetKeyState("d","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
		Sleep 1
	If !GetKeyState("d","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
		Send {Blind}{d up}
}
return
~d up::
If ScriptActive = 1
{
	if(GetKeyState("a","P")) ; if w is pressed, do not perform sub
		return
	start:=A_TickCount
	start+=50
	Send {Blind}{a down}
	While (!GetKeyState("a","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
		Sleep 1
	If !GetKeyState("a","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
		Send {Blind}{a up}
}
return
~s up::
If ScriptActive = 1
{
	if(GetKeyState("w","P")) ; if w is pressed, do not perform sub
		return
	start:=A_TickCount
	start+=50
	Send {Blind}{w down}
	While (!GetKeyState("w","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
		Sleep 1
	If !GetKeyState("w","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
		Send {Blind}{w up}
}
return
CAPSLOCK:: SUSPEND
Future168
Posts: 2
Joined: 06 Mar 2018, 13:37

Re: Help me with this script

08 Mar 2018, 10:45

Dear Rohwedder! I've tried the fix and after 15min gameplay it seems actually working now. Im very thankful for helping, however i started to think adding new function to this script which works like this :
If i press RMOUSEBUTTON the following script will pause for that perioid of time and spams RMOUSEBUTTON for 15MS interwals. However there's one problem i want execute this MOUSEBUTTON function all time, but the counterstrafe part only certain situations. So basically i need :
1. Having RMOUSEBUTTON 15MS interwal 100% of time
2. choose when to pause/suspend and active again counterstrafe function without stopping the RMOUSEBUTTON function.
At the moment my suspend works only for both RMOUSEBUTTON and counterstrafe functions.
If somoene can help me with this

ScriptActive = 1

{
$RButton::
While GetKeyState("RButton","P")
{
ScriptActive = 0
Send {RButton}
Sleep, 15
}
ScriptActive = 1
Return
}

~w up::
If ScriptActive = 1
{
if(GetKeyState("s","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=45
Send {Blind}{s down}
While (!GetKeyState("s","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("s","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
Send {Blind}{s up}
}
return
~a up::
If ScriptActive = 1
{
if(GetKeyState("d","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=45
Send {Blind}{d down}
While (!GetKeyState("d","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("d","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
Send {Blind}{d up}
}
return
~d up::
If ScriptActive = 1
{
if(GetKeyState("a","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=45
Send {Blind}{a down}
While (!GetKeyState("a","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("a","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
Send {Blind}{a up}
}
return
~s up::
If ScriptActive = 1
{
if(GetKeyState("w","P")) ; if w is pressed, do not perform sub
return
start:=A_TickCount
start+=45
Send {Blind}{w down}
While (!GetKeyState("w","P") && A_TickCount<start) ; if w is pressed, exit this While loop. Exit after 100 ms regardless
Sleep 1
If !GetKeyState("w","P") ; if you are holding w down physically, you don't want to Send {Blind}a w up keystroke
Send {Blind}{w up}
}
return
CAPSLOCK:: SUSPEND
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help me with this script

09 Mar 2018, 04:24

Hallo,
replace:

Code: Select all

{
$RButton::
While GetKeyState("RButton","P")
{
ScriptActive = 0
Send {RButton}
Sleep, 15
}
ScriptActive = 1
Return
}
by

Code: Select all

$RButton::
	ScriptActive = 0
	SetTimer, TRButton, 15
Return
$RButton Up::
	SetTimer, TRButton, Off
	ScriptActive = 1
Return
TRButton:
	Send {RButton}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 100 guests