Advertisement
Guest User

spysappenmyname's pedal

a guest
Jan 11th, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Persistent ; Keep this script running until the user explicitly exits it.
  2. SetTimer, WatchAxis, 5
  3. return
  4.  
  5. WatchAxis:
  6.  
  7. GetKeyState, JoyZ, JoyZ  ; This gets the position of the gas pedal.
  8.  
  9. KeyToHoldDownPrev = %KeyToHoldDown%  ; Prev now holds the key that was down before (if any).
  10.  
  11. if JoyZ < 30
  12.     KeyToHoldDown = b
  13. else
  14.     KeyToHoldDown =
  15.  
  16. if KeyToHoldDown = %KeyToHoldDownPrev%  ; The correct key is already down (or no key is needed).
  17.     return  ; Do nothing.
  18.  
  19. ; Otherwise, release the previous key and press down the new key:
  20.  
  21. SetKeyDelay -1  ; Avoid delays between keystrokes.
  22. if KeyToHoldDownPrev   ; There is a previous key to release.
  23.     Send, {%KeyToHoldDownPrev% up}  ; Release it.
  24.  
  25. if KeyToHoldDown   ; There is a key to press down.
  26.     Send, {%KeyToHoldDown% down}  ; Press it down.
  27. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement