-
-
Save ocirne23/11335307 to your computer and use it in GitHub Desktop.
#SingleInstance Force | |
#MaxHotkeysPerInterval 99999 | |
#IfWinActive ahk_class DarkSouls2 | |
; AutoHotkey script to remove input lag from DarkSouls2 PC, and adds | |
; hotkeys for Guard break / Jump Attack | |
; | |
; Current settings (some can be easily changed) | |
; LMB / RMB = normal attacks | |
; Shift + LMB / RMB = strong attacks | |
; Alt + LMB / RMB = swap weapon | |
; Wheel down/up = swap item / spell | |
; MMB = lock target | |
; Alt + Wheel down/up = cycle targets | |
; Q = guard break | |
; C = jump attack | |
; All current keybindings are set to match the Dark Souls 2 default keybindings | |
; All that needs to be done is unbinding all the mouse bindings in game while | |
; keeping the rest default. Note: Change the 'Walk' keybinding from Alt to something else. | |
; These can be modified, must be valid Autohotkey buttons | |
STRONG_MODIFIER = LShift | |
SWAP_MODIFIER = LAlt | |
LEFT_BUTTON = LBUTTON | |
RIGHT_BUTTON = RBUTTON | |
CYCLE_TARGET_MODIFIER = LAlt ; Cycling targets is done while holding this and scrolling up/down | |
; Link to action of choice in game, lowercase | |
SCROLL_UP = Up | |
SCROLL_DOWN = Down | |
; Default is Target Lock | |
MMB_CLICK = o | |
; These must match the bindings in the options menu, lowercase. | |
RIGHT = h | |
RIGHT_STRONG = g | |
LEFT = u | |
LEFT_STRONG = y | |
RIGHT_SWAP = Right | |
LEFT_SWAP = Left | |
NEXT_TARGET_LEFT = j | |
NEXT_TARGET_RIGHT = l | |
attackedLeft := false | |
attackedRight := false | |
; Guard Break. Can change Q to whatever | |
Q:: | |
{ | |
wasWalking := GetKeyState("w", "P") | |
if wasWalking | |
{ | |
Send {w up} | |
Sleep 150 | |
} | |
Send {w down} | |
Sleep 20 | |
Send {%RIGHT% down} | |
Sleep 20 | |
Send {%RIGHT% up} | |
if not wasWalking | |
{ | |
Sleep 20 | |
Send {w up} | |
} | |
return | |
} | |
; Jump Attack. Can change C to whatever | |
C:: | |
{ | |
wasWalking := GetKeyState("w", "P") | |
if wasWalking | |
{ | |
Send {w up} | |
Sleep 150 | |
} | |
Send {w down} | |
Sleep 20 | |
Send {%RIGHT_STRONG% down} | |
Sleep 20 | |
Send {%RIGHT_STRONG% up} | |
if not wasWalking | |
{ | |
Sleep 20 | |
Send {w up} | |
} | |
return | |
} | |
hasStrongModifierPressed() | |
{ | |
global STRONG_MODIFIER | |
return GetKeyState(STRONG_MODIFIER, "P") | |
} | |
doLeftAttackButton() | |
{ | |
global LEFT | |
global LEFT_STRONG | |
global attackedLeft | |
if not attackedLeft | |
{ | |
attackedLeft := true | |
if hasStrongModifierPressed() | |
{ | |
Send {%LEFT_STRONG% down} | |
} | |
else | |
{ | |
Send {%LEFT% down} | |
} | |
} | |
return | |
} | |
doRightAttackButton() | |
{ | |
global RIGHT | |
global RIGHT_STRONG | |
global attackedRight | |
if not attackedRight | |
{ | |
attackedRight := true | |
if hasStrongModifierPressed() | |
{ | |
Send {%RIGHT_STRONG% down} | |
} | |
else | |
{ | |
Send {%RIGHT% down} | |
} | |
} | |
return | |
} | |
*~LButton:: | |
{ | |
global LEFT | |
global LEFT_STRONG | |
global LEFT_SWAP | |
global RIGHT | |
global RIGHT_STRONG | |
global LEFT_BUTTON | |
global RIGHT_BUTTON | |
global attackedLeft | |
global attackedRight | |
swap := GetKeyState(SWAP_MODIFIER, "P") | |
while GetKeyState(LEFT_BUTTON, "P") | |
{ | |
if swap | |
{ | |
Send {%LEFT_SWAP% down} | |
Sleep 50 | |
Send {%LEFT_SWAP% up} | |
swap := false | |
break | |
} | |
doLeftAttackButton() | |
if GetKeyState(RIGHT_BUTTON, "P") | |
{ | |
doRightAttackButton() | |
} | |
else | |
{ | |
Send {%RIGHT% up} | |
Send {%RIGHT_STRONG% up} | |
attackedRight := false | |
} | |
} | |
Send {%LEFT% up} | |
Send {%LEFT_STRONG% up} | |
attackedLeft := false | |
if not GetKeyState(RIGHT_BUTTON, "P") | |
{ | |
attackedRight := false | |
} | |
return | |
} | |
*~RButton:: | |
{ | |
global LEFT | |
global LEFT_STRONG | |
global RIGHT | |
global RIGHT_STRONG | |
global RIGHT_SWAP | |
global LEFT_BUTTON | |
global RIGHT_BUTTON | |
global attackedRight | |
global attackedLeft | |
swap := GetKeyState(SWAP_MODIFIER, "P") | |
while GetKeyState(RIGHT_BUTTON, "P") | |
{ | |
if swap | |
{ | |
Send {%RIGHT_SWAP% down} | |
Sleep 50 | |
Send {%RIGHT_SWAP% up} | |
swap := false | |
break | |
} | |
doRightAttackButton() | |
if GetKeyState(LEFT_BUTTON, "P") | |
{ | |
doLeftAttackButton() | |
} | |
else | |
{ | |
Send {%LEFT% up} | |
Send {%LEFT_STRONG% up} | |
attackedLeft := false | |
} | |
} | |
Send {%RIGHT% up} | |
Send {%RIGHT_STRONG% up} | |
attackedRight := false | |
if not GetKeyState(LEFT_BUTTON, "P") | |
{ | |
attackedLeft := false | |
} | |
return | |
} | |
MButton:: | |
{ | |
global MMB_CLICK | |
Send {%MMB_CLICK% down} | |
Sleep 20 | |
Send {%MMB_CLICK% up} | |
return | |
} | |
~WheelUp:: | |
{ | |
global SCROLL_UP | |
global CYCLE_TARGET_MODIFIER | |
global NEXT_TARGET_LEFT | |
if GetKeyState(CYCLE_TARGET_MODIFIER, "P") | |
{ | |
Send {%NEXT_TARGET_LEFT% down} | |
Sleep 20 | |
Send {%NEXT_TARGET_LEFT% up} | |
} | |
else | |
{ | |
Send {%SCROLL_UP% down} | |
Sleep 20 | |
Send {%SCROLL_UP% up} | |
} | |
return | |
} | |
~WheelDown:: | |
{ | |
global SCROLL_DOWN | |
global CYCLE_TARGET_MODIFIER | |
global NEXT_TARGET_RIGHT | |
if GetKeyState(CYCLE_TARGET_MODIFIER, "P") | |
{ | |
Send {%NEXT_TARGET_RIGHT% down} | |
Sleep 20 | |
Send {%NEXT_TARGET_RIGHT% up} | |
} | |
else | |
{ | |
Send {%SCROLL_DOWN% down} | |
Sleep 20 | |
Send {%SCROLL_DOWN% up} | |
} | |
return | |
} | |
; We want to block native alt input or windows will make a beep every | |
; time you press any button + alt | |
*LAlt:: | |
{ | |
return | |
} | |
; Alt tab and alt escape gets enabled here | |
Tab:: | |
{ | |
if GetKeyState("LAlt", "P") | |
{ | |
; Still not very pretty, but makes sure alt gets released properly | |
Send {LAlt down}{TAB}{TAB}{LAlt up} | |
} | |
} | |
~Escape:: | |
{ | |
if GetKeyState("LAlt", "P") | |
{ | |
Send, {LAlt up}{ESCAPE} | |
} | |
} |
Q and C doesn't seem to work. I think the game simply filters out any keys not bound to anything. I don't know how to work around this.
The script is working outside Dark Souls 2 (I removed the #IsWinActive part) but inside the game nothing happens. The rest of the stuff is working.
Update: nevermind, it works with ~Q::
Hi ocirne23. Thank you so much for such a useful script for this broken game.
I can't get it to work though. I only need Guard Break and Jump Attack. I changed Q to Joy9 (left stick button of my joystick) and C to Space but they don't work in the game. They work outside like in this text box and in a notepad.
I only want Joy9 to perform w,h and Space to perform w,g and that's all. Do you know how to get this work? I'm using Logitech F310 if that matters.
And what are these three lines by the way?
SingleInstance Force
MaxHotkeysPerInterval 99999
IfWinActive ahk_class DarkSouls2
Thank you so much.
EDIT: For anyone getting Error for the script - download latest version here
http://ahkscript.org/download/
hours of headache for a rookie mistake..
can u config this script into a new one that strong attack is alt and swap is shift? pls becuz i can't do it
Has anyone else got an issue where shift+leftClick turns on autowalk whereas if I try shift+z, I get the normal action?
EDIT: Source of the problem is my QWERTZ keyboard. Just swap the ingame bindings for auto-run and heavy-left attack.