"I use many wildcards, but I often felt like I was seeing the same results too often. So, I 'VibeCoded' this node with a memory feature to avoid the last (x) used wildcard words.
I'm just sharing it with the community – if you need help, I'll try my best, or you can always ask Gemini or ChatGPT.
Have fun!"
Smart Wildcard Loader: Quick Start
*Update 1.01:
Now you can use __wildcard__+x (x = number) to Pick more than one Line.
Now you can use __*wildcard*__ to search for all Files that Contain this Word.
1. Setup
File: Save SmartWildcard.py in ComfyUI/custom_nodes/.
Folder: Create a wildcards folder in your main ComfyUI/ directory.
Content: Put your .txt files (one option per line) inside that folder.
2. How to use it
Inline: {red|blue|green} picks one color directly from your text.
Files: __subjects__ picks a random line from wildcards/subjects.txt.
Combos: You can mix them! Example: {__hero__|__villain__} in __location__.
3. Settings Explained
seed: Set to randomize for a new result every time you click "Queue".
history_depth: The Brain: How many previous results to "remember" and block. Set to 3 to ensure you don't see the same item again for at least 3 images.
debug: Turns on Color-Coding in your terminal to show exactly what the node is picking.
4. Reading the Debug Logs (Console)
If debug is ON, your terminal will show:
🟢 [CHOICE]: The word picked from your .txt file.
🔵 [CURLY]: The word picked from your {} brackets.
🟡 [STATS]: Pool: 7/10 means 7 lines are available, while 3 are blocked by history.
[RESET]: Memory is full! The node is clearing its history to start fresh.
Why use this?
Variety: Unlike standard loaders, this "remembers" what it picked so you don't get the same image twice in a row.
Deep Logic: A file can contain another file tag, letting you build complex, nested prompt systems easily.
All "Memory" are in your RAM. So wehn you Close Comfy the Node "forgett" everything.

