Triggers, events & booleans

A boolean is a state — true or false, held until it changes. A trigger is an event — a single moment when something happens. Knowing which one you want is the key to making things fire at the right time.

State vs event

These two feel similar but behave very differently:

DNA doesn't have a separate "trigger" type — a trigger is simply a boolean caught at the instant it changes. That moment of change is called an edge: a rising edge when something turns true, a falling edge when it turns false.

Rule of thumb: if you'd say "while …" you want a boolean (a held state). If you'd say "when …" you want a trigger (an edge/event).

The trigger button

Some parameters show a trigger button instead of a checkbox. Click it and it fires for a single frame, then resets itself — the hand-operated version of an event: "reset this feedback loop now", "fire this burst now". A checkbox, by contrast, stays where you leave it.

Turning one into the other

Which node does which

NodeGives youState or event
logic.logicAND / OR / NOT / XOR of booleansState (no memory)
logic.compareresult (A vs B) + an edge that fires on changeBoth — state and event
data.conditionalroutes data based on a conditionState
utility.holdsample-and-hold: grab a value when triggeredEvent in, value held out
utility.state_machineadvances state on a trigger; fires on each transitionEvent-driven
query.triggerwhich elements entered / are inside / exited a regionEvent (enter/exit) + state (inside)
query.collision_detectthe same enter/exit moments, for contactEvent

Events need identity

For "entered" and "exited" to mean anything, DNA has to know which element is which from one frame to the next — that's what the @id attribute is for. Points from sop.scatter or a particle sim already carry one, so query.trigger can tell you exactly which element crossed the line, not just that something did. See Attributes.

Triggers live in time — they only make sense while playback is advancing. A paused graph never produces an edge, because nothing is changing frame to frame. See Time & playback.

See also