Nodes/Vantage-Nodes/String List Stepper
ComfyUI Node

String List Stepper

String List Stepper for per-frame text

By vantagewithai·Created 8 months ago·Updated about a month ago· 25
String List Stepper
    • string
    • index
    • count
    text
    current_index0
    step1
    wraptrue
    include_emptyfalse

    String List Stepper takes a multiline string - one prompt per line - and walks through it one line at a time, like a cassette deck for text. It's the node you use when a workflow needs to change its prompt across a batch or across frames instead of generating the same text a hundred times.

    The classic setup is batch prompt variation: write ten prompts, hook the output into your CLIP Text Encode, and let a frame counter drive which line gets encoded. Used to be you'd bolt together a picker and some hand-rolled index math for this. This node does the stepping in one place, and it also tells you the current index and the total line count, which is exactly what a loop needs.

    How it works

    The run() method splits the text into lines, drops blank ones unless you ask it not to, then computes:

    idx = current_index + step
    idx = idx % count if wrap else max(0, min(idx, count - 1))
    

    So the returned string is one step past current_index, not the line at current_index. That's the design quirk to internalize: this is a stepper, not a picker. You feed the output index back into current_index for the next iteration and the walk keeps moving. Set step to -1 to go backwards.

    Inputs:

    • text (STRING, multiline) - your list, one item per line.
    • current_index (INT, default 0) - where the walk currently is.
    • step (INT, default 1) - how far to move each execution.
    • wrap (BOOLEAN, default true) - loop back to the start instead of clamping at the end.
    • include_empty (BOOLEAN, default false) - keep blank lines as real items.

    Outputs: string (STRING), index (INT - the new position), count (INT - total items).

    Where you'd reach for it

    • Batch prompt variation: ten prompt lines, a seed or frame counter driving current_index, one workflow generating ten different outputs.
    • AnimateDiff / video keyframing: cycle a subject description per frame range so the model sees changing text while motion plays out.
    • Procedural text: feed LLM outputs or wildcard-style lists in and let the graph step through them.

    It's the sibling of the same pack's "Multiline String → Item & Count" picker (which grabs one line by a fixed index) - this one is for when the index should advance on its own.

    Gotchas

    • The output index is current_index + step, so don't read the returned string as "the line at current_index." If you want that, you want the fixed-index picker instead.
    • Empty input returns ("", 0, 0). Wire that into a text encoder and you'll encode an empty prompt, which isn't an error but may not be what you wanted.
    • wrap on means the walk never stops; wrap off means it sticks at the last line once it reaches the end.

    Installation

    Vantage Nodes is one install for the whole pack. In ComfyUI Manager search "Vantage Nodes," or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vantagewithai/Vantage-Nodes.git
    pip install -r requirements.txt
    

    Restart ComfyUI. The bulky requirements.txt covers the pack's GGUF and Qwen TTS nodes; string utilities like this need nothing extra.

    Troubleshooting

    • Stepper skips the first line: it's stepping from current_index, so starting at 0 with step 1 returns line 2 first. Start current_index at -1 if you want line 1 first, or feed the output index back as described above.
    • Blank lines showing up as prompts: flip include_empty back to false.
    CategoryVantage/String

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING
    current_indexINT0
    stepINT1
    wrapBOOLEANtrue
    include_emptyBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    stringSTRING
    indexINT
    countINT