Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Persistent ; Keep this script running until the user explicitly exits it.
- SetTimer, WatchAxis, 5
- return
- WatchAxis:
- GetKeyState, JoyZ, JoyZ ; This gets the position of the gas pedal.
- KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
- if JoyZ < 30
- KeyToHoldDown = b
- else
- KeyToHoldDown =
- if KeyToHoldDown = %KeyToHoldDownPrev% ; 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 KeyToHoldDownPrev ; There is a previous key to release.
- Send, {%KeyToHoldDownPrev% up} ; Release it.
- if KeyToHoldDown ; There is a key to press down.
- Send, {%KeyToHoldDown% down} ; Press it down.
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement