Zenkai-Wildcard V2
Wildcards that can contain wildcards (safely)
- STRING
The upgrade in Zenkai-Wildcard V2 is one feature: nested wildcards. V1 picks a line from a file and stops; V2 picks a line, notices it contains another $$token, and resolves that too. That turns flat lists into little generative grammars - $$animal can roll "a $$color cat", which rolls "a blue cat" - and it's the difference between variety and actual composition.
Same pack, same idea as V1: it's DJZ-Nodes' $$name wildcard system, seeded and reproducible. If you only ever use single-level substitutions, V1 is plenty and this adds nothing but a knob. If you want wildcard files that reference each other - a character file that pulls from a clothing file that pulls from a color file - this is the version you'll actually keep in your workflow.
How it works
The lookup is identical to V1: $$name → wildcards/name.txt in the pack directory → random line. The difference is the recursion. recursive_depth (default 5, max 10) caps how deep substitutions can go, and the node processes iteratively - pass over the prompt, resolve what you can, pass again - so nested tokens resolve in any order and the whole thing terminates. The depth cap exists precisely so a cyclic reference (a.txt contains $$a) can't hang your graph; it just stops resolving at the cap.
The nested capability changes how you write files. The author's own example: an animal.txt whose lines are $$color dog, $$color cat, $$color bird, paired with a color.txt of red/blue/green. One $$animal token now rolls a colored animal - combinatorial variety from a handful of files, which is exactly how the old A1111 wildcard scene built huge prompt spaces from tiny lists.
Inputs and outputs
- prompt - your text with
$$nametokens, possibly nested - seed - reproducible randomness
- wildcard_symbol - default
$$, changeable - recursive_depth - 1–10, how deep nesting resolves. 5 is a sensible default; raise it only if your chains are unusually deep.
Output is a single STRING with all substitutions resolved, up to the depth cap - into a CLIP Text Encode or Zenkai Prompt node. As with V1, unresolvable tokens (missing file, empty file, or depth cap hit) stay in the text literally, so a leftover $$something in your output is the debugging clue.
Install
ComfyUI Manager → search DJZ-Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Restart ComfyUI. Standard library only, same as V1 - the pack's heavier dependencies (OpenCV, ffmpeg) exist for its video nodes, not for this one. If the node's missing, check the console for the pack's silent-skip message, "Unable to import ZenkaiWildcardV2".
Troubleshooting
The classic V2 failure is an accidental cycle - a.txt references $$a - which doesn't crash but stops resolving at recursive_depth, leaving a half-expanded token in your prompt. If you see that, it's a cycle, not a bug. The shipped example workflow (the pack's examples/Zenkai-System.json) wires V2 with "A $$color $$animal in a $$location" - a good template to load and adapt, since it shows both nesting and the $$ prefix in one prompt. And remember wildcard files live in custom_nodes/DJZ-Nodes/wildcards/; new files appear without a restart, but the node reads filenames exactly, case included.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| seed | INT | 00–4294967295 | — |
| wildcard_symbol | STRING | $$ | — |
| recursive_depth | INT | 51–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |