Nodes/ComfyUI-Unprompted/Set Variable Rack
ComfyUI Node

Set Variable Rack

Feed Unprompted 26 values without one giant prompt box

By ThereforeGames·Created 2 years ago·Updated 2 years ago· 12
Set Variable Rack
  • input_a
  • input_b
  • input_c
  • input_d
  • input_e
  • input_f
  • input_g
  • input_h
  • input_i
  • input_j
  • input_k
  • input_l
  • input_m
  • input_n
  • input_o
  • input_p
  • input_q
  • input_r
  • input_s
  • input_t
  • input_u
  • input_v
  • input_w
  • input_x
  • input_y
  • input_z
  • STRING
◄var_avar_a►
◄var_bvar_b►
◄var_cvar_c►
◄var_dvar_d►
◄var_evar_e►
◄var_fvar_f►
◄var_gvar_g►
◄var_hvar_h►
◄var_ivar_i►
◄var_jvar_j►
◄var_kvar_k►
◄var_lvar_l►
◄var_mvar_m►
◄var_nvar_n►
◄var_ovar_o►
◄var_pvar_p►
◄var_qvar_q►
◄var_rvar_r►
◄var_svar_s►
◄var_tvar_t►
◄var_uvar_u►
◄var_vvar_v►
◄var_wvar_w►
◄var_xvar_x►
◄var_yvar_y►
◄var_zvar_z►

Here's the problem this node exists to solve: the main Unprompted node is brilliant at templating, but all your dynamic values have to live in one text box. Want the filename from a node, a randomly chosen style tag, a mask, all flowing into the same template? You'd be juggling [set var]...[/set] shortcodes inside string_field and praying it stays readable. Set Variable Rack (class UnpromptedSetRack) is the visual answer - a companion to the Unprompted node that hands values over as actual graph wires instead of typed syntax.

It's a simple idea done simply. The node has 26 inputs, input_a through input_z, and 26 text fields, var_a through var_z. Wire anything into input_x and type a name into var_x, and when the node runs, that value gets stored in the shared Unprompted engine as a variable. Downstream, inside an Unprompted node's string_field, you pull it back with the language's variable syntax - {name} (which is shorthand for [get name]). The two nodes talk to each other through the same engine instance, so ordering in the graph is all that matters; the rack just has to execute before the Unprompted node reads it.

The inputs that matter

  • The 26 input_a–input_z ports are wildcard * types - they'll accept a string, an image, a number, whatever you drop in. That any-type looseness is the whole point; it's the same trick other packs use to let one node swallow anything.
  • The var_a–var_z fields are the names of those variables. Don't put content in here; put the token you want to reference in your prompt.

That second bullet is the trap, and it's worth spelling out: the defaults are literally var_a, var_b, and so on. If you wire a string into input_a and never touch the name field, you've just created a variable called var_a - which is probably not what you meant. Rename it to character or pose and then use {character} in your template. Took me one confusing workflow to learn this, so consider the warning free.

What comes out

A single STRING output that is always empty. That's not a bug - the rack's real output is the side effect of populating variables. Don't wire it into a CLIP encoder; the actual prompt processing happens in the Unprompted node. Treat this node as a waystation, not a producer.

The catches

Because the rack writes into the same persistent engine the main node uses, variables live on between queues. If a later workflow doesn't overwrite a name, a stale value can quietly leak into your next prompt. The fix is the same one the pack recommends anyway: enable goodbye_routines on the final Unprompted node in your workflow, which clears the shared variables after the run. Also note this node only stores an input when it's actually connected - an unplugged port is ignored, so you don't need to populate all 26.

Installing it

Same pack as the Unprompted node, so you get it either way: ComfyUI Manager (search ComfyUI-Unprompted), or git clone https://github.com/ThereforeGames/ComfyUI-Unprompted into ComfyUI/custom_nodes, then restart. First launch triggers an auto-install of the engine's pinned dependencies (unprompted, opencv-python, nltk, pattern), which is heavy and one-time - the first boot after install takes a minute or two.

Added in pack v0.3.0, the rack is newer than the node it serves and still lightly traveled. For a beginner it's a nice-to-have; for anyone building a big dynamic-prompt workflow with several moving parts, it's the difference between a readable graph and a wall of shortcode soup. If that's you, it's worth the install.

Categoryunprompted

Inputs (52)

NameTypeDefaultDescription
input_aopt*—
input_bopt*—
input_copt*—
input_dopt*—
input_eopt*—
input_fopt*—
input_gopt*—
input_hopt*—
input_iopt*—
input_jopt*—
input_kopt*—
input_lopt*—
input_mopt*—
input_nopt*—
input_oopt*—
input_popt*—
input_qopt*—
input_ropt*—
input_sopt*—
input_topt*—
input_uopt*—
input_vopt*—
input_wopt*—
input_xopt*—
input_yopt*—
input_zopt*—
var_aoptSTRINGvar_a—
var_boptSTRINGvar_b—
var_coptSTRINGvar_c—
var_doptSTRINGvar_d—
var_eoptSTRINGvar_e—
var_foptSTRINGvar_f—
var_goptSTRINGvar_g—
var_hoptSTRINGvar_h—
var_ioptSTRINGvar_i—
var_joptSTRINGvar_j—
var_koptSTRINGvar_k—
var_loptSTRINGvar_l—
var_moptSTRINGvar_m—
var_noptSTRINGvar_n—
var_ooptSTRINGvar_o—
var_poptSTRINGvar_p—
var_qoptSTRINGvar_q—
var_roptSTRINGvar_r—
var_soptSTRINGvar_s—
var_toptSTRINGvar_t—
var_uoptSTRINGvar_u—
var_voptSTRINGvar_v—
var_woptSTRINGvar_w—
var_xoptSTRINGvar_x—
var_yoptSTRINGvar_y—
var_zoptSTRINGvar_z—

Outputs (1)

NameTypeDescription
STRINGSTRING—