Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee Dynamic String Selector Seeded V2
ComfyUI Node

EmAySee Dynamic String Selector Seeded V2

One slider, many string inputs — pick which prompt wins without rewiring

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee Dynamic String Selector Seeded V2
    • SELECTED_STRING
    string_input_1Initial Input
    select_index1
    seed0

    This is a "choose one of these N strings" node with a genuinely nice implementation. You get string_input_1, string_input_2, and so on - the node grows extra inputs to match however many strings you wire in - and a slider (select_index) that picks which one flows out. It's the classic prompt-alternatives pattern: three prompt variants, one slider, no swapping cables. The "Seeded V2" in the name is the pack's running joke, and we'll get to that.

    How it works

    The interesting part is how it stays dynamic. ComfyUI normally freezes a node's input list at definition time; this one implements UPDATE_INPUT_TYPES, so the moment you connect more strings, the node redefines itself with an input for each one and extends the slider's max to match. It also sets IS_CHANGED to return NaN, which tells ComfyUI to never treat the node as cached - every run re-executes it, so changes propagate even when only the selection moved.

    Two guards matter in practice:

    • VALIDATE_INPUTS rejects a select_index outside 1..N, so you can't silently index past the end of your list.
    • If nothing is connected, it returns an empty string instead of crashing.

    Inputs and outputs

    • string_input_1string_input_N - STRING inputs; the node re-sizes to match what you plug in. The schema shows string_input_1 as a required text field by default, but the dynamic registration turns the rest into optional wire-ins.
    • select_index (INT slider, 1..N) - which input to forward.
    • seed (INT, 0–2^64) - here's the joke: the function calls random.seed(seed) and then... picks by index anyway. The selection is fully deterministic. The seed is a no-op; the slider does all the work. Don't randomize it expecting a random pick - wire select_index from a random integer if that's what you want.

    Output: SELECTED_STRING, a single STRING - feed it to your positive prompt or any downstream text.

    Where it fits

    rgthree's reroute/switch nodes handle this for arbitrary data types, but those can be finicky about dynamic input counts. This one is prompt-specialized and dead simple: build a set of prompt variants once, drive select_index from a random int, a batch counter, or a condition, and batch out all your variants without touching the graph. It's the kind of node that turns "let me try five prompts" into a single queued run.

    Install

    Part of the ComfyUI_EmAySee_CustomNodes pack. ComfyUI Manager → search "EmAySee" → install, restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
    

    No requirements, no models. Restart and you'll see the pack's "SPECTRE v5.0" banner in the console.

    Gotchas

    Because the node re-defines its own input schema, older saved workflows can briefly show missing connections if the pack version changes the input-count logic - reselect after an update. And since it never caches, it re-runs on every queue even when nothing changed; harmless, just slightly more compute than a dumb selector. The stale AI-generated README lists this as "Dynamic String Selector" with a fixed dropdown; ignore it, the live node is the slider version.

    CategoryEmAySee_Utils

    Inputs (3)

    NameTypeDefaultDescription
    string_input_1STRINGInitial Input
    select_indexINT11–1
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    SELECTED_STRINGSTRING