Expressions and conditions reference
Mit FlammiCraft ausgelieferte Mod-Version: 1.13.0
Diese Detailseite ist derzeit auf Englisch verfügbar.
Detailed reference retained from the original AFN help. Integration-specific entries apply only when the corresponding mod is installed. Examples describe mod behavior; pack recipes and settings may differ.
Ordinary functions take a static path, nested function or expression first, then JSON configuration literals. if conditions support =/==, !=, <, >, <=/≤, >=/≥, !, &/&&, || and parentheses. Precedence: parentheses, !, comparison, AND, OR. switch match values must be scalar literals.
add accepts two or more numeric operands; sub/mul/div take two. Operands may be static paths, nested functions, or number literals, and at least one must read a channel. Single-item numeric arrays may omit [0]; larger arrays require selection or aggregation. Convert numeric text with number().
Operations obey the server's precision and exponent limits; division uses HALF_EVEN rounding. Division by zero or an out-of-range result fails this output.
${add($.Fuel1, $.Fuel2, $.Fuel3)}
${sub($, 5)}
${round(avg($.Inventory.values), 2)}
${default($[2], 0)}
Numeric operations
Array processing
Branching
Type conversions
Signal strength
Text and scaled numbers
Missing values and structure
Function names are case-insensitive. Ordinary functions nest in their first argument; if/switch value branches may contain nested functions.
add two or more numbers
average a non-empty array containing only numbers
keep a Boolean, or parse an exact lowercase true/false string
limit a number from min through max; min must not exceed max
Return true when text contains part; case-sensitive.
return JSON literal v when x is absent, missing, or null; errors still propagate
divide numeric a by b; fails when b is zero
Return true when text ends with part.
true when x has a value, including null; false when absent or missing
parse H:MM am/pm or HH:MM as game ticks (0–23999); 6:00 am is 0 and 0:00 pm is 6000
if(test,yes,no): return yes for true, otherwise no. Supports comparisons, &&, ||, ! and grouping, e.g. if(number($.Stock)>90,100,number($.Stock)). Logical operators and branches short-circuit; missing is false, and numbers are not treated as booleans.
join a scalar array with string sep; elements may be text, numbers, Booleans, or null
encode an available value as stable JSON text; must be the outermost function
Convert text to lowercase.
return the maximum of a non-empty all-number array
return the minimum of a non-empty all-number array
multiply numeric a and b
Keep numbers, or extract the first number from text, ignoring grouping commas: 1,234,211 su → 1234211. For a single-value channel, use number($.Stock) without [0].
Replace all literal from occurrences with to; no regular expressions.
round to n decimal places; n must be a non-negative integer within the configured range
return text character count, array length, or object member count
Split by literal sep into a text array, preserving empty parts; supports join.
Return true when text starts with part.
Read current channel activation strength (0–15), even without data; inactive means 0. Use $ on mailboxes or $.ChannelName on bridges, without an array index.
subtract numeric b from a
Extract characters from zero-based start, with optional length; negative start counts from the end. Whole Unicode characters are preserved.
sum a non-empty array containing only numbers
switch(x,match,result,...[,default]): match x with strict types and return the first matching result; an optional final default is supported. Only the selected result is evaluated.
Convert numbers, booleans or text to text; unwraps one-item arrays. Rejects null, larger arrays and objects
Remove leading and trailing whitespace.
return absent, missing, or null/boolean/number/string/array/object
Extract a number and apply k/K=1000, m/M=1000000, g/G=1000000000, t/T=1000000000000; ignore remaining units. 8.12kv and 8120v both return 8120. Lowercase m also means million, not milli.
Convert text to uppercase.
Extract, format, or calculate this channel's outward output without changing its raw data. Click for syntax rules.
Use .name for ordinary members; array indexes start at 0; use ["..."] for special member names.
${channel} reads the whole channel value; optional members or indexes select a part:
${Inventory} ${Inventory[0]}
Inside a function, a path must explicitly start with $:
Self references read the raw channel value; other channels expose their effective output. Bare $ and cross-channel dependency cycles are not allowed.
A mailbox uses its current channel value as the root; read the whole value or a subpath:
${$} ${user.name} ${2}
A rule only modifies this device's outward output; it does not rewrite the original channel data.
Paths and arguments
Numeric calculations
Activation rules
Comparisons and combinations
Notes
Functions
Read data
Reading data
Basic syntax
Missing values and errors
${strength($.ChannelName)}
Output syntax may read its own strength. Activation conditions and output-strength rules may only read other channels' strength to avoid feedback.
${strength($)}
Use ${...} to read values; one rule may mix text with multiple expression blocks.
Plain text alone is a valid rule and is output unchanged.
A rule consisting of one ${...} block preserves the value type; every other form outputs text.
Blank means unset. If ${ occurs, every expression block must be complete and valid.
Unknown functions, dynamic paths, infix arithmetic, and | pipelines are invalid.
A missing path or absent source normally produces no output; use default(x,v) for a fallback.