【发布时间】:2016-03-15 17:25:50
【问题描述】:
我正在尝试创建热键来模拟我正在玩的在线游戏中的输入缓冲,该游戏本身不支持输入缓冲,这意味着混合一个拼写键,以便在上一个拼写完成施法后它会消失是手动操作的最佳方法。
在热键的帮助下,我可以通过按住我的键以最小的延迟循环按键,以便它在我完成施放上一个咒语的瞬间发送。
但是,为我在键盘上绑定到一个咒语的每个按钮创建多个热键似乎很乏味,我不确定如何使用一组定义的键(即 1 到 6,以及 F1 到F6)
到目前为止,我的代码的示例 sn-p 只考虑了 3 个键:
$5::
{
Loop
{
Loop, 5
{
Send, 5
Sleep, 1
}
GetKeyState, state, 5
if state = U
break
}
return
}
$2::
{
Loop
{
Loop, 5
{
Send, 2
Sleep, 1
}
GetKeyState, state, 2
if state = U
break
}
return
}
$F2::
{
Loop
{
Loop, 5
{
Send, {F2}
Sleep, 1
}
GetKeyState, state, F2
if state = U
break
}
return
}
如果可能的话,我正在尝试将其浓缩成这样的东西:
hotkeys := [5, 2, F2]
hotkeyCount := hotkeys.MaxIndex()
curKey := 1
Loop, hotkeyCount
{
hotkeyIndex := hotkeys[curKey]
$%hotkeyIndex%::
{
Loop
{
Loop, 5
{
Send, {%hotkeyIndex%}
Sleep, 1
}
GetKeyState, state, %hotkeyIndex%
if state = U
break
}
return
}
curKey := curKey + 1
}
【问题讨论】:
标签: autohotkey