Expressions
ACE's resolver processes expressions inside command text when expression processing is enabled for that command. Expressions may be nested, and --no-exp-proc disables expression processing for that command.
Some commands intentionally preserve expression-bearing text instead of evaluating it at definition time. The production resolver does this for specific stored/configured values such as formulas, jobs, aliases, timer messages, poll definitions, and webhook fields. Those expressions are therefore not necessarily evaluated at the moment the defining command is entered.
ACE currently exposes 20 named expressions. This reference covers every expression implemented by the production expression engine, including the lazy control-flow expressions IF and SWITCH.
Complete reference
| Expression | Syntax | Purpose |
|---|---|---|
ABS |
ABS{value} |
Absolute value |
AND |
AND{left;right} |
Logical AND of integer inputs |
CALC |
CALC{expression} |
Arithmetic expression |
CLAMP |
CLAMP{value,min,max} |
Constrain a number to a range |
CMD |
CMD{command} |
Run an ACE command through the resolver and substitute the resulting text |
COMPARE |
COMPARE{NUM/TXT;operator;arg1,arg2,...} |
Compare numeric or text values |
CONTAINS |
CONTAINS{haystack;needle} |
Test whether text contains a substring |
IF |
IF{condition;if_true;if_false} |
Lazy conditional branch |
MAP |
MAP{value,fromLow,fromHigh,toLow,toHigh} |
Map and clamp between numeric ranges |
NOT |
NOT{value} |
ACE numeric NOT transform; boolean inversion for 0 and 1 |
OR |
OR{left;right} |
Logical OR of integer inputs |
POW |
POW{base,exponent} |
Raise a number to a power |
RANDOM |
RANDOM{low,high} |
General-purpose random integer |
RANDSTR |
RANDSTR{length[;mode]} |
Cryptographically secure random string |
ROUND |
ROUND{value} |
Round to the nearest integer, halfway away from zero |
ROUNDDOWN |
ROUNDDOWN{value} |
Mathematical floor |
ROUNDUP |
ROUNDUP{value} |
Mathematical ceiling |
SQRT |
SQRT{value} |
Square root |
SWITCH |
SWITCH{input;case1;result1;...;default} |
Lazy multi-way result selection |
VAR |
VAR{username;database_name;variable_name} |
Read a variable value |
Names and separators
Expression names are matched case-sensitively by the production parser. Use the uppercase names shown in this reference. RANDSTR mode names are a separate parameter and are case-insensitive.
Separators are part of each expression's syntax. Some expressions use semicolons (;), while others use commas (,). Use the exact syntax shown on the relevant reference page.
Nesting and control flow
Leaf expressions are resolved from the inside out. For example:
returns 9.
This inside-out rule means ordinary leaf expressions do not provide short-circuit control flow. In particular, nested operands of AND, OR, and COMPARE are resolved before the outer expression is evaluated.
IF and SWITCH are handled separately as lazy control flow. ACE resolves the IF condition or the SWITCH input and then resolves only the selected result branch. A CMD{...} that exists only in an unselected result branch is therefore not executed.
SWITCH case expressions are different from result branches: cases are resolved in order while ACE looks for the first match. See the SWITCH reference for that distinction.
Result formatting
Numeric leaf-expression results are formatted by ACE without unnecessary trailing decimal zeros in ordinary values. AND, OR, COMPARE, and CONTAINS return 1 for true and 0 for false. NOT has additional numeric behavior beyond boolean 0/1; its exact rules are documented on the NOT page.