Advertisement
iWaffle

Darktide autosprint & toggle quell script, my personal keybind (non-customizable)

Jan 14th, 2023 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 5.38 KB | Source Code | 0 0
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. #MaxThreads 50
  6. #MenuMaskKey vk07
  7.  
  8. ;
  9. ; LAlt = Hold to walk key.                      Recommended: 'LAlt'
  10. ; F7 = (In-game) Sprint key.                   *Recommended: 'F7' (not recommended to use anything other than function keys)
  11. ; F8 = (In-game) Reload key.                   *Recommended: 'F8' (not recommended to use anything other than function keys)
  12. ; R = Alternate reload key.                     Recommended: 'r' (note: serves as 2nd reload key, specific to this script, because dt only has 1 reload key)
  13. ; Left click = Primary Fire key.                Recommended: 'LButton' (mouse1)
  14. ; Right click = Secondary Fire.                 Recommended: 'RButton' (mouse2)
  15. ; F6 = Toggles the script on and off.           Recommended: 'F6'
  16. ; F4 = Toggles 'psyker mode'(auto-quell).       Recommended: 'F4'
  17. ; Middle Mouse Button = Toggles quell on.       Recommended: 'MButton' (middle mouse button)
  18. ; LShift = Crouch key.                          Recommended: 'LShift'
  19.  
  20. ; These keys are used to facilitate Psyker mode, find & replace them even if you're not using it
  21. ; 1 = Primary Weapon key.                       Recommended: '1'
  22. ; 2 = Secondary Weapon key.                     Recommended: '2'
  23. ; 3 = Deployable tool key.                      Recommended: '3'
  24. ; 4 = Auspex key.                               Recommended: '4'
  25. ; q = 'Blitz' key (grenade key).                Recommended: 'q'
  26. ; e = Interact key.                             Recommended: 'e'
  27. ; z = Ability key.                              Recommended: 'z'
  28.  
  29.  
  30. ; *Reason you should only use function keys for the script's reload/sprint:
  31. ;  The script continues sending these key-downs even if you're typing into in-game chat etc.
  32. ;  which means the key would show up in chat (unless you use function keys like what was recommended)
  33. ;  Note: for these situations, hit the F7 and F8 key on your keyboard to reset their state
  34. ;          (you can also suspend the script to prevent it from holding it down again, good for when you alt-tab and need to know these keys aren't being held down)
  35.  
  36. f6::
  37. suspend
  38. return
  39.  
  40. ; #IfWinActive, Warhammer 40,000: Darktide
  41.  
  42. psykerMode := false
  43. shooting := false
  44. sprinting := false
  45. quelling := false
  46.  
  47. #If (WinActive("Warhammer 40,000: Darktide"))
  48.  
  49. ; Toggle psykerMode (defaults to non-psyker mode on startup)
  50. f4::
  51. psykerMode := !psykerMode
  52. if (psykerMode) {
  53.     SoundPlay *-1
  54.     Sleep 250
  55.     SoundPlay *-1
  56. } else
  57.     SoundPlay *-1
  58. return
  59.  
  60. ; Use to kickstart/restart the script when it jams in-game
  61. ~LAlt::
  62. sprinting := false
  63. Send {F7 Up}
  64. shooting := false
  65. Gosub, releasequell
  66. return
  67.  
  68. ~LAlt up::
  69. sprinting := true
  70. If (shooting = false){
  71.     Send {F7 Down}
  72. }
  73. return
  74.  
  75. ; Use reset kickstart/restart autosprint when it jams in-game, intentionally made to coincide with crouch key so resets happen naturally and frequently
  76. ~*LShift::
  77. sprinting := false
  78. Send {F7 Up}
  79. shooting := false
  80. return
  81.  
  82. ~*LShift up::
  83. sprinting := true
  84. If (shooting = false){
  85.     Send {F7 Down}
  86. }
  87. return
  88.  
  89. ; Quell/reload toggle-ON for psykers only - perfectly mashable as it doesnt toggle-off if you mash it
  90. ~*MButton::
  91. if (psykerMode)
  92.     Gosub, startquell
  93. return
  94.  
  95. delayedreleasequell:
  96. if (GetKeyState("r", "P"))
  97.     return
  98. releasequell:
  99. Send {F8 Up}
  100. quelling := false
  101. SetTimer, releasequell, Off
  102. return
  103.  
  104. startquell:
  105. Send {F8 down}
  106. quelling := true
  107. SetTimer, delayedreleasequell, -3000
  108. return
  109.  
  110. ; Do not uncomment the 'staff'/secondary weapon key - this is so that quell carries over when you switch to staff
  111. ~*q::
  112. ~*e::
  113. ~*1::
  114. ; ~*2::
  115. ~*3::
  116. ~*4::
  117. ~*z::
  118. if (psykerMode)
  119.     Gosub, releasequell
  120. return
  121.  
  122. ; Alternate reload key
  123. ; Hold briefly to toggle-on quell, tap for normal reload, (also, do not hold for more than a second)
  124. ~*r::
  125. if (!psykerMode) {
  126.     Send {F8 down}
  127.     return
  128. }
  129. Gosub, startquell
  130. If !Time
  131.     Time := A_TickCount
  132. return
  133.  
  134. ~*r up::
  135. if (!psykerMode) {
  136.     Send {F8 up}
  137.     return
  138. }
  139. if ((A_TickCount - Time < 100) || (A_TickCount - Time > 1250)) {
  140.     Gosub, releasequell
  141. }
  142. ; else do nothing and quell is held down
  143. Time := ""
  144. return
  145.  
  146.  
  147. ; #If (sprinting and WinActive("Warhammer 40,000: Darktide"))
  148.  
  149. ~esc::
  150. Sleep, 100
  151. if(sprinting){
  152.     Send {F7 up}
  153.     Send {F7 down}
  154. }
  155. return
  156.  
  157. #MaxThreadsPerHotkey 40
  158. ~*LButton::            ;Shooting
  159. ~*RButton::            ;SecondaryFire
  160. if (psykerMode)
  161.     Gosub, releasequell
  162. If (shooting < 2) {
  163.     shooting := shooting + 1
  164. }
  165. ; Sprint remains held down if holding Lclick/Rclick + forward movement (i.e. strafe keys not pressed)
  166. If !((GetKeyState("w", "P") && !(GetKeyState("a", "P") || GetKeyState("d", "P") || GetKeyState("RButton", "P")))) {
  167.     Send {F7 Up}
  168. }
  169. return
  170.  
  171.  
  172. ~*LButton up::        ;Shooting
  173. ~*RButton up::        ;SecondaryFire
  174. If (shooting > 0) {
  175.     shooting := shooting - 1
  176. }
  177.  
  178. Sleep, 650        ;Delay before sprinting again. Prevents issues where sprinting may interfere with firing or meleeing. Adjust higher if problems are encountered (values below 650 not recommended unless you know what you are doing)
  179. If (sprinting  && (shooting = 0)){
  180.     Send {F7 Down}
  181. }
  182. return
  183.  
  184. #If
  185.  
Tags: games Darktide
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement