Skip to content

Node Reference Logic

Bobby Comet edited this page Aug 1, 2026 · 4 revisions

Node Reference — Logic (built-in)

Logic nodes take bindable inputs and expose one output. Chains evaluate in dependency order inside refresh_sources() each sensor refresh, before any visual reads them.

Kinds: KIND_NUMBERnumber, KIND_PERCENTpercent, KIND_TEXTtext.


Math — logic.math

Output number
input_a, input_b float, bindable
operation enum — add, subtract, multiply, divide, average, min, max
Notes Divide-by-zero yields 0.

Conditional — logic.conditional

Output number
input bindable float
comparison enum — >, >=, <, <=, == (default >)
threshold float (default 80)
then_value / else_value floats returned when condition holds / fails (defaults 1 / 0)

Threshold Gate — logic.threshold

Output number (0 or 1)
value bindable
comparison enum (default >=) — >, >=, <, <=, ==
threshold float (default 80)
Notes Binary gate only. Wire into opacity, Glow trigger, or Conditional.

String Format — logic.string_format

Output text
input bindable (any kind)
template string with {value} placeholder (default {value})
decimals int 0–4 (applies when input is numeric)

Map Range — logic.map_range

Output number
value, in_min, in_max bindable floats
out_min, out_max floats (defaults 0 / 1)
clamp bool (default true) — clamp result to out range
Notes Remaps (value) from ([in_min, in_max]) → ([out_min, out_max]). Typical use: °C → 0–1 for a gauge, or sensor raw → percent.

Clamp — logic.clamp

Output number
value bindable
min_value, max_value floats (defaults 0 / 100)

Lerp — logic.lerp

Output number
a, b, t bindable — result ≈ a + (b − a) × t
t typically 0–1 (editor allows wider range)

Deadzone — logic.deadzone

Output number
value bindable
centre float (default 0)
radius float (default 1)
Notes If (

Invert Percent — logic.invert_percent

Output percent
value bindable — typically 100 − value, clamped 0–100
Notes Free disk from used %, remaining battery style math.

Scale / Offset — logic.scale

Output number
value bindable
multiply, add floats — value × multiply + add

Round — logic.round

Output number
value bindable
decimals int 0–6 (default 0 = integer)

Absolute — logic.abs

Output number
value bindable — `

AND Gate — logic.boolean_and

Output number (0/1)
input_a, input_b bindable — 1 if both non-zero, else 0

OR Gate — logic.boolean_or

Output number (0/1)
input_a, input_b bindable — 1 if either non-zero, else 0

Pick A/B — logic.pick

Output number
selector bindable — if ≥ 0.5 output B, else A
input_a, input_b bindable
Notes Use with a Threshold Gate for mode switches.

Evaluation order

compute_used_sources walks backward from every edge (including through logic → logic chains). topological_order then ensures each node’s SRC[] entry is written only after its inputs are fresh this frame. Cycles fall back to a stable drain order rather than hanging the build.


Built-in vs plugin

Need Prefer
Simple 0/1 vs threshold Built-in Threshold Gate
Pass value when true / invert / equal±ε Plugin Threshold (if installed)
EMA / smoothing Plugin Smooth
°F ↔ °C Plugin Temp Convert or Map Range / Scale
Multi-stage index Plugin Threshold Chain

Clone this wiki locally