Nodes/comfyui-darkil-nodes/Variable builder [darkilNodes]
ComfyUI Node

Variable builder [darkilNodes]

A text variable with a switch, a name, and real placeholder logic

By pytraveler·Created 7 months ago·Updated 16 days ago· 9
Variable builder [darkilNodes]
  • INPUT_VAR
  • VAR
  • ❓help
switchtrue
out_val_by_switchfalse
var_namevariable_name
var_value

ComfyUI's stock text node is a box you type in. This one is a box you type in and then control: a Variable builder that lets you name the value, feed in other variables, and fill the text with {{placeholders}} that resolve at run time - including random variants and date/time stamps. If you've ever wanted one text node that produces "the same prompt with the day's date and one randomly chosen style", this is it.

What you feed it

  • switch (BOOLEAN, default true) - master enable. When off, the node produces nothing (or just help text, depending on out_val_by_switch).
  • out_val_by_switch (BOOLEAN, default false) - when true and switch is off, the value output empties out.
  • var_name (STRING) - the variable's name. If you set one, the output becomes name = value; leave it blank and you get the raw value.
  • var_value (STRING) - the template text.
  • INPUT_VAR (optional, BOOLEAN/INT/FLOAT/STRING/COMBO) - extra variables defined as name=value lines. A line without = becomes the "default" value.

The placeholder language

Inside var_value you get a compact but real template syntax:

  • {{variable}} - inserts the resolved value of a variable defined in INPUT_VAR.
  • {{DATE}} / {{TIME}} - current date (YYYYMMDD) and time (HHMMSS), e.g. 20260816.
  • {{IF:cond:true:false}} and {{IFNOT:cond:true:false}} - conditional text where cond is a boolean literal, a variable name, or an expression.
  • {{var??"fallback"}} - use var if it resolves to something non-empty, otherwise the fallback.
  • Random variants: put Hello|Hi|Hey as a variable's value and one is chosen at random each run.

Comments (#) get stripped from the template before processing, and cyclic references are detected and resolved to empty rather than hanging your graph.

The outputs

  • VAR (STRING) - the assembled value (name = value or raw).
  • ❓help (STRING) - the node's own usage doc, live on a socket, which is the signature touch of this whole pack.

Where people get burned

The switch/out_val_by_switch pair confuses everyone once. switch on/off is the enable; out_val_by_switch only decides whether an off switch produces an empty string or keeps emitting help text - it's not a second enable. Also remember INPUT_VAR values are re-evaluated each run, so the random variant means every queue run may differ; if you need reproducibility, don't rely on | variants in a seed-sensitive workflow.

Installing

Part of pytraveler/comfyui-darkil-nodes. ComfyUI Manager search ComfyUI-darkil-nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/pytraveler/comfyui-darkil-nodes

Restart ComfyUI. No Python deps, no models - pure text logic.

CategorydarkilNodes/text

Inputs (5)

NameTypeDefaultDescription
switchBOOLEANtrue
out_val_by_switchBOOLEANfalse
var_nameSTRINGvariable_name
var_valueSTRING
INPUT_VARoptBOOLEAN,INT,FLOAT,STRING,COMBO

Outputs (2)

NameTypeDescription
VARSTRING
❓helpSTRING