babalae/better-genshin-impact · error · Exception
战斗脚本文件不存在
Error message
战斗脚本文件不存在
What it means
Error "战斗脚本文件不存在" thrown in babalae/better-genshin-impact.
Source
Thrown at BetterGenshinImpact/GameTask/AutoFight/Script/CombatScriptParser.cs:34
{
if (File.Exists(path))
{
// 防护性代码:防止 .json 策略文件被错误传入旧的 .txt 解析器
if (path.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
{
Logger.LogError("当前任务暂不支持使用json策略,请使用txt策略");
throw new Exception("当前任务暂不支持使用json策略,请使用txt策略");
}
return new CombatScriptBag(Parse(path));
}
else if (Directory.Exists(path))
{
var files = Directory.GetFiles(path, "*.txt", SearchOption.AllDirectories);
if (files.Length == 0)
{
Logger.LogError("战斗脚本文件不存在:{Path}", path);
throw new Exception("战斗脚本文件不存在");
}
var combatScripts = new List<CombatScript>();
foreach (var file in files)
{
try
{
combatScripts.Add(Parse(file));
}
catch (Exception e)
{
Logger.LogWarning("解析战斗脚本文件失败:{Path} , {Msg} ", file, e.Message);
}
}
return new CombatScriptBag(combatScripts);
}
elseView on GitHub (pinned to a7cb36712d)
Solutions
- 检查配置的战斗脚本文件路径是否正确
- 重新选择存在的战斗脚本文件
- 确认文件未被移动或删除
Example fix
确认脚本目录路径正确且其中至少有一个 .txt 战斗脚本文件。
When it happens
Trigger: 传入路径是目录时,递归搜索不到任何 *.txt 战斗脚本文件时抛出。
Common situations: 配置的战斗脚本目录为空、路径填错,或脚本文件不是txt扩展名。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/076cb064f7cf8d92.
Report an issue: GitHub.