Hi everyone, I want to create a script that sends two times right arrow key by pressing one time right button on D-pad of gamepad
similary sends two times left arrow key by pressing one time left button on D-pad
i tried editing the script for joystick on https://autohotkey.com/docs/misc/RemapJoystick.htm but didn't work. i don't know much about the scripting in AHK
Please anyone can do this...
twice arrow key by pressing once D-pad
Re: twice arrow key by pressing once D-pad
Code: Select all
lastValue := -1
Loop {
povValue := GetKeyState("1JoyPOV")
if (povValue != lastValue){
if (povValue == 90){
; POV is right
Send {Right 2}
} else if (povValue == 270){
; POV is left
Send {Left 2}
}
lastValue := povValue
}
Sleep 10
}
Re: twice arrow key by pressing once D-pad
Thanks for your reply, i tried this code but its not working. actually i wanted this script for my game(street fighter 5), it supposed to do dash in game but nothing happened i also tried it in text files but its not working......
Re: twice arrow key by pressing once D-pad
Did you try to send a single button to the game before trying to write the full script that sends sequences of buttons? Did that work? If so, what code did you use?
Re: twice arrow key by pressing once D-pad
FYI, this code will only work if your joystick is ID 1, I have no way of knowing what ID your stick is.
You may need to replace 1JoyPOV with 2JoyPOV or another number, depending on what ID your stick is.
Use PJP JoyIDs to find the ID of your stick.
You may need to replace 1JoyPOV with 2JoyPOV or another number, depending on what ID your stick is.
Use PJP JoyIDs to find the ID of your stick.
Re: twice arrow key by pressing once D-pad
i used PJP JoyIDs to find out the id and it was 1 and same in the code you provided. i tried to send two times right, left arrow keys by using below simple code and it works in the game(dashes occur) for buttons those have simple names like joy11, joy2 etc but not for the d-pad button because d-pad button has no simple names in autohotkey, d-pad has very complicated names like pov9000, pov22501 to pov 4501 etc and when i use these names in below code it does not work....
#MaxThreadsPerHotkey 2
Joy11::
{
Send {right down}
Sleep 2
Send {right up}
Sleep 2
Send {right down}
Sleep 2
Send {right up}
}
return
#MaxThreadsPerHotkey 2
Joy11::
{
Send {right down}
Sleep 2
Send {right up}
Sleep 2
Send {right down}
Sleep 2
Send {right up}
}
return
Re: twice arrow key by pressing once D-pad
No it is not complicated. Joystick POV reports in degrees. the same as a compass does.
It's just multiplied by 100. So 90 degrees (East) is 9000
There are no hotkeys for joystick axes or POVs, you have to continually check their state in a loop
It's just multiplied by 100. So 90 degrees (East) is 9000
There are no hotkeys for joystick axes or POVs, you have to continually check their state in a loop