Advertisement
ZorbaTHut

World of Tanks swap-direction-on-reverse

Mar 8th, 2013
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. ; HEY, LISTEN
  2. ;
  3. ; This is an AutoHotkey script built for World of Tanks. The purpose is to reverse your turning controls while driving backwards.
  4. ;
  5. ; "but why do you want that you are an idiot"
  6. ;
  7. ; It's so if you're hitting the "left" key, then the front of your tank always turns left, whether you're driving forwards or backwards or standing still.
  8. ; By default, hitting the "left" key and driving backwards makes you turn right. I think this is silly! So I fixed it.
  9. ;
  10. ; "wow cool so I guess I just plug this into autohotkey and it works"
  11. ;
  12. ; Nope, not quite that simple.
  13. ;
  14. ; First: Plug it into AutoHotkey.
  15. ; Second: Go into the WoT config and change your normal WASD movement keys to YGHJ.
  16. ; Don't *use* YGHJ - use WASD and this script will map them to the appropriate YGHJ keys.
  17. ;
  18. ; Known issues:
  19. ;
  20. ; * If you have the window focused and are trying to type text, your text will be garbled. You'll need to disable the script by turning scroll lock on. Then turn it back off to drive.
  21. ; * If they ever rename the WoT window, the script will break.
  22. ; * It's pretty dang inefficient, but it still uses an unmeasurable amount of CPU on my computer, so I don't care.
  23. ; * If you have a single-core computer it might have jerky results. Sorry! Go upgrade.
  24. ; * Does not detect the automatic-throttle behavior, only manual driving.
  25. ;
  26. ; I have no idea if this is technically permitted by the WoT admins but it's such a small change that I'd be amazed if it was banned.
  27.  
  28. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  29. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  30. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  31. #SingleInstance force ; Force reopen script instance
  32.  
  33. SetKey(key, state)
  34. {
  35. cstate := GetKeyState(key)
  36.  
  37. ;OutputDebug %key%, %cstate%, %state%
  38.  
  39. if cstate && !state
  40. Send {%key% Up}
  41.  
  42. if !cstate && state
  43. Send {%key% Down}
  44. }
  45.  
  46. Resync()
  47. {
  48. wantw := GetKeyState("w", "P")
  49. wants := GetKeyState("s", "P")
  50.  
  51. if wants {
  52. wanta := GetKeyState("d", "P")
  53. wantd := GetKeyState("a", "P")
  54. } else {
  55. wanta := GetKeyState("a", "P")
  56. wantd := GetKeyState("d", "P")
  57. }
  58.  
  59. SetKey("y", wantw)
  60. SetKey("h", wants)
  61. SetKey("g", wanta)
  62. SetKey("j", wantd)
  63. }
  64.  
  65. Loop
  66. {
  67. WinGetActiveTitle, title
  68. j := RegExMatch(title, "W.o.T.")
  69. If j {
  70. If !GetKeyState("Scrolllock", "T") {
  71. Resync()
  72. }
  73. }
  74.  
  75. Sleep 1
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement