Nodes/ComfyUI-GTSuya-Nodes/Wildcards Nodes
ComfyUI Node

Wildcards Nodes

Build your wildcard lists right in the graph, no text files

By GTSuya-Studio·Created 3 years ago·Updated 4 months ago· 14
Wildcards Nodes
    • text
    text
    str1
    str2
    str3
    str4
    str5

    Every other wildcards node in this pack reads from .txt files on disk. This one doesn't - it's the file-free version. Instead of a wildcards folder, you wire up to five separate value nodes directly into the graph, reference them in your prompt text with the same double-underscore-style tokens, and the whole thing lives inside your workflow JSON. Share the workflow, and the wildcards travel with it - nobody downstream needs to also receive a folder of text files and remember to drop it in the right place.

    That's the actual selling point, and it's worth being upfront about the trade-off: file-based wildcards scale to hundreds of lines and are easy to edit in a text editor; this node caps out at five wildcard slots and requires a second custom node pack to supply the values. Pick whichever limitation you'd rather live with.

    How it works

    This node is a template engine, not a value source - it doesn't generate random strings itself. Per the README, it's meant to be used with the Random Line node from Hakkun-ComfyUI-nodes, which is the thing that actually holds a list and returns a random entry from it. You wire up to five Random Line (or any STRING-output) nodes into this node's str1 through str5 optional slots, then write your prompt text using __str1__, __str2__, and so on, matching whichever slot each value is plugged into. On each run, the node substitutes whatever string arrived at each connected slot into the matching token in text.

    Inputs and output

    • text - required, multiline. Your prompt, with __str1__ through __str5__ tokens wherever you've wired something in.
    • str1 through str5 - optional STRING inputs. Each one maps to the identically-numbered token in text. You get a maximum of five at once; there's no sixth slot, and no directory-based escape hatch on this particular node if you need more - that's what the file-based wildcards nodes in this same pack are for.

    Output: a single text (STRING), the substituted prompt.

    Installing it

    ComfyUI Manager: search ComfyUI-GTSuya-Nodes, install, restart. Or by hand: cd ComfyUI/custom_nodes && git clone https://github.com/GTSuya-Studio/ComfyUI-Gtsuya-Nodes.git, restart. But note this node is only half the picture - to actually feed it random values as intended, you also need Hakkun-ComfyUI-nodes installed (git clone https://github.com/tudal/Hakkun-ComfyUI-nodes into custom_nodes the same way). Without it you can still wire any STRING output into str1str5, but you lose the "random line from a list" behavior that makes this a wildcards node instead of a plain text-templating node.

    Where people get burned

    The token has to match the slot number exactly - __str3__ in your text only resolves if something is actually plugged into str3, not str1 or str2. Miscounting which slot is which is the easiest mistake to make once you've got three or four wired in. Second, an unconnected str1str5 slot just means its token won't get substituted - the literal __strN__ text stays in your output rather than the node erroring, so a forgotten wire looks like a typo rather than a missing connection until you trace it back.

    CategoryGtsuyaStudio/Wildcards

    Inputs (6)

    NameTypeDefaultDescription
    textSTRING
    str1optSTRING
    str2optSTRING
    str3optSTRING
    str4optSTRING
    str5optSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING