Nodes/ComfyUI Random Wildcard Loader/Random Wildcard Loader (Advanced)
ComfyUI Node

Random Wildcard Loader (Advanced)

The wildcard node with useful knobs — LoRA triggers, subfolder pins, same-file mode

By BWDrum·Created 8 months ago·Updated 8 months ago· 1
Random Wildcard Loader (Advanced)
    • combined_text
    num_files1
    seed0
    prompt
    loaded_contents
    loaded_wildcards
    separator,
    subfolder
    prefix
    suffix
    include_nestedAll Levels
    same_fileDifferent Files
    refreshfalse

    The basic Random Wildcard Loader is great until you want control. That's the job of its sibling, Random Wildcard Loader (Advanced): everything the basic node does - __colors__-style expansion, $prompt Mad Libs fills, seed-based reproducibility - plus the knobs that make wildcards usable in real workflows. If you're generating a themed batch, want a LoRA trigger on every output, or need the random picks to stay inside one category, this is the one to reach for.

    The mechanics underneath are identical, so read the basic node article for the full picture. Both read .txt files from ComfyUI/wildcards/ (one option per line, subfolders fine, folder auto-created on first run), expand __wildcard__ and $prompt placeholders in the prompt field, and seed Python's random so the same seed always reproduces the same draw. What the Advanced node adds is control over how the result is shaped.

    The inputs that actually do things

    • prompt - your template, exactly like the basic node.
    • num_files - how many random wildcard lines to append (0–100). Crank this up and you're essentially fuzzing the prompt.
    • seed - the draw control. ComfyUI only re-runs this node when the seed changes, so bump it (or toggle refresh) to roll again.
    • separator - text between the expanded prompt and each appended wildcard. Defaults to , , which is right for tag-based models. The basic node is stuck with newlines; this one isn't.
    • subfolder - restrict the random pool to one folder, e.g. styles. You type it by hand, so match folder names exactly.
    • prefix and suffix - wrap the entire combined output. prefix gets a trailing space, suffix gets a leading , . The canonical use is LoRA triggers: prefix <lora:my_style:0.8>, suffix masterpiece, best quality, and every randomized prompt ships with both.
    • include_nested - All Levels scans subfolders; Top Level Only sticks to a single directory. Useful when your subfolder contains nested sub-subfolders you don't want polluting the pool.
    • same_file - Different Files picks num_files distinct files; Same File picks one file and draws num_files lines from it.

    One behavior worth knowing: Same File draws with replacement, so the same line can show up twice in a single output. If that bugs you, that's where it comes from - it's a dice roll, not a bug.

    loaded_contents and loaded_wildcards are readouts (updated by the node's JS), and the single output, combined_text, is a STRING that wires into a CLIP Text Encode or anywhere else a prompt text goes.

    Install

    Same as the basic node - ComfyUI Manager, search "Random Wildcard Loader", or:

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

    Restart ComfyUI. No dependencies, no models, no pip installs.

    Gotchas

    The silent-failure rules carry over from the basic node: an unresolvable __wildcard__ or a $prompt with an empty pool passes through as literal text, so check the loaded_wildcards readout if your images start spelling out __colors__. Prefix and suffix only apply when there's actual output - empty prompt plus nothing loaded means the whole thing, prefix included, comes back empty. And if subfolder points at a folder that doesn't exist, the pool is empty and your $prompt placeholders survive all the way to the text encoder. Fix the folder name, not the prompt.

    For a tiny single-author pack, this is surprisingly complete. The author's stated use case - prompt adherence testing, running one skeleton across randomized fills to see what a model actually follows - is genuinely fun with num_files cranked up. Just keep your wildcard files tidy, because the node trusts them completely.

    Categorytext/wildcards

    Inputs (12)

    NameTypeDefaultDescription
    num_filesINT10–100
    seedINT00–18446744073709550000
    promptSTRING
    loaded_contentsSTRING
    loaded_wildcardsSTRING
    separatorSTRING,
    subfolderSTRING
    prefixSTRING
    suffixSTRING
    include_nestedCOMBOAll Levels2 options: All Levels, Top Level Only
    same_fileCOMBODifferent Files2 options: Different Files, Same File
    refreshBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    combined_textSTRING