Nodes/ComfyUI_Fill-Nodes/FL MadLib Generator
ComfyUI Node

FL MadLib Generator

Mad Libs for prompts, with reproducible per-slot randomness

By filliptm·Created 3 years ago·Updated about 18 hours ago· 628
FL MadLib Generator
    • STRING
    template
    delimiter_1(1)
    delimiter_2(2)
    delimiter_3(3)
    delimiter_4(4)
    delimiter_5(5)
    word_list_1
    word_list_2
    word_list_3
    word_list_4
    word_list_5
    seed-1

    FL_MadLibGenerator is exactly what it sounds like if you remember Mad Libs from childhood: write a template with blanks in it, supply a word list for each blank, and the node fills them in randomly. Except here the "story" is a prompt, and the payoff is generating a bunch of prompt variety without hand-writing every permutation yourself.

    How it's structured. template is your multiline prompt text containing up to five placeholder markers. delimiter_1 through delimiter_5 are the literal placeholder strings - they default to (1) through (5), and you can leave those defaults or customize them to whatever you'd rather write in your template. word_list_1 through word_list_5 are the pools of candidate words for each matching slot. Write something like "a (1) cat wearing a (2) hat in a (3) style", put your options for each blank in the matching word list, and the node swaps each delimiter for a randomly chosen word from its list.

    The randomness has a genuinely nice property baked in: per the pack's own documentation, each delimiter's pick is independently seeded via its own MD5 hash, rather than one master draw deciding all five slots at once. That means changing what's in word_list_3 doesn't shift what word_list_1 picks under the same seed - each slot's randomness is isolated from the others, which makes the results a lot more predictable to reason about when you're iterating on just one word list at a time.

    seed (optional, default −1) controls reproducibility - set a fixed non-negative value to get the exact same substitution every time, or leave the default if your workflow's convention (like several other nodes in this pack) treats −1 as "pick something new." Output is a single STRING - the filled-in template, ready to wire straight into any prompt or CLIP text encode node.

    Installing it is the standard Fill-Nodes routine - search "Fill-Nodes" in ComfyUI Manager, or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
    
    • then restart ComfyUI. Pure string manipulation, no external dependencies.

    Where people get burned. The delimiter matching is a literal string match, not a regex and not fuzzy - if a delimiter you defined never seems to get replaced and just sits in the output unchanged, the almost-certain cause is that the exact string you set in delimiter_1 (or whichever slot) doesn't appear verbatim in template. An extra space, a different bracket style, a typo - any of that breaks the match silently rather than erroring, so if a slot isn't filling in, go character-by-character comparing the delimiter field against what's actually written in the template text. And remember word_list_1 through 5 are all required inputs even if your template only uses two or three delimiters - leaving unused ones with placeholder content rather than blank is the safer habit if you're not sure whether the node validates an empty list gracefully.

    Category🏵️Fill Nodes/Prompting

    Inputs (12)

    NameTypeDefaultDescription
    templateSTRING
    delimiter_1STRING(1)
    delimiter_2STRING(2)
    delimiter_3STRING(3)
    delimiter_4STRING(4)
    delimiter_5STRING(5)
    word_list_1STRING
    word_list_2STRING
    word_list_3STRING
    word_list_4STRING
    word_list_5STRING
    seedoptINT-1-1–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING