babalae/better-genshin-impact · error · ArgumentException

round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)

Error message

round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)

What it means

Error "round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)" thrown in babalae/better-genshin-impact.

Source

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

        // 支持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);
                }
            } else {
                // 单个回合
                var round = int.Parse(arg);
                if (round <= 0) {
                    Logger.LogError("round方法的入参格式错误,回合数必须大于0,例:round(1)");
                    throw new ArgumentException("round方法的入参格式错误,回合数必须大于0,例:round(1)");
                }
                activatingRounds.Add(round);
            }
        }
        return activatingRounds;
    }

    public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName) {

View on GitHub (pinned to a7cb36712d)

Solutions

  1. 确保 round 范围起始回合小于等于结束回合且均大于0,如 round(1-3)
  2. 修正如 round(3-1) 或 round(0-2) 之类的错误写法

Example fix

保证起始回合>=1且不大于结束回合,如 round(1-3)。

When it happens

Trigger: round 范围参数中起始回合大于结束回合,或起始回合<=0 时抛出。

Common situations: 写成 round(3-1) 或 round(0-2) 这类非法范围。


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