Prompt Scheduler (NH)
Rotate prompts per step for animation and mid-run swaps
- current_prompt
- progress
- step_index
Most of the time you want one prompt for the whole run. But animation, batch variation, and "start generic, end specific" workflows want the prompt to change as generation progresses. That's what Prompt Scheduler (NH) is for: you give it a stack of prompts and a current step, and it hands back the one that should be active at that step, plus a progress figure and the step index for your own math.
You type your prompts into the prompts box, one per line. Then you tell it where you are in the run with current_step and total_steps, pick a mode, and read current_prompt out the other side. The three modes cover the practical shapes:
- sequential - total_steps is divided evenly across your prompts, so each prompt gets a roughly equal slice of the run and you move forward through them once.
- pingpong - walks up the list then back down (0, 1, 2, ..., n-1, n-2, ...) and keeps cycling. Great for looping animations where you want a smooth there-and-back.
- random - picks a fresh random prompt each step, seeded by the optional
seedinput so it's reproducible.
Under the hood it's plain arithmetic: progress is current_step / total_steps clamped to 1.0, and the sequential mode's slice size is total_steps // len(prompts) - so if your step count doesn't divide evenly, some prompts get slightly more time than others and the last one can run long. Not a bug, just integer math. In random mode the RNG is derived from seed + current_step, which means you get a different random prompt every step, not one random prompt for the whole run.
Where to wire it
The obvious consumer is a KSampler whose positive-prompt widget you've converted to an input - feed current_prompt in and the sampler re-reads the prompt each step. In practice that means wiring current_step from a progress source. A neat trick for animation: drive it from a frame counter so frame N uses the Nth prompt in the stack, giving you a prompt-timed video instead of a static one. That's the use case that makes the progress output useful too - feed it to a math node if you want prompt swaps to align with a CFG or strength ramp.
Install
It's part of NH-Nodes:
- ComfyUI Manager → search NH-Nodes → install → restart ComfyUI. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
pip install -r requirements.txt
Then restart ComfyUI.
Pure text node, no models, no dependencies to speak of.
Common issues
The big one is confusing random-with-seed with random-per-run. seed makes the sequence reproducible; set it to 0 and the node falls back to unseeded randomness, so you get a different prompt every run. If your sequential schedule "ends early" or skips a prompt, it's the total_steps // n floor - give total_steps a clean multiple of your prompt count. And if you're feeding a raw prompt into a node that isn't a sampler input, remember this node outputs a plain STRING; anything that takes text will take it. Blank lines in the prompts box are ignored, so don't worry about trailing newlines.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prompts | STRING | prompt 1 prompt 2 prompt 3 | — |
| current_step | INT | 0 | — |
| total_steps | INT | 10 | — |
| mode | COMBO | 3 options: sequential, pingpong, random | |
| seedopt | INT | 0 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| current_prompt | STRING | — |
| progress | FLOAT | — |
| step_index | INT | — |