Boolean Index Adder
First true wins, and it becomes a number
- I
Somewhere in a workflow you usually end up with a pile of true/false flags - "is a face detected," "did this check pass," "is this batch index odd" - and you want a single number out of them so the rest of the graph can act on it. Boolean Index Adder is that translation. It looks at up to 15 boolean inputs, finds the first one that's true, and adds its position (1-based) to a base_number. No true flags at all? You just get base_number back unchanged.
So with base_number 10 and bool2 set true, you get 12. With bool4 true and base 0, you get 4. The README's own example: base 10, bool1 false, bool2 true, bool3 false → 12.
The inputs are exactly what they sound like: base_number (an INT, default 0) and bool1 through bool15 (BOOLEAN, default false). The sockets all show up whether you wire them or not, and unwired ones just sit at false - so a mostly-empty node behaves. The single output is an INT: base_number plus the winning index.
The clever use is choosing between options by condition rather than by hand. Say you have three quality gates and you want a different prompt for whichever one fired. Wire each gate to a bool slot, set base_number to 0, and the output becomes the number of the first passing gate - feed that straight into a String Switch By Number node (same pack) and you've got condition-driven text selection with no Python.
A couple of honest catches. It's "first true," not "count the trues" - if you need to know how many flags are set, this node isn't it, and nothing else in the pack does that either. And because the index is 1-based, slot 1 gives you base+1, not base. Plan your base_number around that and you'll be fine.
Installing this pack is a one-liner, same for every node in it:
cd ComfyUI/custom_nodes
git clone https://github.com/narusas/Comfyui-Logic-Support
Restart ComfyUI after (or refresh the page), or grab it through ComfyUI Manager by searching "ComfyUI Logic Support." No dependencies, no model files, no API keys - it's pure Python under the hood, so it can't drag your environment into the dependency conflicts that plague bigger node packs. It's a small, MIT-licensed pack from a single author; don't expect a big community around it, just expect the nodes to work.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| base_number | INT | 0 | — |
| bool1 | BOOLEAN | false | — |
| bool2 | BOOLEAN | false | — |
| bool3 | BOOLEAN | false | — |
| bool4 | BOOLEAN | false | — |
| bool5 | BOOLEAN | false | — |
| bool6 | BOOLEAN | false | — |
| bool7 | BOOLEAN | false | — |
| bool8 | BOOLEAN | false | — |
| bool9 | BOOLEAN | false | — |
| bool10 | BOOLEAN | false | — |
| bool11 | BOOLEAN | false | — |
| bool12 | BOOLEAN | false | — |
| bool13 | BOOLEAN | false | — |
| bool14 | BOOLEAN | false | — |
| bool15 | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| I | INT | — |