Nodes/ComfyUI-Shinsplat/Green Box (Shinsplat)
ComfyUI Node

Green Box (Shinsplat)

A prompt-list iterator that only hands out each prompt once

By Shinsplat·Created 2 years ago·Updated about a year ago· 47
Green Box (Shinsplat)
    • chain
    • prompt
    • _int
    • _flt
    • help
    text
    looptrue
    randomizetrue
    enabledtrue
    start_overfalse
    chain

    Random prompt nodes are great until they repeat the same prompt three times in a row. Green Box solves that the way a playlist does: it takes a list of prompts, shuffles or sequences them, and hands each one out exactly once before rolling over. It's the pack's answer to wildcard-style iteration, and the chaining design makes it the cleanest way to build a "one prompt per generation" loop in ComfyUI without a pile of switch nodes.

    How it works

    You type your prompts into the text box, one per line - the README is very specific that one line equals one prompt and that <enter> ends it (extra blank lines are ignored). The node splits on newlines, optionally shuffles with randomize, and pops one prompt per run. loop (default on) restarts from the top when the list runs out; with loop off, it returns an empty string once exhausted. The END directive works here too: anything after the uppercase END in the box is ignored.

    The chain system is where it gets clever. chain in/out lets you link Green Boxes together - the first node's chain output feeds the next node's chain input, and the last node's prompt output carries everything. So you can compose prompt fragments across multiple boxes and still get one assembled prompt, which plays nicely with this pack's encoder prompt_before/prompt_after inputs. enabled disables a node's selection (it still passes the chain along), and start_over resets the pointer to the top of the list - deliberately local to that node, not the whole chain.

    Two extra outputs: _int and _flt attempt to convert the current line to an integer or float, which the author added so he could iterate generations using the same seed while cycling different prompts - wire _int into a seed or cfg and your list becomes a parameter sweep.

    The inputs and outputs

    • text - one prompt per line.
    • loop, randomize, enabled, start_over - the four behavioral toggles.
    • chain - optional link input from another Green Box.

    Outputs: chain (to the next box), prompt (the current assembled prompt), _int, _flt, and help (the author's full usage notes).

    How to install it

    Ships in ComfyUI-Shinsplat:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Shinsplat/ComfyUI-Shinsplat
    

    or ComfyUI Manager → "ComfyUI-Shinsplat" → restart. No extra deps.

    Common issues

    • "My multi-line prompt got split" - by design: one line is one prompt. If you want multi-line text inside a single iteration, chain two boxes together so the fragments assemble before output.
    • Comments don't work - the author tried, hit a parser bug, and removed them. Don't put # lines in; they'll be treated as a prompt.
    • _int/_flt empty - the line just isn't a number; they're convenience outputs for numeric lists, not for arbitrary prompts.
    Categoryadvanced/Shinsplat

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    loopBOOLEANtrue
    randomizeBOOLEANtrue
    enabledBOOLEANtrue
    start_overBOOLEANfalse
    chainoptSTRING

    Outputs (5)

    NameTypeDescription
    chainSTRING
    promptSTRING
    _intINT
    _fltFLOAT
    helpSTRING