Batch Conditional Text Weight
Conditional Text That Also Randomizes the Weights — the Fiddly One
- STRING
The same conditional gate, but it hands you weighted tags
Take Batch Conditional Text - the frame-range gate that emits text only when the current batch index is in range, optionally on a coin flip - and add one twist: when it does fire, it doesn't hand you the text as-is. It splits your text into comma-separated tags and wraps each one in an attention weight that it rolls randomly between two bounds you set. Output looks like (knight:1.23),(dragon:1.05),(armor:1.18). Every qualifying frame gets a fresh, slightly different emphasis.
That's the whole pitch of Batch Conditional Text Weight, the sibling node from Moon-NE's MoonNe_Nodes pack. It's the one I'd call the fiddly member of the family: the range and probability logic is identical to its sibling, but the weight mechanic drags in some model-specific baggage you should know about before you build a workflow around it.
How it works
The gating is copy-paste from BatchConditionalText, and it's worth understanding because the values swap meaning depending on which is bigger:
greater_than < less_than→ fires inside the range (greater_than <= index <= less_than).greater_than > less_than→ fires outside the range (belowless_thanOR abovegreater_than).greater_than == less_than→ fires only at that exact index.
When the gate opens, the node splits your text on commas (it even converts full-width , so your CJK-style punctuation doesn't break things), strips each tag, and for each one draws a random weight from uniform(min_weight, max_weight) - formatted as (tag:1.23) - then re-joins with commas. If min_weight > max_weight, it quietly swaps them rather than erroring. Combined with the probability roll (0–1) and the seed, every frame gets a deterministic-but-unique draw via f"{seed}_{batch_index}".
The baggage: (tag:1.3) is a lie on modern models
This is where the fiddly part bites. Attention weights like (knight:1.2) are CLIP-era syntax - they're real on the SDXL lineage (Illustrious, NoobAI, Pony V6 and friends), where the text encoder was trained to read them. But the 2026 crop of LLM-encoded models - Flux 2 Klein, Z-Image, Anima, that whole family - silently discard them: the encoder wrapper passes disable_weights=True and the numbers do nothing. The tags still matter; the weights are decorative.
So before you wire this node into your workflow, know which model you're talking to. On an SDXL-lineage checkpoint this node is a legit per-frame prompt-roulette: gate it to a frame range, set min_weight: 0.8, max_weight: 1.5, and watch emphasis wander across the animation. On a modern LLM-encoded model, you're paying the complexity for a plain random tag-picker - the numbers do nothing, and you'd be better off with plain Batch Conditional Text and a wildcard node. Neither is wrong; knowing which you're on is everything.
Inputs and output
- batch_index (INT) - the current frame/batch index. Feed it from your animation loop or counter - ComfyUI won't auto-increment it for you, so a constant 0 means every frame is "frame 0" and the gate behaves uniformly across the whole batch.
- text (STRING, multiline) - your comma-separated tag list. Commas are load-bearing here.
- greater_than, less_than (INT) - the range pair described above.
- probability (FLOAT, 0–1) - chance to fire on a qualifying frame.
- min_weight, max_weight (FLOAT, 0–10) - bounds for the per-tag random weight. Defaults
1.0and1.4are a sensible conservative spread. - seed (INT) - base seed for the per-frame draw.
Output is a single STRING - the weighted tag string, or "" when the gate stays shut (which is harmless chained into a CLIP Text Encode). The node also overrides IS_CHANGED to force re-evaluation every run, so the roll never gets frozen by ComfyUI's cache.
Install
Same as the rest of the pack, and it's light - pure Python stdlib, no requirements.txt, no model files:
cd ComfyUI/custom_nodes
git clone https://github.com/Moon-NE/MoonNe_Nodes
Or search for MoonNe_Nodes in ComfyUI Manager and hit Install, then restart ComfyUI. This is a niche node for a niche need - per-frame randomized emphasis on a CLIP-encoder model - but when that's what you're building, it's the shortest path to it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| batch_index | INT | 00–999999 | — |
| text | STRING | — | |
| greater_than | INT | 0 | — |
| less_than | INT | 999 | — |
| probability | FLOAT | 1.000–1 | — |
| min_weight | FLOAT | 1.000–10 | — |
| max_weight | FLOAT | 1.400–10 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |