egametang/ET · error · Exception

condition number parse error: {text}

Error message

condition number parse error: {text}

What it means

Thrown by ConditionExprLexer.ReadNumber when a digit run cannot be parsed as a long. The lexer only enters ReadNumber on a leading digit (or a minus followed by a digit), so long.TryParse fails almost exclusively on numeric overflow — the digit string exceeds Int64.MaxValue.

Source

Thrown at Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprLexer.cs:71

                ++this.index;
            }

            string text = this.expr.Substring(start, this.index - start);
            this.tokens.Add(new ConditionToken(ConditionTokenType.Identifier, text, 0));
        }

        private void ReadNumber()
        {
            int start = this.index++;
            while (this.index < this.expr.Length && char.IsDigit(this.expr[this.index]))
            {
                ++this.index;
            }

            string text = this.expr.Substring(start, this.index - start);
            if (!long.TryParse(text, out long number))
            {
                throw new Exception($"condition number parse error: {text}");
            }

            this.tokens.Add(new ConditionToken(ConditionTokenType.Number, text, number));
        }

        private void ReadOperator()
        {
            char c = this.expr[this.index];
            switch (c)
            {
                case '>':
                    this.AddIfNext('=', ConditionTokenType.GreaterEqual, ConditionTokenType.Greater);
                    return;
                case '<':
                    this.AddIfNext('=', ConditionTokenType.LessEqual, ConditionTokenType.Less);
                    return;
                case '=':
                    this.ExpectNext('=', ConditionTokenType.Equal);

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Correct the numeric literal in the condition expression (Luban/Excel cell) to fit within long range.
  2. If the value is genuinely large, redesign to use a scaled unit so it fits.
  3. Run a config-validation pass that parses all condition expressions at build time to catch overflow early.

Example fix

// before (Luban/Excel expression cell)
//   HP > 99999999999999999999
// after
//   HP > 9999999999
Defensive patterns

Strategy: validation

Validate before calling

// Validate config-time: attempt to tokenize/parse all condition expression cells at import.
// Reject any cell whose numeric literal exceeds long.MaxValue:
// if (ulong.TryParse(numText, out _) && numText.Length > 18) flag for review.

Prevention

When it happens

Trigger: A condition expression contains an integer literal too large for long, e.g. 'HP > 99999999999999999999' or an extremely large error-code suffix after ':' that exceeds long range.

Common situations: A typo'd extra digit in a config cell; a comparison value or error code copied with too many digits; an Excel/Luban cell formatting artifact that appended zeros.

Understand the failure class

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/7dc71856cafe90ee. Report an issue: GitHub.