Skip to content

Number Conditions & Logic ​

Number Conditions (ScreenCondition.Number) extract numeric values directly from your screen and evaluate them using mathematical comparison operators. They allow automations to make intelligent mathematical decisions based on health points, resource tallies, cooldown timers, or currency counts.


Data Structure & Parameters ​

A Number Condition is defined by the following attributes:

ParameterTypeDefaultDescription
NameString—User-defined label (e.g. "Health Below Threshold").
Detection AreaRect—Bounding box on screen containing the numbers.
Comparison OperatorComparisonOperationLOWERThe mathematical rule applied to the screen number.
Comparison OperandCounterOperationValue—A static constant value or a dynamic Counter variable.
Number FormatNumberFormatTypeAUTOParsing format (AUTO, INTEGER, or DECIMAL).
ThresholdInt80%Minimum OCR confidence required to parse digits.
PriorityInt0Order of evaluation within the parent Event.

Numeric OCR Engine ​

While Text Conditions load full dictionary neural language models, Number Conditions use a streamlined digit classifier constrained to 0–9, decimal points (.), commas (,), and negative signs (-).

Because the neural search space is reduced to numeric glyphs:

  • Speed: Evaluates $3\times$ to $5\times$ faster than full sentence OCR.
  • Accuracy: Eliminates character confusion (e.g., prevents confusing the digit 0 with the letter O, or 1 with l).

Mathematical Comparison Operators ​

ConditionsVerifier evaluates the extracted screen number against your comparison target using the following logic:

OperatorSymbolEvaluation LogicExample
LOWER<$\text{Screen} < \text{Target}$Trigger Heal when $\text{HP} < 250$
LOWER_OR_EQUALS≤$\text{Screen} \le \text{Target}$Trigger Reload when $\text{Ammo} \le 0$
EQUALS=$\text{Screen} - \text
GREATER_OR_EQUALS≥$\text{Screen} \ge \text{Target}$Buy Upgrade when $\text{Gold} \ge 15000$
GREATER>$\text{Screen} > \text{Target}$Halt Farming when $\text{Inventory} > 99$

Floating-Point Equality

Floating-point calculations can suffer from minor rounding variances (e.g., 49.999999 vs 50.0). Macrion protects against this by using an epsilon threshold ($\epsilon = 10^{-9}$) to ensure mathematical equality checks evaluate reliably.


Static Values vs. Dynamic Counters ​

The right-hand side of your comparison rule can be set to two different operand types:

1. Static Numeric Constant (CounterOperationValue.Number) ​

Compares the screen number against a fixed number you specify: $$\text{Screen Number} \quad [\text{Operator}] \quad 500.0$$ Example: Trigger a heal action whenever on-screen Health drops below 300.

2. Dynamic Counter Variable (CounterOperationValue.Counter) ​

Compares the screen number against an internal variable stored in Macrion's runtime counter state: $$\text{Screen Number} \quad [\text{Operator}] \quad \text{Counter("MaxHP")} \times 0.3$$ Example: Compare current on-screen gold against a counter named StartingGold to calculate net session profit and stop farming once a target margin is reached.


Formatting Options (NumberFormatType) ​

  • AUTO: Automatically detects integers or floating-point decimals based on extracted glyphs.
  • INTEGER: Strips decimal points and parses the digits as a whole integer (1250).
  • DECIMAL: Normalizes commas and periods to parse floating-point numbers (12.50).

Free and open source under the GNU GPL v3.0 License.