Random Prompt From Book
Turn any text file into a prompt slot machine
- STRING
Wildcard nodes usually expect a specific folder structure and __syntax__ convention - the pack's own Prompt Checker node, credited to Impact Pack's approach, works that way. RandomPromptFromBook skips all of that: point it at any plain text file - a "book," or really just a pile of lines - and it picks a handful of entries at random and hands you back one prompt string. If you've got a big dump of tags, phrases, or ideas sitting in a .txt file from anywhere (a Danbooru tag list, a scraped word bank, an actual book), this turns it into raw material for prompt variation without reformatting anything.
What the fields actually do
book_txt is the path to your text file - the default value, c:\books\my_book.txt, is a giveaway that this pack was built on Windows, so if you're running Linux (including a hosted ComfyUI instance) you'll need to swap in a real path before this does anything. min_choices and max_choices (both 1–20) bound how many entries get pulled per run - the node picks a count somewhere in that range, then that many entries from the file. seed makes the random selection reproducible, same as everywhere else in this pack. break_choises is a boolean, default true - the field name suggests it controls whether the file gets split into discrete entries (most plausibly line by line, though the README doesn't spell out the exact delimiter) versus treated as one undifferentiated blob; leave it on unless you have a specific reason to want the whole file's text pulled as a single chunk.
Output is a single STRING - the concatenated result of whichever entries got picked, ready to feed straight into a CLIP Text Encode or wherever else a prompt string goes.
The fields worth setting
book_txt- the actual path to your source file. Fix the Windows-style default first.min_choices/max_choices- how many random entries get pulled and combined per run.seed- reproducibility. Same seed, same file, same selection.break_choises- leave at the default (true) unless you're deliberately testing otherwise.
Installing SP-Nodes
Through ComfyUI Manager: search "SP-Nodes," install, restart. Or clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/bananasss00/ComfyUI-SP-Nodes
Restart ComfyUI once it's in place. No model download needed - this reads a plain text file, nothing more exotic than that.
Where this trips people up
The Windows default path is the first thing that bites anyone not on Windows - c:\books\my_book.txt won't resolve on Linux or macOS (or on a hosted ComfyUI service like comfy.icu, where the filesystem isn't your desktop at all); you have to point it at a real file the ComfyUI process can actually read, which on a hosted instance usually means an uploaded input rather than a local path.
Beyond that, a file that's too short for your min_choices/max_choices range is the obvious edge case - asking for up to 20 choices out of a file with five lines isn't going to behave the way you'd expect, so size your range to the actual content. And because entries are joined into one string with no separator logic exposed as a parameter, don't expect fine control over punctuation or spacing between the picked pieces - if the output reads awkwardly, that's a property of your source file's formatting, not something this node's fields can fix directly.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| book_txt | STRING | c:\books\my_book.txt | — |
| min_choices | INT | 11–20 | — |
| max_choices | INT | 11–20 | — |
| seed | INT | 00–18446744073709550000 | — |
| break_choises | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |