Nodes/Simple-wildcards-for-comfyui/Wildcard Injector (Dynamic)
ComfyUI Node

Wildcard Injector (Dynamic)

Type __wildcard1__ in your prompt and get a random pick — this is the node that does it

By OmniCromn·Created 5 months ago·Updated 5 months ago· 0
Wildcard Injector (Dynamic)
  • wildcard1
  • wildcard2
  • wildcard3
  • wildcard4
  • wildcard5
  • text
text

Wildcard Injector (that's its full name in the node menu, "(Dynamic)" and all) is where the randomness actually happens in this two-node pack. You type a prompt with tokens like __wildcard1/mammals__ into its text box, feed it up to five wildcard_data bundles from a Wildcard Loader, and it spits out a plain string with the tokens replaced by random entries. The README's framing is the whole pitch: "it doesn't matter since it's just text." Output is a STRING, so it wires into any CLIP Text Encode - positive or negative, or even an empty-prompt trick if you want.

Why reach for it instead of the ecosystem-standard wildcard processor? This pack is deliberately minimal - one file, no dependencies - and the display name earns its "Dynamic": which loader a token resolves to is decided by which input you connected, not by a filename in the token. It's the right call when you want wildcard variety without dragging in Impact Pack's whole face-detailing arsenal. The tradeoff, which is real: wildcard .txt libraries written for Impact or Dynamic Prompts use __filename__ syntax and won't resolve here.

The syntax, since that's the actual point

Wildcard files use HTML-style tags, and the bundled animals.txt is a working example:

<mammals>
dog:2
cat:3
<rodents>
rat
mouse
</mammals>

Then in the text box: a photo of a __wildcard1/rodents__ pulls from rodents. Because tags nest, __wildcard1/mammals/rodents__ reaches the same group through the path - the tag filter matches from the outermost tag in. Three extra tricks the code supports (the README documents recursion, and half-documents the rest):

  • Weights. cat:3 makes cat three times as likely as an unweighted line. A weight in the token itself works too: __wildcard1/mammals:2__ biases the whole group.
  • Recursion. An entry can itself contain __wildcard1/...__ tokens, and the injector resolves those too, up to ten levels deep. You can chain wildcards inside wildcards.
  • Adjoining. __wildcard1/mammals/&birds__ merges two groups into one weighted pool - a genuine "or" between categories, undocumented in the README but right there in the source.

Inputs and outputs

  • text (required, multiline) - your prompt, tokens and all. This is the only required input.
  • wildcard1–wildcard5 (optional) - connect Wildcard Loaders here. The number in __wildcard1__ refers to the input, so __wildcard1__ uses whatever is plugged into wildcard1.
  • Output: one text (STRING), straight into a CLIP Text Encode node.

Installing

Same pack as the loader: ComfyUI Manager → search Simple-wildcards-for-comfyui, or git clone https://github.com/OmniCromn/Simple-wildcards-for-comfyui into ComfyUI/custom_nodes, then restart. No dependencies, no models to download.

Where people get burned

  • A typo in a tag silently returns nothing. __wildcard1/rodant__ isn't an error - it just becomes an empty string, and your prompt quietly loses a phrase. The empty-string behavior is by design (it's what makes "unconnected = nothing" work), so check spellings when your images start missing subjects.
  • Unconnected wildcard input = empty replacement. Leave wildcard5 unwired and a __wildcard5__ token collapses to nothing instead of erroring. Handy once you know it, confusing before.
  • Repeated tokens pick the same entry. Two __wildcard1__ tokens in one prompt share the same seed and file, so they draw the same value. If you want two different picks, use different tag paths or different loaders.
  • The same image every run. Nothing in this pack overrides ComfyUI's cache, so if no input changed, the injector doesn't re-run and you see the same pick forever. Fix: drive the loader's seed from a Seed node set to randomize - a changed seed is a changed input, and the pick rolls again.

It's a small node with a sharp-ish learning curve on the token syntax, but once the tags and weights click it's the least-fuss wildcard setup this side of Impact Pack.

CategoryWildcards

Inputs (6)

NameTypeDefaultDescription
textSTRING
wildcard1optWILDCARD_DATA
wildcard2optWILDCARD_DATA
wildcard3optWILDCARD_DATA
wildcard4optWILDCARD_DATA
wildcard5optWILDCARD_DATA

Outputs (1)

NameTypeDescription
textSTRING