Nodes/ArtyClaw Comfy Nodes/Wildcard & RNG Processor
ComfyUI Node

Wildcard & RNG Processor

Old-School A1111 Wildcards, Resurrected as a ComfyUI Node

By artyclaw·Created 5 months ago·Updated 5 months ago· 0
Wildcard & RNG Processor
    • string_out
    string_in
    seed0
    reload_wildcardsfalse
    debugfalse

    Remember when a prompt could be a slot machine? Wildcard & RNG Processor drags the old A1111 wildcard workflow into ComfyUI: you write __location__ in your prompt and the node swaps in a random line from a text file, so a hundred generations don't all describe the same park bench. It also handles the inline {a|b|c} syntax, including weighted options and multi-pick. It's one of the few ComfyUI nodes that does all three from a single string, and it comes from the artyclaw/artyclaw-comfy pack.

    The knowledge base calls A1111 wildcard syntax "something most people arriving after 2024 never learned," and that's the honest framing here: this node speaks that dialect, not the fancier __file__-with-{} hybrid a lot of modern wildcard packs use. If you cut your teeth on the old way, it feels like coming home.

    How it works

    The node loads wildcard sets from folders listed in py/wildcard_config.yaml inside the pack (relative paths are resolved from the ComfyUI root - the default is ComfyUI/wildcards). Every .txt file becomes a wildcard keyed by its path, so art/locations.txt becomes __art/locations__, and .yaml/.yml files are walked recursively, with each leaf list becoming a key. Lines starting with # are ignored.

    Then it loops, up to 20 iterations deep, resolving:

    • __key__ - random line from the matching file.
    • {a|b|c} - one random choice, comma-joined.
    • {2$$a|b|c} - the 2$$ prefix picks two distinct items (weighted, without replacement).
    • a|b:2.5|c - weighted options, where b gets 2.5× the chance.

    Nested wildcards resolve because the loop keeps replacing until nothing changes. The seed input makes it deterministic; flip reload_wildcards on to force a rescan of the folders, and debug prints every resolution to the console so you can see what it picked and why.

    Inputs and outputs

    • string_in - your prompt with wildcards and {} blocks.
    • seed - reproducibility, tie it to your global seed.
    • reload_wildcards - rescan the config folders.
    • debug - verbose console logging.

    One output, string_out, ready for a CLIP text encode.

    Install

    ComfyUI Manager → search ArtyClaw Comfy Nodes, or:

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

    Restart, then edit py/wildcard_config.yaml to point at your wildcard folders. The one real dependency, yaml, already ships with ComfyUI, so there's nothing extra to install.

    Where people get burned

    The config file is the whole ballgame and it's easy to miss. If every wildcard resolves to nothing and your string_out is full of __key__ leftovers, the paths in wildcard_config.yaml don't match your setup - that's the number one support complaint pattern for this kind of node. Second: the recursion cap is 20, so a self-referencing wildcard won't hang forever, but it also means deeply nested sets may just stop. Third, debug is genuinely useful here - the "not found" warning per key only prints when it's on. Turn it on once, confirm your keys resolve, turn it off.

    CategoryText/RNG

    Inputs (4)

    NameTypeDefaultDescription
    string_inSTRING
    seedINT00–18446744073709550000
    reload_wildcardsBOOLEANfalse
    debugBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    string_outSTRING