Advertisement
iWaffle

Darktide autosprint & toggle quell script, key customizable

Jan 14th, 2023 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 6.02 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. ; !!!! DO NOT USE THIS SCRIPT UNTIL YOU HAVE REPLACED THESE KEYS !!!!
  9.  
  10. ; Find and replace the following with whatever you have as your in-game keybinds - some keys dont exist ingame, for these keys, use whatever you want (refer to AutoHotkey API for actual AHK-usable keynames):
  11. ; 1_WALK = Hold to walk.                            Recommended: 'LAlt'
  12. ; 2_SPRINT = Sprint key.                           *Recommended: 'F7' (not recommended to use anything other than function keys)
  13. ; 3_RELOAD = Reload key.                           *Recommended: 'F8' (not recommended to use anything other than function keys)
  14. ; 3_ALTRELOAD = Alternate reload key.               Recommended: 'r' (note: serves as 2nd reload key, specific to this script, because dt only has 1 reload key)
  15. ; 4_SHOOT = Primary Fire key.                       Recommended: 'LButton' (mouse1)
  16. ; 5_SECONDARYFIRE = Secondary Fire.                 Recommended: 'RButton' (mouse2)
  17. ; 6_SUSPEND = Toggles the script on and off.        Recommended: 'F6'
  18. ; 7_PSYKERMODE = Toggles 'psyker mode'(auto-quell). Recommended: 'F4'
  19. ; 8_TOGGLEQUELLON = Toggles quell on.               Recommended: 'MButton' (middle mouse button)
  20. ; 9_CROUCH = Crouch key.                            Recommended: 'LShift'
  21.  
  22. ; These keys are used to facilitate Psyker mode, find & replace them even if you're not using it
  23. ; A_WEAPON1 = Primary Weapon key.               Recommended: '1'
  24. ; A_WEAPON2 = Secondary Weapon key.             Recommended: '2'
  25. ; A_DEPLOY = Deployable tool key.               Recommended: '3'
  26. ; A_AUSPEX = Auspex key.                        Recommended: '4'
  27. ; B_GRENADE = 'Blitz' key (grenade key).        Recommended: 'q'
  28. ; B_INTERACT = Interact key.                    Recommended: 'e'
  29. ; B_ABILITY = Ability key.                      Recommended: 'z'
  30.  
  31.  
  32. ; *Reason you should only use function keys for the script's reload/sprint:
  33. ;  The script continues sending these key-downs even if you're typing into in-game chat etc.
  34. ;  which means the key would show up in chat (unless you use function keys like what was recommended)
  35. ;  Note: for these situations, hit the 2_SPRINT and 3_RELOAD key on your keyboard to reset their state
  36. ;          (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)
  37.  
  38.  
  39.  
  40.  
  41. ; Use lowercase for this key (f6 not F6, don't ask me, ask AHK why this is a thing)
  42. 6_SUSPEND::
  43. suspend
  44. return
  45.  
  46. ; #IfWinActive, Warhammer 40,000: Darktide
  47.  
  48. psykerMode := false
  49. shooting := false
  50. sprinting := false
  51. quelling := false
  52.  
  53. #If (WinActive("Warhammer 40,000: Darktide"))
  54.  
  55. ; Toggle psykerMode (defaults to non-psyker mode on startup)
  56. ; use lowercase for this key (f4 not F4)
  57. 7_PSYKERMODE::
  58. psykerMode := !psykerMode
  59. if (psykerMode) {
  60.     SoundPlay *-1
  61.     Sleep 250
  62.     SoundPlay *-1
  63. } else
  64.     SoundPlay *-1
  65. return
  66.  
  67. ; Use to kickstart/restart the script when it jams in-game
  68. ~1_WALK::
  69. sprinting := false
  70. Send {2_SPRINT Up}
  71. shooting := false
  72. Gosub, releasequell
  73. return
  74.  
  75. ~1_WALK up::
  76. sprinting := true
  77. If (shooting = false){
  78.     Send {2_SPRINT Down}
  79. }
  80. return
  81.  
  82. ; Use to reset kickstart/restart autosprint when it jams in-game, intentionally made to coincide with crouch key so resets happen naturally and frequently
  83. ~*9_CROUCH::
  84. sprinting := false
  85. Send {F7 Up}
  86. shooting := false
  87. return
  88.  
  89. ~*9_CROUCH up::
  90. sprinting := true
  91. If (shooting = false){
  92.     Send {F7 Down}
  93. }
  94. return
  95.  
  96. ; Quell/reload toggle-ON for psykers only - perfectly mashable as it doesnt toggle-off if you mash it
  97. ~*8_TOGGLEQUELLON::
  98. if (psykerMode)
  99.     Gosub, startquell
  100. return
  101.  
  102. delayedreleasequell:
  103. if (GetKeyState("r", "P"))
  104.     return
  105. releasequell:
  106. Send {3_RELOAD Up}
  107. quelling := false
  108. SetTimer, releasequell, Off
  109. return
  110.  
  111. startquell:
  112. Send {3_RELOAD down}
  113. quelling := true
  114. SetTimer, delayedreleasequell, -3000
  115. return
  116.  
  117. ; Do not uncomment the 'staff'/secondary weapon key - this is so that quell carries over when you switch to staff
  118. ~*B_GRENADE::
  119. ~*B_INTERACT::
  120. ~*A_WEAPON1::
  121. ; ~*A_WEAPON2::
  122. ~*A_DEPLOY::
  123. ~*A_AUSPEX::
  124. ~*B_ABILITY::
  125. if (psykerMode)
  126.     Gosub, releasequell
  127. return
  128.  
  129. ; Alternate reload key
  130. ; Hold briefly to toggle-on quell, tap for normal reload, (also, do not hold for more than a second)
  131. ~*3_ALTRELOAD::
  132. if (!psykerMode) {
  133.     Send {3_RELOAD down}
  134.     return
  135. }
  136. Gosub, startquell
  137. If !Time
  138.     Time := A_TickCount
  139. return
  140.  
  141. ~*3_ALTRELOAD up::
  142. if (!psykerMode) {
  143.     Send {3_RELOAD up}
  144.     return
  145. }
  146. if ((A_TickCount - Time < 100) || (A_TickCount - Time > 1250)) {
  147.     Gosub, releasequell
  148. }
  149. ; else do nothing and quell is held down
  150. Time := ""
  151. return
  152.  
  153.  
  154. ; #If (sprinting and WinActive("Warhammer 40,000: Darktide"))
  155.  
  156. ~esc::
  157. Sleep, 100
  158. if(sprinting){
  159.     Send {2_SPRINT up}
  160.     Send {2_SPRINT down}
  161. }
  162. return
  163.  
  164. #MaxThreadsPerHotkey 40
  165. ~*4_SHOOT::            ;Shooting
  166. ~*5_SECONDARYFIRE::            ;SecondaryFire
  167. if (psykerMode)
  168.     Gosub, releasequell
  169. If (shooting < 2) {
  170.     shooting := shooting + 1
  171. }
  172. ; Sprint remains held down if holding Lclick/Rclick + forward movement (i.e. strafe keys not pressed)
  173. If !((GetKeyState("w", "P") && !(GetKeyState("a", "P") || GetKeyState("d", "P") || GetKeyState("5_SECONDARYFIRE", "P")))) {
  174.     Send {2_SPRINT Up}
  175. }
  176. return
  177.  
  178.  
  179. ~*4_SHOOT up::        ;Shooting
  180. ~*5_SECONDARYFIRE up::        ;SecondaryFire
  181. If (shooting > 0) {
  182.     shooting := shooting - 1
  183. }
  184.  
  185. 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)
  186. If (sprinting  && (shooting = 0)){
  187.     Send {2_SPRINT Down}
  188. }
  189. return
  190.  
  191. #If
  192.  
Tags: games Darktide
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement