Advertisement
Guest User

Untitled

a guest
Jun 21st, 2012
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #Persistent ; Keep this script running until the user explicitly exits it.
  2. SetTimer, WatchAxis, 5
  3. JoyStickID = 0
  4. return
  5.  
  6. WatchAxis:
  7. GetKeyState, %JoyStickID%JoyX, JoyX ; Get position of X axis.
  8. GetKeyState, %JoyStickID%JoyY, JoyY ; Get position of Y axis.
  9. KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
  10.  
  11. if JoyX > 70
  12. KeyToHoldDown = D
  13. else if JoyX < 30
  14. KeyToHoldDown = A
  15. else if JoyY > 70
  16. KeyToHoldDown = S
  17. else if JoyY < 30
  18. KeyToHoldDown = W
  19. else
  20. KeyToHoldDown =
  21.  
  22. if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down (or no key is needed).
  23. return ; Do nothing.
  24.  
  25. ; Otherwise, release the previous key and press down the new key:
  26. SetKeyDelay -1 ; Avoid delays between keystrokes.
  27. if KeyToHoldDownPrev ; There is a previous key to release.
  28. Send, {%KeyToHoldDownPrev% up} ; Release it.
  29. if KeyToHoldDown ; There is a key to press down.
  30. Send, {%KeyToHoldDown% down} ; Press it down.
  31. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement