βοΈ CR Set Value On Boolean
Turn a true/false switch into a number
- INT
- FLOAT
- show_help
Small node, useful idea: it turns a yes/no toggle into a number. Flip the boolean on, it outputs one value; flip it off, it outputs another. That's a conditional - an if this then X else Y - expressed as a node you can wire into any numeric input.
Where this earns its place is in template workflows you want to reconfigure with a single switch. Instead of remembering "for the hires pass, set steps to 30 and denoise to 0.4," you wire a boolean to a couple of these and let one toggle push the right numbers everywhere at once.
How it works
There's nothing hidden here. You give it a boolean and two numbers. When the boolean is true, it emits the "true" number; when false, the "false" number. It provides the result as both an integer and a float output, so whatever downstream input you're driving - steps (INT), denoise (FLOAT), a scale factor - gets the type it expects without a converter.
The inputs and outputs that matter
boolean(BOOLEAN, default true) - the switch. Wire it from a logic node, or toggle it by hand.value_if_true(FLOAT, default 1) - what to output when the switch is on.value_if_false(FLOAT, default 0) - what to output when it's off.
Outputs:
INTandFLOAT- the selected value in both types. Use whichever the target input wants.show_help- the wiki-link string, ignore it.
Installing it
Part of Comfyroll Studio (Suzie1 / RockOfFire), a large, well-worn utility pack. Install through ComfyUI Manager (search "Comfyroll Studio," install, restart) or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git
then restart. No models, no dependencies.
Common issues
Watch the INT output when your values aren't whole numbers. If you set value_if_true to 0.4 and read the INT output, you'll get it truncated to 0 - read the FLOAT output for fractional values. It's an easy mismatch to make when you're wiring a denoise value.
Beyond that there's not much to break. It's a one-line conditional. The real design question is upstream: what's feeding the boolean? A hand toggle is fine for a manual switch; for anything driven by data you'll want a logic node (a string test, a comparison) producing that boolean. If Comfyroll fails to load at startup with a Python traceback, reinstall the pack cleanly through Manager - that's an install problem rather than anything with this node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| boolean | BOOLEAN | true | β |
| value_if_true | FLOAT | 1.00-18446744073709550000β18446744073709550000 | β |
| value_if_false | FLOAT | 0.00-18446744073709550000β18446744073709550000 | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |
| FLOAT | FLOAT | β |
| show_help | STRING | β |