FL Prompt Selector Basic
Pull one line out of a prompt list by index, safely
- STRING
You've got a text box with twenty prompts in it, one per line, and you want the node to spit out a different one each run so you can batch through them. That's the whole job here. FL_PromptSelectorBasic takes a multi-line string and an index, and returns the single line at that index. The "basic" in the name is doing real work - this is the stripped-down version that just picks a line and gets out of the way.
Where it earns its keep is the small detail that it wraps the index with a modulo. Ask for line 10 in a list that only has 3 lines and it doesn't error or return blank - it loops back around (10 mod 3 = line 1). So you can drive the index off a counter or a seed that climbs forever and never worry about running off the end of your list.
How it works
The node splits your text on newlines into a list, then indexes into it with index % line_count. That's it. No CLIP, no encoding, no model - it's pure string handling, so it costs nothing and runs instantly. The output is a plain string that you then feed into your text encoder (or a positive-prompt input, or another string node) exactly like you'd type a prompt by hand.
The inputs and outputs that matter
Two inputs, both required:
prompts(STRING, multiline) - your list, one prompt per line. This is the box you paste into.index(INT, 0–6969, default 0) - which line to grab, counting from 0. Because of the modulo wrap, any value in range is safe; hook it to a seed or a primitive integer to cycle.
Output is a single STRING - wire it straight into your CLIP Text Encode's text input.
When you'd reach for it
This is the tool for methodical batch runs: line up your candidate prompts, put a "increment" counter on the index, queue the batch, and let it walk the list. It's also the clean way to A/B a handful of prompt variants without rewiring anything - just bump the index.
If you need the selector to also glue on a fixed prefix or suffix (a shared style tag, say), that's the sibling node FL_PromptSelector, which adds prepend/append with automatic spacing. And if you want to process all the lines in parallel as a list rather than one at a time, look at FL_PromptMulti. FL_PromptSelectorBasic is deliberately the no-frills one - reach for it when "give me line N" is all you actually need.
Installing it
ComfyUI Manager: search ComfyUI_Fill-Nodes, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. This node has no special dependencies of its own - it's pure Python string work - but note that Fill-Nodes is a large grab-bag pack, so the install brings a pile of other libraries along for its heavier nodes whether you use them or not.
Common issues & troubleshooting
Blank lines count. An empty line in your box is still a line, so it'll happily select an empty string and hand it downstream. Trim stray newlines if a "prompt" comes back empty.
The index isn't landing where you expect. Remember it's zero-based (index 0 is the first line) and it wraps. If your list has 5 lines, index 5 gives you line 0 again, not an error.
Nothing changes between runs. The node only advances if the index value actually changes. Static index = same line every time; drive it from a counter or seed if you want it to move.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| prompts | STRING | — | |
| index | INT | 00–6969 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |