From c9bea265a39a68c6bf98c49d4bbdb480a953862e Mon Sep 17 00:00:00 2001 From: Spr_Aachen <2835946988@qq.com> Date: Sat, 26 Mar 2022 11:06:20 +0800 Subject: [PATCH] BH3_Hotkey.ahk --- BH3_Hotkey.ahk | 104 +++++++++++++++++++++++++++++++------- BH3_Hotkey_Simplified.ahk | 44 +++++++++++++--- 2 files changed, 122 insertions(+), 26 deletions(-) diff --git a/BH3_Hotkey.ahk b/BH3_Hotkey.ahk index f57b12d..f78dd24 100644 --- a/BH3_Hotkey.ahk +++ b/BH3_Hotkey.ahk @@ -150,27 +150,88 @@ If WinActive("ahk_exe BH3.exe") SendInput, {e Up} Return } - If (x1>x2) + Else If (x1>x2) { SendInput, {q Down} Sleep, 1 SendInput, {q Up} Return } - If (y1y2) + Else If (y1>y2) { SendInput, {n Down} Sleep, 1 SendInput, {n Up} Return } + Else If (x1y2) + { + SendInput, {e Down}{n Down} + Sleep, 1 + SendInput, {e Up}{n Up} + Return + } + Else If (x1>x2 and y1x2 and y1>y2) + { + SendInput, {q Down}{n Down} + Sleep, 1 + SendInput, {q Up}{n Up} + Return + } +} +Return + +AimControlTemp: +If WinActive("ahk_exe BH3.exe") +{ + MouseGetPos, x1, y1 + Sleep, 1 + MouseGetPos, x2, y2 + If (x1x2) + { + SendInput, {a Down}{d Up}{s Up}{w Up} + KeyWait, e, U + SendInput, {a Up} + } + Else If (y1y2) + { + SendInput, {w Down}{a Up}{s Up}{d Up} + KeyWait, e, U + SendInput, {w Up} + } } Return @@ -207,8 +268,9 @@ If (M_Toggle) SetTimer, ViewControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms) } } -KeyWait, LButton +KeyWait, LButton, U Send, {j Up} +SetTimer, ViewControlTemp, Off Return q:: ; 按下键盘Q键以发动必杀技 @@ -221,36 +283,42 @@ If (M_Toggle) SetTimer, ViewControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms) } } -KeyWait, q +KeyWait, q, U Send, {i Up} +SetTimer, ViewControlTemp, Off Return - -e:: ; 按下键盘E键以发动武器技/ 后崩坏书必杀技,长按E键进入瞄准模式时可通过键盘右侧方向键操控准心 -GetKeyState, State, e, P +e:: ; 按下键盘E键以发动武器技/ 后崩坏书必杀技,长按E键进入瞄准模式时可用鼠标键操控准心 Send, {u Down} -If (State=1) -{ - up::w - down::s - left::a - right::d -} If (M_Toggle) { If GetKeyState("e", "P") { SetTimer, ViewControl, Off - SetTimer, ViewControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms) + SetTimer, AimControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms) } } -KeyWait, e +KeyWait, e, U Send, {u Up} +SetTimer, AimControlTemp, Off Return z::l ; 按下键盘Z键以发动人偶技 -LShIft::k ; 按下键盘左侧ShIft键以发动闪避/冲刺 +LShIft:: ; 按下键盘左侧ShIft键以发动闪避/冲刺 +Send, {k Down} +If (M_Toggle) +{ + If GetKeyState("q", "P") + { + SetTimer, ViewControl, Off + SetTimer, ViewControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms) + } +} +KeyWait, LShIft, U +Send, {k Up} +SetTimer, ViewControlTemp, Off +Return RButton::k ; 点按鼠标右键以发动闪避/冲刺 diff --git a/BH3_Hotkey_Simplified.ahk b/BH3_Hotkey_Simplified.ahk index 6cf125a..06062a5 100644 --- a/BH3_Hotkey_Simplified.ahk +++ b/BH3_Hotkey_Simplified.ahk @@ -46,6 +46,8 @@ Return #IfWinActive ahk_exe BH3.exe ; 【宏条件】检测崩坏3游戏窗口,使程序仅在崩坏3游戏运行时生效 +Global M_Toggle=0 + ;--------------------------------------------------------------------------------------------------------------------------------------------------------------- SwitchIME(dwLayout) ; 该段用于管理输入法,请勿删改 @@ -132,46 +134,72 @@ If WinActive("ahk_exe BH3.exe") Return ViewControlTemp: -if WinActive("ahk_exe BH3.exe") +If WinActive("ahk_exe BH3.exe") { MouseGetPos, x1, y1 Sleep, 1 MouseGetPos, x2, y2 - if (x1x2) + Else If (x1>x2) { SendInput, {q Down} Sleep, 1 SendInput, {q Up} Return } - if (y1y2) + Else If (y1>y2) { SendInput, {n Down} Sleep, 1 SendInput, {n Up} Return } + Else If (x1y2) + { + SendInput, {e Down}{n Down} + Sleep, 1 + SendInput, {e Up}{n Up} + Return + } + Else If (x1>x2 and y1x2 and y1>y2) + { + SendInput, {q Down}{n Down} + Sleep, 1 + SendInput, {q Up}{n Up} + Return + } } Return ;--------------------------------------------------------------------------------------------------------------------------------------------------------------- -M_Toggle=0 - MButton:: ; 点击鼠标中键以激活视角跟随 M_Toggle:=!M_Toggle If (M_Toggle) @@ -203,7 +231,7 @@ If (M_Toggle) SetTimer, ViewControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms) } } -KeyWait, LButton +KeyWait, LButton, U Send, {j Up} Return