Skip to content

Node Reference Logic

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

Node Reference — Logic

Logic nodes sit between sources and visuals: they have bindable inputs and one output. Chains evaluate in dependency order each stats refresh (STATS_HZ), before draw.

Output kinds: usually number or percent; String Format / String Join → text.

Wire any numeric source kind (percent, celsius, number) into float inputs unless noted.


Arithmetic & scaling

Math — logic.math

Output number
input_a, input_b bindable floats
operation add, subtract, multiply, divide, average, min, max

What it does: Combines two values each frame.

Examples:

  • Average CPU + GPU temp before one gauge: A=CPU temp, B=GPU temp, average.
  • VRAM fraction: used ÷ total (guard: divide yields 0 if B is 0).
  • min(cpu, 100) style caps via min with a constant B.

Map Range — logic.map_range

Output number
value, in_min, in_max bindable
out_min, out_max floats
clamp bool (default on)

Maps linearly from the input range to the output range.

Examples:

  • CPU temp 30–95 °C → 0–100 for an Arc Gauge.
  • Net down 0–1000 KiB/s → 0–1 for a Lerp colour blend.
  • Invert a range without Invert Percent: in 0–100, out 100–0.

Scale / Offset — logic.scale

Output number
value bindable
multiply, add out = value × multiply + add

Examples: °F → °C approx: multiply 0.555, add -17.777 (or use a convert plugin). RPM / 1000 → “kRPM” number for text.

Clamp — logic.clamp

Output number
value bindable
min_value, max_value floats

Example: Force a sensor into 0–100 before a gauge that assumes percent.

Lerp — logic.lerp

Output number
a, b, t bindable — a + (b − a) × t

Example: Map Range output as t, A=track opacity 0.2, B=1.0 → smooth opacity for a Glow or Rectangle.

Round — logic.round /Absolute — logic.abs

Output number
decimals (Round) 0–6

Example: Round temp to 0 decimals before String Format; Abs on Rate of Change for “magnitude of change” bars.

Invert Percent — logic.invert_percent

Output percent
value bindable — ≈ 100 − value clamped

Example: Disk used % → free % bar; battery “empty” stylisation.


Smoothing & change

Smooth (EMA) — logic.smooth

Output number
value bindable
alpha 0.01–1 (small = heavier smoothing)
init_from_input seed from first sample

What it does: Exponential moving average in STATE across frames.

Example: Noisy GPU util → Smooth (α≈0.15) → Needle Gauge so the needle doesn’t jitter.

Rate of Change — logic.rate_of_change

Output number
value bindable
samples look-back window (refresh ticks)

Example: CPU % rate → positive = rising load; drive a small LED or text “rising/falling”.

Deadzone — logic.deadzone

Output number
centre, radius collapse values near centre

Example: Fan RPM deadzone around 0 so idle “0–50 RPM noise” reads as 0.


Gates & branching

Threshold Gate — logic.threshold

Output number (0 or 1)
value bindable
comparison >, >=, <, <=, ==
threshold float

Example: CPU ≥ 90 → 1 → LED Dot/Glow trigger. Chain into AND/OR for compound alarms.

Conditional — logic.conditional

Output number
input, comparison, threshold condition
then_value / else_value outputs

Example: GPU temp > 80 → then 1 else 0 for icon swap; or then 100 else input to hard-cap a display value.

Hysteresis — logic.hysteresis

Output number (on/off values)
high / low turn on/turn off thresholds
on_value / off_value defaults 1/0

What it does: Turns on when value crosses high, stays on until value falls below low.

Example: Fan warn LED: high 75 °C, low 65 °C — no flicker around a single cut-off.

AND / OR Gate — logic.boolean_and / logic.boolean_or

Output number (0/1)
input_a, input_b truthy if non-zero

Example: (CPU ≥ 90) OR (GPU ≥ 90) → Glow trigger for “any hot device”.

Pick A/B — logic.pick

Output number
selector ≥ 0.5 → B, else A
input_a, input_b bindable

Example: Selector = Threshold(battery < 20); A = normal colour index, B = warn index — or pick between two scaled metrics.

Enum Map — logic.enum_map

Output number
input text/category (case-insensitive)
keys / values parallel comma lists
default_value if no match

Example: Weather category clear,cloud,rain,snow0,1,2,3 for Image path selection or opacity levels. Playback status playing,paused,stopped1,0.4,0.


Text logic

String Format — logic.string_format

Output text
input any
template must contain {value}
decimals for numeric inputs

Example: Template CPU {value}% → Text Label. Template {value} °C for temps.

String Join — logic.string_join

Output text
input_a, input_b bindable
separator e.g.
skip_empty avoid stray separators

Example: Artist + Title → one Now Playing line. Hostname + Kernel with separator ·.


Recipe table

Need Prefer
Quiet gauge Smooth
°C → 0–100 ring Map Range
Warn without flicker Hysteresis or Threshold + LED
Compound alarm Thresholds → OR
Label with units String Format
Artist — Title String Join
Category → icon index Enum Map
Free disk from used % Invert Percent

Built-in vs plugin: plugins may add richer Threshold modes, Temp Convert, multi-stage chains; use built-ins first; they always ship with Studio.

Clone this wiki locally