Nodes/RF Nodes/One of (STRING)
ComfyUI Node

One of (STRING)

One dropdown's worth of prompts, switched by a number

By foxtrot-roger·Created 3 years ago·Updated 2 years ago· 2
One of (STRING)
    • text
    index0
    text

    A list of options that you pick from by number - that's One of (STRING) (RF_OptionsString), and it's the closest thing in RF Nodes to a dropdown you can drive from logic. Type several candidates into the text field, one per line, and feed an index; the node returns the line at that position. Change the index per run and your workflow picks a different option without you touching the text.

    The display name is a hint at the intended use: "one of" these options. It's the simple, no-list-mode sibling of the pack's RF_AtIndexString, and for most graphs it's the one you'll reach for first.

    How it works

    Plain and honest: text.splitlines() breaks the multi-line input into a list, and the return is lines[index % len(lines)]. The modulo is the key safety feature - out-of-range indexes wrap around instead of erroring, so a raw counter can drive it forever and it will just cycle through your options. No list-mode complication, no batch handling; a single index in, a single string out.

    The inputs that matter

    • text - your options, one per line (default empty). Multiline.
    • index - which option to return, zero-based (default 0). First line is 0; values wrap with modulo.

    Output: text - the selected option.

    The pattern worth building

    Wire a seed or batch counter into index and you've got automatic option rotation: different prompts, different negative-prompt strategies, or different filename templates per run, all from one multi-line field. It's the same variation trick as AtIndexString but with a plain text input - which is handy when the options are static and you just want to type them into the node rather than wire them in from elsewhere.

    Installing RF Nodes

    No dependencies, no models. Via ComfyUI Manager search "RF Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/foxtrot-roger/comfyui-rf-nodes
    

    Restart ComfyUI; it's under RF in the menu.

    Common issues

    • Off-by-one. Zero-based: first line is index 0. The most common "wrong option" cause.
    • "It always returns the same line." - If the index input is a constant (default 0), it will. Give it a value that changes per run.
    • "Index 99 on 3 options?" - 99 % 3 wraps to the right line, no crash. That's by design.
    CategoryRF

    Inputs (2)

    NameTypeDefaultDescription
    indexINT0
    textSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING