Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Verison 1.0.0
- ; In order for this to work you will need to execute Autohotkey as Administrator.
- ; You might have to run Dead or Alive in windowed or borderless mode.
- #Persistent ; Keep this script running until the user explicitly exits it.
- SetTimer, WatchAxis, 50 ; set to 1000 for debug and activate the Tooltip
- return
- WatchAxis:
- GetKeyState, JoyX, JoyX ; Get position of X axis. left stick
- GetKeyState, JoyY, JoyY ; Get position of Y axis. left stick
- GetKeyState, JoyR, JoyR ; Get position of R axis. right stick
- GetKeyState, JoyZ, JoyZ ; Get position of Z axis. right stick
- KeyToHoldDownPrevX = %KeyToHoldDownX% ; Prev now holds the key that was down before (if any).
- KeyToHoldDownPrevY = %KeyToHoldDownY%
- KeyToHoldDownPrevR = %KeyToHoldDownR% ; Prev now holds the key that was down before (if any).
- KeyToHoldDownPrevZ = %KeyToHoldDownZ%
- KeyToHoldDownX =
- KeyToHoldDownY =
- KeyToHoldDownR =
- KeyToHoldDownZ =
- if JoyX > 70
- KeyToHoldDownX = Right
- else if JoyX < 30
- KeyToHoldDownX = Left
- if JoyY > 70
- KeyToHoldDownY = Down
- else if JoyY < 30
- KeyToHoldDownY = Up
- if JoyR > 70
- KeyToHoldDownR = d
- else if JoyR < 30
- KeyToHoldDownR = a
- if JoyZ > 70
- KeyToHoldDownZ = s
- else if JoyZ < 30
- KeyToHoldDownZ = w
- ; Tooltip, comment out next line to activate
- ; Tooltip, last released: %LastReleased% `nlast pressed %LastPressed% `ncurrent keys: %KeyToHoldDownPrevX% %KeyToHoldDownPrevY%-> %KeyToHoldDownX% %KeyToHoldDownY%
- if KeyToHoldDownX = %KeyToHoldDownPrevX% and KeyToHoldDownPrevY = %KeyToHoldDownPrevY% and KeyToHoldDownPrevR = %KeyToHoldDownPrevR% and KeyToHoldDownPrevZ = %KeyToHoldDownPrevZ% ; The correct key is already down (or no key is needed).
- return ; Do nothing.
- ; Otherwise, release the previous key and press down the new key:
- SetKeyDelay -1 ; Avoid delays between keystrokes.
- if (KeyToHoldDownPrevX or KeyToHoldDownPrevY){
- LastReleased = %KeyToHoldDownPrevX% %KeyToHoldDownPrevY%
- ; There is a previous key to release.
- Send, {%KeyToHoldDownPrevX% up}{%KeyToHoldDownPrevY% up} ; Release it.
- }
- if (KeyToHoldDownX or KeyToHoldDownY){
- LastPressed = %KeyToHoldDownX% %KeyToHoldDownY%
- ; There is a key to press down.
- Send, {%KeyToHoldDownX% down}{%KeyToHoldDownY% down} ; Press it down.
- }
- if (KeyToHoldDownPrevR or KeyToHoldDownPrevZ){
- LastReleased = %KeyToHoldDownPrevR% %KeyToHoldDownPrevZ%
- ; There is a previous key to release.
- Send, {%KeyToHoldDownPrevR% up}{%KeyToHoldDownPrevZ% up} ; Release it.
- }
- if (KeyToHoldDownR or KeyToHoldDownZ){
- LastPressed = %KeyToHoldDownR% %KeyToHoldDownZ%
- ; There is a key to press down.
- Send, {%KeyToHoldDownR% down}{%KeyToHoldDownZ% down} ; Press it down.
- }
- return
- Joy1::
- Send {j down}
- KeyWait Joy1 ; Wait for the user to release the joystick button.
- Send {j up}
- return
- Joy2::
- Send {k down}
- KeyWait Joy2 ; Wait for the user to release the joystick button.
- Send {k up}
- return
- Joy3::
- Send {m down}
- KeyWait Joy3 ; Wait for the user to release the joystick button.
- Send {m up}
- return
- Joy4::
- Send {l down}
- KeyWait Joy4 ; Wait for the user to release the joystick button.
- Send {l up}
- return
- Joy5::
- Send {u down}
- KeyWait Joy5 ; Wait for the user to release the joystick button.
- Send {u up}
- return
- Joy6::
- Send {n down}
- KeyWait Joy6 ; Wait for the user to release the joystick button.
- Send {n up}
- return
- Joy7::
- Send {i down}
- KeyWait Joy7 ; Wait for the user to release the joystick button.
- Send {i up}
- return
- Joy8::
- Send {o down}
- KeyWait Joy8 ; Wait for the user to release the joystick button.
- Send {o up}
- return
- Joy9::
- Send {Space down}
- KeyWait Joy9 ; Wait for the user to release the joystick button.
- Send {Space up}
- return
- Joy10::
- Send {Enter down}
- KeyWait Joy10 ; Wait for the user to release the joystick button.
- Send {Enter up}
- return
- Joy11::
- Send {E down}
- KeyWait Joy11 ; Wait for the user to release the joystick button.
- Send {E up}
- return
- Joy12::
- Send {Z down}
- KeyWait Joy12 ; Wait for the user to release the joystick button.
- Send {Z up}
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement