Skip to content

Commit

Permalink
BH3_Hotkey.ahk
Browse files Browse the repository at this point in the history
  • Loading branch information
Spr-Aachen committed Mar 26, 2022
1 parent 0fe940d commit c9bea26
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 26 deletions.
104 changes: 86 additions & 18 deletions BH3_Hotkey.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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 (y1<y2)
Else If (y1<y2)
{
SendInput, {m Down}
Sleep, 1
SendInput, {m Up}
Return
}
If (y1>y2)
Else If (y1>y2)
{
SendInput, {n Down}
Sleep, 1
SendInput, {n Up}
Return
}
Else If (x1<x2 and y1<y2)
{
SendInput, {e Down}{m Down}
Sleep, 1
SendInput, {e Up}{m Up}
Return
}
Else If (x1<x2 and y1>y2)
{
SendInput, {e Down}{n Down}
Sleep, 1
SendInput, {e Up}{n Up}
Return
}
Else If (x1>x2 and y1<y2)
{
SendInput, {q Down}{m Down}
Sleep, 1
SendInput, {q Up}{m Up}
Return
}
Else If (x1>x2 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 (x1<x2)
{
SendInput, {d Down}{a Up}{s Up}{w Up}
KeyWait, e, U
SendInput, {d Up}
}
Else If (x1>x2)
{
SendInput, {a Down}{d Up}{s Up}{w Up}
KeyWait, e, U
SendInput, {a Up}
}
Else If (y1<y2)
{
SendInput, {s Down}{a Up}{w Up}{d Up}
KeyWait, e, U
SendInput, {s Up}
}
Else If (y1>y2)
{
SendInput, {w Down}{a Up}{s Up}{d Up}
KeyWait, e, U
SendInput, {w Up}
}
}
Return

Expand Down Expand Up @@ -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键以发动必杀技
Expand All @@ -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 ; 点按鼠标右键以发动闪避/冲刺

Expand Down
44 changes: 36 additions & 8 deletions BH3_Hotkey_Simplified.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Return

#IfWinActive ahk_exe BH3.exe ; 【宏条件】检测崩坏3游戏窗口,使程序仅在崩坏3游戏运行时生效

Global M_Toggle=0

;---------------------------------------------------------------------------------------------------------------------------------------------------------------

SwitchIME(dwLayout) ; 该段用于管理输入法,请勿删改
Expand Down Expand Up @@ -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 (x1<x2)
If (x1<x2)
{
SendInput, {e Down}
Sleep, 1
SendInput, {e Up}
Return
}
if (x1>x2)
Else If (x1>x2)
{
SendInput, {q Down}
Sleep, 1
SendInput, {q Up}
Return
}
if (y1<y2)
Else If (y1<y2)
{
SendInput, {m Down}
Sleep, 1
SendInput, {m Up}
Return
}
if (y1>y2)
Else If (y1>y2)
{
SendInput, {n Down}
Sleep, 1
SendInput, {n Up}
Return
}
Else If (x1<x2 and y1<y2)
{
SendInput, {e Down}{m Down}
Sleep, 1
SendInput, {e Up}{m Up}
Return
}
Else If (x1<x2 and y1>y2)
{
SendInput, {e Down}{n Down}
Sleep, 1
SendInput, {e Up}{n Up}
Return
}
Else If (x1>x2 and y1<y2)
{
SendInput, {q Down}{m Down}
Sleep, 1
SendInput, {q Up}{m Up}
Return
}
Else If (x1>x2 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)
Expand Down Expand Up @@ -203,7 +231,7 @@ If (M_Toggle)
SetTimer, ViewControlTemp, 0 ; [[可调校数值]] 设定视角跟随命令的每执行间隔时间(ms)
}
}
KeyWait, LButton
KeyWait, LButton, U
Send, {j Up}
Return

Expand Down

0 comments on commit c9bea26

Please sign in to comment.