Advanced variable builder [darkilNodes]
Multiline templates with real logic
- INPUT_VAR
- VAR
- ❓help
The plain Variable builder in this pack is a tidy single-line text helper. This is the version you reach for when the template stops fitting on one line: var_text is a full multiline editor, the placeholder language gains boolean expressions (&&, ||), quoted literals, and random variants, and dynamic input slots can feed in extra variables from elsewhere in the graph. Same family, properly grown up.
The inputs
switch(BOOLEAN, default true) - master enable.out_val_by_switch(BOOLEAN, default true) - when on andswitchis off, the value output goes empty (only help text remains). Note the default here is the opposite of the plain builder's - check it before wiring.var_name(STRING) - prependsname =to the result; leave blank for the raw value.var_text(STRING, multiline) - the template.INPUT_VAR(optional) -name=valuelines that define variables; the last line without an=is treated as the "default" value.
The node also grows dynamic input slots at runtime (DYNAMIC_1, DYNAMIC_2, …) so other nodes can inject variables on the fly - that's how you build a prompt fragment in one place and reference it here.
The placeholder language
Everything the plain builder does, plus:
{{"literal"}}- insert a literal string; quotes optional.{{var}}/{{DATE}}/{{TIME}}- variable references and the date/time shortcuts, same as the small one.{{IF:cond:true:false}}and{{IFNOT:cond:true:false}}- conditionals whosecondsupports&&and||over booleans or other variables.{{var??default}}- fallback whenvaris empty.- Special names
default,def,_resolve to the default single-line value. |-separated variable values pick a random variant each run.- Comments (
# …) are stripped; cyclic references resolve to empty with a warning.
So var_text of Hello {{user}}! Today is {{DATE}}. with INPUT_VAR = user = Alice produces variable_name = Hello Alice! Today is 20260816 - that's the author's own worked example, and it's a fair sense of the power level.
The outputs
VAR(STRING) - the assembledname = valueor raw value.❓help(STRING) - the node's documentation on a socket, like every node in this pack.
Where people get burned
The out_val_by_switch default flip catches people migrating from the plain builder. And the expression parser is deliberately compact - complex nested logic is better handled by composing a few of these nodes than by one monster template, because the failure mode (a placeholder that resolves to empty) is quiet and can be hard to trace. Build up, test small.
Installing
Ships in 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. No Python deps or models.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| switch | BOOLEAN | true | — |
| out_val_by_switch | BOOLEAN | true | — |
| var_name | STRING | variable_name | — |
| var_text | STRING | — | |
| INPUT_VARopt | BOOLEAN,INT,FLOAT,STRING,COMBO | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| VAR | STRING | — |
| ❓help | STRING | — |