{"record":{"id":"8f3e0cca46314629","repo":"babalae/better-genshin-impact","slug":"method-alias-0-virtualkeycodes","errorCode":null,"errorMessage":"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值，当前入参 {Args[0]} 不合法","messagePattern":"(.+?)方法的入参必须是VirtualKeyCodes枚举中的值，当前入参 (.+?) 不合法","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoFight/Script/CombatCommand.cs","lineNumber":67,"sourceCode":"        }\n        else if (Method == Method.W || Method == Method.A || Method == Method.S || Method == Method.D)\n        {\n            AssertUtils.IsTrue(Args.Count == 1, \"w/a/s/d方法必须有一个入参，代表行走时间。例：d(0.5)\");\n        }\n        else if (Method == Method.MoveBy)\n        {\n            AssertUtils.IsTrue(Args.Count == 2, \"moveby方法必须有两个入参，分别是x和y。例：moveby(100, 100))\");\n        }\n        else if (Method == Method.KeyDown || Method == Method.KeyUp || Method == Method.KeyPress)\n        {\n            AssertUtils.IsTrue(Args.Count == 1, $\"{Method.Alias[0]}方法必须有一个入参，代表按键\");\n            try\n            {\n                User32Helper.ToVk(Args[0]);\n            }\n            catch\n            {\n                throw new ArgumentException($\"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值，当前入参 {Args[0]} 不合法\");\n            }\n        }\n        else if (Method == Method.Scroll)\n        {\n            AssertUtils.IsTrue(Args.Count == 1, \"scroll方法必须有一个入参，代表滚动格数。例：scroll(1) 或 scroll(-1)\");\n            AssertUtils.IsTrue(int.TryParse(Args[0], out _), \"滚动格数必须是整数\");\n        }\n    }\n    \n    public override string ToString()\n    {\n        return $\"<CombatCommand {Name}, {Method}({Args}) (rounds {ActivatingRound})>\";\n    }\n\n    public void Execute(CombatScenes combatScenes, CombatCommand? lastCommand = null)\n    {\n        Avatar? avatar;\n        if (Name == CombatScriptParser.CurrentAvatarName)","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoFight/Script/CombatCommand.cs#L49-L85","documentation":"Error \"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值，当前入参 {Args[0]} 不合法\" thrown in babalae/better-genshin-impact.","triggerScenarios":"战斗脚本中 keydown/keyup/keypress 指令的按键参数无法通过 User32Helper.ToVk 转换为合法虚拟键码时抛出。","commonSituations":"脚本里写了不存在的按键名，如 keypress(xxx) 拼写错误或使用了不支持的键。","solutions":["检查战斗脚本中该方法使用的按键名，必须是 VirtualKeyCodes 枚举中的合法值","参考按键表使用如 VK_SPACE、VK_E 等标准按键名"],"exampleFix":"按键参数改为 VirtualKeyCodes 枚举中的合法值（如 VK_F、VK_SPACE 或支持的键名），核对脚本拼写。","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}