Autohotkey 缺少按键

问题描述

所以我正在尝试为铁拳 7 练习模式编写脚本。

我的目标是输入 5 个整数,代表所选角色的移动列表中的 5 个移动。

我希望脚本选择重复动作并选择指定的动作。问题是,自动热键(似乎随机只是跳过了几个按键,所以从那里偏移会弄乱其他一切。脚本非常简单,所以我真的不知道我能做些什么来使这项工作正常进行。

基本上我只有几个功能,用于在菜单中向上/向下移动、在页面之间移动(在移动列表上一次移动 8 次)、按几次 Enter 键,就是这样。

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
; SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

TopLong()
{
    Send {w down}
    Sleep 3000
    Send {w up}
}

TopShort()
{
    Send {w down}
    Sleep 1000
    Send {w up}
}

BottomLong()
{
    Send {s down}
    Sleep 3000
    Send {s up}
}

Up(count:=1)
{
    Loop %count%
    {
        Send {w down}
        Sleep 1
        Send {w up}
        Sleep 1000
    }
}

Down(count:=1)
{
    Loop %count%
    {
        Send {s down}
        Sleep 1
        Send {s up}
        Sleep 1000
    }
}

PageUp(count:=1)
{
    Loop %count%
    {
        Send {p down}
        Sleep 1
        Send {p up}
        Sleep 1000
    }
}

PageDown(count:=1)
{
    Loop %count%
    {
        Send {o down}
        Sleep 1
        Send {o up}
        Sleep 1000
    }
}

Enter()
{
    Sleep 1000
    Send {Enter down}
    Sleep 1
    Send {Enter up}
    Sleep 1000
}

SetRepeatAction()
{
    TopLong()
    Enter()
    BottomLong()
    Enter()
}

SelectMoveList()
{
    Down()
    Enter()
    Up()
    Enter()
}

SelectMove(currentMoveNumber,moveNumber)
{
    if(currentMoveNumber != moveNumber)
    {
        if(currentMoveNumber < moveNumber)
        {
            moveDiff := moveNumber - currentMoveNumber
            PageDown(moveDiff/8)
            Down(Mod(moveDiff,8))
        }
        else
        {
            moveDiff := currentMoveNumber - moveNumber
            PageUp(moveDiff/8)
            Up(Mod(moveDiff,8))
        }
        Enter()
    }
}

SetMoves(movesToPractice)
{
    SetRepeatAction()
    currentMoveNumber := 1
    SelectMoveList()
    Loop 5
    {
        SelectMoveList()
        if(A_Index = 1)
        {
            PageUp()
        }
        SelectMove(currentMoveNumber,movesToPractice[A_Index])
        currentMoveNumber := movesToPractice[A_Index]
    }
}

IfWinExist,TEKKEN 7
{
    WinActivate
    
    movesToPractice := []
    movesToPractice.Push(9) ; 9
    movesToPractice.Push(23) ; 23
    movesToPractice.Push(60) ; 59
    movesToPractice.Push(81) ; 80
    movesToPractice.Push(32) ; 31
    SetMoves(movesToPractice)
}

; cpu action Stand
; Moves not set

尝试使用 Sleep 添加更长的停留时间,但至少对我来说,错过的输入似乎是随机的。

我注意到我需要调用 Sleep 才能使键上/下功能工作,这就是为什么它们是分开编写的。我一直在寻找其他解决方案,但不幸的是,由于 Directx 的直接输入事件循环,我无法使用其他方法,只有 autohotkey 有效,但似乎有问题。

我怎样才能做到这一点?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...