Nodes/ComfyUI-DaSiWa-Nodes/DaSiWa Random String Picker
ComfyUI Node

DaSiWa Random String Picker

{wildcard|inline} prompt syntax, no manager needed

By darksidewalker·Created 4 months ago·Updated 23 days ago· 22
DaSiWa Random String Picker
    • text
    text

    This is ComfyUI's answer to A1111-style wildcard syntax, minus the separate wildcard manager extension and the wildcard text files. Feed it a string with {option one|option two|option three} groups in it, and it swaps each group for one randomly chosen option every time it runs - everything else in the string passes through untouched.

    How it works

    Drop this node between any text-producing node (a plain text box, a prompt builder, whatever) and whatever consumes the final string (your CLIP Text Encode, typically). Write your prompt with curly-brace groups anywhere you want variation: {red|blue|green} car in {sunlight|rain|fog} picks one option from each group independently, so a single string can produce a large number of distinct combinations without you writing out every variant by hand or maintaining a separate wildcard file. Groups are processed independently of each other - the choice in one group has no effect on the choice in another, so {cat|dog} and {happy|sad} combine freely rather than being paired.

    Text outside complete {...} groups is left exactly as written - this only touches what's inside braces, so the rest of your prompt is safe to write normally, including punctuation and spacing right up against a group.

    The inputs and outputs that matter

    There's exactly one input and one output, and that's the whole interface: text (multiline STRING) in, text (STRING) out. No seed control, no group-count limit exposed as a parameter - it processes whatever groups it finds, however many there are, and the randomness is per-run rather than something you pin to a specific seed value through this node.

    How to install it

    ComfyUI Manager - search DaSiWa-Nodes, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/darksidewalker/ComfyUI-DaSiWa-Nodes
    pip install -r ComfyUI-DaSiWa-Nodes/requirements.txt
    

    Restart. This is about as lightweight as a custom node gets - one text field in, one text field out, no models, no external dependencies beyond what the rest of the pack needs at import time.

    Common issues & troubleshooting

    A group didn't get replaced. Check the braces are actually complete - {red|blue without a closing } isn't a valid group by the README's own definition ("complete {...} groups"), so it gets left as literal text, braces and all, rather than erroring or guessing what you meant.

    Same result every single run. If you're seeing that, it's worth checking whether ComfyUI's own caching is the culprit rather than the node itself - if nothing upstream of this node changed between runs, ComfyUI may not re-execute it at all. Nudge something upstream (or check whether the node is set to always re-run) if you're expecting fresh randomness every queue and not getting it.

    Nested or overlapping braces behave unpredictably. The node is built around simple, non-nested {a|b|c} groups - if you're trying something like {red {light|dark}|blue} for weighted or nested variation, that's outside what this node is documented to do, and you're better off with two separate passes (or two separate nodes) than one clever nested string.

    Want weighted options, not equal probability. Nothing in the schema exposes a weight syntax - every option in a group is presumably picked with equal likelihood. If you need certain options to come up more often, the practical workaround is repeating that option inside the group: {red|red|blue} biases toward red without needing a weight parameter that doesn't exist here.

    CategoryDaSiWa/Text

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING