WP Var → Int
When Your Wildcard Picks the Resolution, Not Just the Words
- context
- wp_var_name
- value
Here's the thing nobody tells you about wildcard pipelines: a $variable is a string, and ComfyUI is full of inputs that want numbers. WP Var → Int is the node that turns a picked value like 512 or 768 1024 into an actual INT socket you can drive an Empty Latent Image's width or a KSampler's steps with. It reads a named variable from your context, pulls a number out of its text, and hands it to any INT input on the canvas. Wildcards stop being prompt-only and start driving the whole graph.
How it works
Four required inputs, and only one of them is a mystery:
- context - the PIPELINE_CONTEXT from your chain. No context, no variables to read.
- wp_var_name - a picker that lists the variables your context defines, so you choose
$widthfrom a menu instead of typing a name and hoping. - index - which number to extract when the value has several (0 = first). If your variable's value is
768 1024, index 0 gives 768, index 1 gives 1024. - default - what to return when the variable is missing, unparseable, or the index is out of range.
The parsing rule is honest and simple: it scans the variable's text for the Nth signed integer (-?\d+ regex), so 1920 yields 1920 and a 6, 8 grid yields 6 then 8. Note it grabs the integer part of a float too - a variable holding 2.5 gives you 2 - so if you need decimals, that's the float node's job. The important design decision is the default: the node never errors. Missing var, empty text, out-of-range index - you get the default, silently, and the run continues. That's a feature for batch robustness and a trap for debugging (see below).
The output is value of type INT. Right-click any INT input - width, height, steps, batch size - and convert it to accept a wired value, then connect this node. That's the whole trick of making a wildcard control your render parameters.
Why it's the one you'll use
Of the three conversion nodes, WP Var → Int is the workhorse, because so many things you'd want a wildcard to pick are integers: resolution, step count, batch size, an index into something. A classic setup: a wildcard module $res with options 768, 1024, 1152; a WP Var → Int wired to the latent's width; and suddenly a single roll picks both the subject and the canvas it renders on. Paired with WP Context Loop, every iteration can vary resolution too, which is a great way to explore a prompt space.
Install and gotchas
Install the pack once - Manager → Wildcard Pipeline, or the git clone + pip install -e . + pnpm build route in the README. Needs ComfyUI ≥ 0.3.36, no models.
The gotcha: because default swallows every failure mode, a missing variable looks identical to a legitimately parsed zero - you'll get a render at the default width and not know why. If a converted value is suspiciously always the default, check WP Debug's warnings tab for "missing variable" before you trust it. Also, be careful what a variable holds: if the value is 4K there's no digit to find and you'll get the default, so make your wildcard options actual numbers when they're destined for a numeric socket.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| context | PIPELINE_CONTEXT | The resolved $variable context from any upstream WP Context / Loop / Injector chain. Required — without it the node has no variables to read. | |
| wp_var_name | WP_VAR_PICKER | — | |
| index | INT | 00–999 | Which number in the value to extract when multiple are present (0 = first). |
| default | INT | 0-9223372036854776000–9223372036854776000 | Value to use when the variable is missing or the index is out of range. The node never errors — it falls back to this. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | INT | — |