Define Inline Wildcard
Randomize parts of your prompt without wildcard files — Define Inline Wildcard, explained
- prev_vars
- wildcard_bundle
It's half a Dynamic Prompts, and that's the point
Plain ComfyUI gives you one prompt per workflow. If you want every generation to pick a different outfit, camera angle, or background - the character-reference-library trick where you batch 32 and get the same person in 32 outfits - you've got to bolt something on. The usual options are a Dynamic Prompts port, a wildcard .txt file system, or the old A1111 {this|that} bracket syntax that most post-2024 arrivals never learned.
Define Inline Wildcard (the node's display name; the class is InlineWildcardGenerator) is the no-filesystem option. You type your options straight into the node, it picks one or more at random, and hands them downstream. No text files to create, no folder scanning, nothing to forget to update.
Here's the catch, and it's the first thing to internalize: the name is a small lie. This node doesn't output a prompt string. It outputs a custom WILDCARD_BUNDLE, a type only this pack understands, and you must pair it with the pack's second node, Build Prompt from Wildcards (WildcardPromptBuilder), to actually inject the result into your prompt. A two-node mini-system. It's annoying at first, and it's also why the whole thing ships in one dependency-free pack instead of fighting every other custom node in your graph.
How it works
The mechanism is refreshingly small. The generator takes your wildcard_text, splits it on delimiter, strips whitespace, and drops empty entries. Then it uses random.sample - sampling without replacement, so one pick never repeats an option - to grab mix_count options, and joins them with join_separator. That string gets stored under your variable_name in the bundle. Downstream, the builder node takes a template like a photo of a <my_var>, swaps every <my_var> for the stored value, and hands you a finished STRING you can wire into CLIP Text Encode.
Two details are worth knowing because they're deterministic in a way people don't expect. First, the seed input drives a dedicated random.Random(seed), so same seed, same picks - and it's a different seed than your KSampler's, so changing one doesn't change the other. Second, random_mix switches from "always pick exactly mix_count" to "pick a random number between 1 and mix_count," which reads naturally if you want occasionally two elements but usually one.
The inputs that matter
wildcard_text- your options, separated by thedelimiter. Newlines are treated as the delimiter too, so you can write one option per line and it just works. Empty input produces an empty string, not an error.mix_count- how many options to combine (capped at however many you typed; asking for 5 of 3 gives you 3).random_mix- fixed count vs. random count, above.seed- set it to something fixed and your variety becomes reproducible.prev_vars- the optional chaining input. Feed one bundle in, get it back with your new variable added, and a single builder node can then replace several<key>placeholders in one template.
The output is one thing: wildcard_bundle, which feeds only into this pack's builder node.
Installing it
There are no model downloads and no dependencies - the pack is pure Python standard library, not even a requirements.txt. ComfyUI Manager: search "ComfyUI-InlineVariableWildcards" (or just "InlineVariableWildcards"), install, restart. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/A4P7J1N7M05OT/ComfyUI-InlineVariableWildcards
Then restart ComfyUI. You'll find the node under utils → wildcards, and it'll be there with its builder sibling.
Where people get burned
The big one is wiring the bundle into CLIP Text Encode directly and getting a type error - that's the design, not a bug, and the builder node is the missing half. Keep the two together. Also: the bundle type is private to this pack, so don't expect random other prompt nodes to read it. And remember mix_count is a ceiling, not a demand - 50 doesn't mean 50 entries, it means "up to 50." That's genuinely all there is to trip on; for a wildcard system with zero setup cost, this is about as frictionless as it gets.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| variable_name | STRING | my_var | — |
| wildcard_text | STRING | option1, option2, option3 | — |
| delimiter | STRING | , | — |
| mix_count | INT | 11–50 | — |
| random_mix | BOOLEAN | false | — |
| join_separator | STRING | , | — |
| seed | INT | 00–18446744073709550000 | — |
| prev_varsopt | WILDCARD_BUNDLE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| wildcard_bundle | WILDCARD_BUNDLE | — |