Nodes/ComfyUI-0246/Script Pile
ComfyUI Node

Script Pile

Stack a whole batch into a scripted node

By Trung0246·Created 3 years ago·Updated about a year ago· 137
Script Pile
  • pipe_in
  • pipe_out
  • script_rule_data
script_rule_loop_mode
script_rule_regex(?P<m>^(@model|%MODEL)$)|(?P<c>^(@clip|%CLIP)$)|(?P<_>^$)
script_rule_pin_mode
count0

Script Pile is the batch-feeding cousin of ScriptNode in the 0246 pack. ScriptNode wraps one node and runs it once; Script Pile wraps the routing so a scripted node can chew through a stack of inputs - a pile of pins, run over a pile of data. The pack's own one-liner calls it the "generic stacker execution mechanism for Script node."

The idea: you've got a Highway or Junction pipe full of several inputs, and one target node (say, a sampler) that should run over them. Script Pile maps the target's output names onto the input pins using a regex, then drives the Script node to execute the target once per stack item - zipping or cycling the inputs as you choose. Where ScriptRule controls iteration shape, Script Pile controls where the inputs come from and how they get fed.

The inputs that matter

  • pipe_in - the Highway or Junction pipe carrying your data.
  • script_rule_pin_mode - how the pipe unpacks into pins. The four choices are the honest names: pin_highway_batch (named Highway lanes, batch-style), pin_highway_junction, pin_junction_highway, and pin_junction (sequential). In the source, each maps to a different unpacking strategy, with the comments showing exactly what data shape you get per choice.
  • script_rule_loop_mode - _ (single pass), slice (zip), or cycle (cartesian product) - same semantics as ScriptRule.
  • script_rule_regex - the mapping regex, default (?P<m>^(@model|%MODEL)$)|(?P<c>^(@clip|%CLIP)$)|(?P<_>^$). It matches input pins (@name) to target outputs (%NAME): @model pairs with %MODEL, @clip with %CLIP. If your target's pins don't match the defaults, rewrite this regex.
  • count - cap on iterations (default 0 = no cap).

The outputs

  • pipe_out - passes the pipe through untouched.
  • script_rule_data - the SCRIPT_DATA packet that drives the Script node.

How to install it

The usual:

cd ComfyUI/custom_nodes
git clone https://github.com/Trung0246/ComfyUI-0246

restart, or ComfyUI Manager → search "ComfyUI-0246". No models.

Common issues & troubleshooting

"Missing corresponding output for input ..." - your regex matched an input pin but found no matching target output. Check that @name / %NAME pairs line up; this is the #1 Script Pile failure, and it's a regex problem, not a ComfyUI one.

Nothing runs / runs once. script_rule_loop_mode is _ or count is set to 1. Set the loop mode to slice or cycle for iteration.

Unexpected combinations. cycle produces the cartesian product - with three pins of three values each, that's 27 runs. If that's not what you wanted, slice (zip) is the tamer option. And the standing pack caveat: this whole scripting system is single-author, dormient since early 2025, and depends on internals - validate against your ComfyUI version before leaning on it.

Category0246

Inputs (5)

NameTypeDefaultDescription
pipe_in*
script_rule_loop_modeCOMBO3 options: _, slice, cycle
script_rule_regexSTRING(?P<m>^(@model|%MODEL)$)|(?P<c>^(@clip|%CLIP)$)|(?P<_>^$)
script_rule_pin_modeCOMBO4 options: pin_highway_batch, pin_highway_junction, pin_junction_highway, pin_junction
countINT00–9223372036854776000

Outputs (2)

NameTypeDescription
pipe_out*
script_rule_dataSCRIPT_DATA