babalae/better-genshin-impact · error · ArgumentException

round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)

Error message

round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)

What it means

Error "round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)" thrown in babalae/better-genshin-impact.

Source

Thrown at BetterGenshinImpact/GameTask/AutoFight/Script/CombatScriptParser.cs:166

            else if (validate)
            {
                Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
                throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
            }
        }

        oneLineCombatCommands.AddRange(ParseLineCommands(commands, character));
        combatAvatarNames.Add(character);
        return oneLineCombatCommands;
    }

    public static List<int> ParseRoundCommand(CombatCommand roundCommand) {
        // 解析round命令的入参,返回一个整数列表,代表在哪些回合执行后续指令
        // 支持Round(1)、Round(1,3,5)、Round(2-4)、Round(1,3-5)等格式
        var activatingRounds = new List<int>();
        if (roundCommand.Args == null || roundCommand.Args.Count == 0) {
            Logger.LogError("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
            throw new ArgumentException("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
        }
        foreach (var arg in roundCommand.Args) {
            if (arg.Contains('-')) {
                // 范围
                var parts = arg.Split('-', StringSplitOptions.TrimEntries);
                if (parts.Length != 2) {
                    Logger.LogError("round方法的入参格式错误,例:round(1-3)");
                    throw new ArgumentException("round方法的入参格式错误,例:round(1-3)");
                }
                var start = int.Parse(parts[0]);
                var end = int.Parse(parts[1]);
                if (start > end || start <= 0) {
                    Logger.LogError("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
                    throw new ArgumentException("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
                }
                for (int i = start; i <= end; i++) {
                    activatingRounds.Add(i);
                }

View on GitHub (pinned to a7cb36712d)

Solutions

  1. 为 round 方法添加回合数入参,如 round(1) 或 round(1,3-5)
  2. 检查是否遗漏了括号内的参数

Example fix

给 round 填回合参数,如 round(1)、round(1,3-5)。

When it happens

Trigger: round 指令没有任何入参(round())时抛出。

Common situations: 脚本中写了空 round() 想表示回合控制但忘了填回合号。


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/fd8be15a65d2b061. Report an issue: GitHub.