Advanced Text Switch
Ten prompt slots with weighted random picks, for artist-mix chaos
- text
The author built this one with a very specific workflow in mind: swapping artist mixes at random when using Illu/NoobAI models. The stock text switch picks between a couple of text inputs; AdvancedTextSwitch gives you ten multiline textboxes, an index or weighted-random mode, and an optional concat_text that prefixes whatever gets chosen. It's the "variety without duplicates" node for people who batch-generate and want every image to pull a different style from a curated pool.
Why you'd reach for it
If you're doing anime batches, the artist-mix game is real: you keep a list of "Hokusai + ukiyo-e," "Makoto Shinkai background style," and so on, and you want each generation to grab one at random instead of you manually cycling them. Ten slots is a lot of variety. The weighted mode is the standout - each slot has a prob_N weight, so you can make your favorite mix show up three times as often as the experimental one without deleting the experiment. And concat_text lets you prepend a fixed base prompt to whichever slot wins, so the random part only swaps the style tail.
How it works
Two modes, from the source. In index mode it's a plain switch: the index input (0-9) selects which text_N comes out. In random mode it seeds a random choice, builds a weighted list by repeating each non-empty text prob_N times, and picks from it - so a slot with weight 3 is three times more likely. If concat_text is non-empty, the output becomes concat_text, selected. One quirk worth knowing: in random mode, a slot with prob_N of 0 or an empty text is excluded entirely, so weights double as an on/off switch.
The author's honest confession in the README: the unused textboxes don't hide like they should - a ComfyUI feature that resisted implementation. It's cosmetic, not functional, but the node takes up vertical space with ten always-visible text areas.
The inputs that matter
- mode (enum) -
indexorrandom. This is the first thing to set. - index (INT, 0-9) - which slot wins in index mode.
- seed (INT) - reproducibility for random mode.
- text_0 through text_9 (multiline STRING) - your pool. Ten slots.
- prob_0 through prob_9 (INT, default
1) - weights in random mode. - concat_text (STRING, optional) - prepended to the winner.
- text (STRING) - the output, wired into your prompt/CLIP text encoder.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/LaVie024/comfyui-lopi999-nodes
Restart ComfyUI, or find "comfyui-lopi999-nodes" in ComfyUI Manager. No model downloads, no dependencies.
Common issues
The visible-textboxes thing will bug you at first, and there's no fix - it's the author's known limitation. In random mode, remember the seed controls the pick: a fixed seed means the same slot wins every run, which is often mistaken for a bug. And if concat_text is set but a slot is empty, the output is just concat_text - so a zero-weight slot still produces output. Keep weights and texts consistent or you'll get mysterious half-prompts.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | index | 2 options: index, random |
| index | INT | 00–9 | — |
| seed | INT | 00–18446744073709550000 | — |
| text_0 | STRING | — | |
| prob_0 | INT | 1 | — |
| text_1 | STRING | — | |
| prob_1 | INT | 1 | — |
| text_2 | STRING | — | |
| prob_2 | INT | 1 | — |
| text_3 | STRING | — | |
| prob_3 | INT | 1 | — |
| text_4 | STRING | — | |
| prob_4 | INT | 1 | — |
| text_5 | STRING | — | |
| prob_5 | INT | 1 | — |
| text_6 | STRING | — | |
| prob_6 | INT | 1 | — |
| text_7 | STRING | — | |
| prob_7 | INT | 1 | — |
| text_8 | STRING | — | |
| prob_8 | INT | 1 | — |
| text_9 | STRING | — | |
| prob_9 | INT | 1 | — |
| concat_textopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |