Nodes/As_ComfyUI_CustomNodes/TextWildcardList_AS
ComfyUI Node

TextWildcardList_AS

A $list wildcard node that's smaller than it looks

By flyingshutter·Created 3 years ago·Updated about a year ago· 8
TextWildcardList_AS
    • STRING
    text$list
    strings
    idx0

    TextWildcardList_AS is a miniature wildcard picker: you give it a prompt template containing $list, a comma-separated list of replacement strings, and an index - and it swaps $list for the string at that position. One STRING out, ready to feed a CLIP Text Encode.

    Let's be clear about scope, because the name overpromises. Real wildcard packs (like Impact Pack's wildcard system) scan folders of text files, pick randomly or by category, and inject anywhere in a prompt. This node is a manual, single-placeholder version: exactly one $list, one list you type yourself, one index you choose. It's the "I want a small rotating vocabulary without installing a wildcard framework" option.

    It lives in the conditioning category in ComfyUI, though it deserves a footnote: it outputs a plain STRING and never touches conditioning directly - you still wire its output into your own CLIP text encoder. The conditioning label just reflects where it shows up in the menu.

    How it works

    The mechanism is two steps in one function. First it splits the strings field on commas and picks the element at idx (wrapping around with modulo, so an index past the end of the list cycles back to the start). Then it replaces every $list in the text field with that picked string. Whitespace around list entries is stripped, so red, blue, green gives you red, blue, green without stray spaces.

    That's the whole thing. No random selection, no nested wildcards, no file loading - a deterministic index into a comma-separated list.

    The inputs that matter

    • text - your template, with $list where the replacement goes.
    • strings - the comma-separated pool of replacements.
    • idx - which entry to use (0-based; wraps around).

    Output: STRING with the substitution applied.

    Where you'd use it

    Two patterns. First, a variant loop: hook idx up to a counter or a batch index and cycle your prompt through different subjects, styles, or camera angles across multiple runs - handy for quick variation sweeps without touching the prompt by hand each time. Second, a poor man's random wildcard: drive idx from a seed or a random int node and let the list act as a tiny vocabulary. If you want true weighted randomness and folder-based wildcard files, upgrade to a real wildcard pack; but for a single rotating slot, this is genuinely all you need.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/flyingshutter/As_ComfyUI_CustomNodes
    

    Restart ComfyUI, then look under the conditioning menu (ComfyUI Manager: search "As_ComfyUI_CustomNodes"). No extra dependencies.

    Common issues

    • Only one placeholder. $list can appear multiple times in text and all get replaced, but there's only one list pool. If you want two different wildcard slots with independent pools, you'll need two of these nodes chained or a real wildcard pack.
    • Commas in your list break it. Splitting is naive - an entry containing a comma (like a multi-word phrase with a comma) gets split apart. Keep entries comma-free.
    • Expecting randomness. There is none by default. idx picks deterministically; if you want variety, feed it a varying index yourself.
    • Category confusion. It sits in conditioning but outputs a plain string - remember to attach a text encoder if your target expects conditioning.

    For a tiny utility it's a decent entry point into wildcard-style prompting. Just know it's a single-slot manual picker, not a wildcard engine.

    Categoryconditioning

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING$list
    stringsSTRING
    idxINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING