heat-sig-bash-dash/bash-dash.ahk

94 lines
2.5 KiB
AutoHotkey

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; IMPROVED BASH DASH SCRIPT ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; By monorail
;
; Performs inputs for a bash dash when a keyboard key bound to "Menu Click" is pressed
; Holds "Slow Mo" key until that key is released
; Presses "Inventory" key when that key is released
;
; To use:
; - In Heat Signature, bind "Menu Click" to the key you want to use for bash dashing
; - You don't have to unbind left click
; - Chosen because I expect it's not used very much
; - When ready to bash dash, go into throw mode with your melee weapon in slot 1
; - Press and hold the key you bound to "Menu Click". A bash dash will be performed in slow motion
; - Release the key when the bash dash is complete. Slow motion will end and the inventory menu will pop up again
;
; If you ever change your keybinds, you will have to reload this script
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The rest of this file is code ;
; If you just want to use the ;
; script then you can stop reading ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; -2 = Not yet found
; -1 = Next keybind definition is for this control
; Else = Keycode found
InventoryKey := -2
MoveKey := -2
SlowMoKey := -2
BashDashKey := -2
; Parsing controls directly out of the Heat Sig control config file
Loop, read, %APPDATA%\Heat_Signature\Controls.txt
{
; If we reach the name of a control we care about,
; remember that we reached it, so we can save the
; keycode next time we see one
If InStr(A_LoopReadLine, "Name = ")
{
ControlName := SubStr(A_LoopReadLine, 8)
If (ControlName == "Inventory")
{
InventoryKey := -1
}
If (ControlName == "Move Left")
{
MoveKey := -1
}
If (ControlName == "Slow Mo")
{
SlowMoKey := -1
}
If (ControlName == "Menu Click")
{
BashDashKey := -1
}
}
; If we reach a keycode, if we just saw the name
; of a control we care about, save that keycode
If InStr(A_LoopReadLine, "KeyboardButton = ")
{
ControlKey := GetKeyName(Chr(SubStr(A_LoopReadLine, 18)))
If (InventoryKey == -1) {
InventoryKey := ControlKey
}
If (MoveKey == -1) {
MoveKey := ControlKey
}
If (SlowMoKey == -1) {
SlowMoKey := ControlKey
}
If (BashDashKey == -1) {
BashDashKey := ControlKey
}
}
}
SendMode Input
#If WinActive("ahk_exe heat_signature.exe")
Hotkey, %BashDashKey%, BashDashLabel
Return
BashDashLabel:
Send, {Click}{%MoveKey%}
Send {%SlowMoKey% down}
KeyWait %BashDashKey%
Send {%SlowMoKey% up}
Send {%InventoryKey%}
Return