Mie Loop State Set Int ๐
Writing a counter into a ComfyUI loop's memory
- loop_ctx
- loop_ctx
Set Int is the write side of the integer pair in MieNodes' Loop State family, paired with Get Int. Anywhere a for-loop needs to track a whole number across iterations - a lap counter, a retry count, a frame index, a seed offset that should increment - this is the node that actually commits the value somewhere it'll still exist next time the loop runs, since a plain variable inside the loop's subgraph gets wiped every pass.
Mechanism. Loop state moves through the graph as a custom object, MIE_LOOP_CTX. Set Int takes the current context, a key, and a value, stores the integer under that key, and hands back the updated context to keep flowing - into the rest of this pass, and out into whatever advances the loop.
Default key feedback_int follows the family pattern, and the whole family's naming (feedback_bool, feedback_float, feedback_image, feedback_int, feedback_string) points at a shared design intent: a feedback-driven loop where each pass produces some kind of signal - a count, a score, a verdict - that shapes what the next pass does.
What's on the node.
loop_ctx(required) - from this pack's own Loop nodes; the typed socket enforces it.key(defaultfeedback_int) - has to match the corresponding Get Int node's key exactly.value(default0) - the integer you're writing. Usually the output of an increment step, a count, or an index computed elsewhere this pass.
Output: the updated loop_ctx.
Installing. ComfyUI Manager: search ComfyUI_MieNodes. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-MieNodes, restart. No models or extra dependencies.
Applies here too: the Loop category has no documentation in the pack's README - no node table, no example workflow. What's written above is read off the schema and from how a loop counter has to be wired mechanically to actually persist, not from confirmed author docs.
Troubleshooting.
- Counter doesn't increment - every pass reports the same number. This node overwrites, it doesn't add. If you want an incrementing counter, read the old value with Get Int, add 1 (or whatever step) yourself with a math node, and feed that result into
valuehere - Set Int just stores whatever number you hand it. - Downstream Get Int keeps returning
default_value. Comparekeystrings between the Set and Get nodes character for character; a mismatch fails silently rather than erroring. - Loop runs one extra or one fewer time than expected. Classic off-by-one - depends on whether you increment before or after reading the counter within the same pass, and whether your exit condition checks
>=versus>against your target count. Trace exactly where in the pass the read and write happen. loop_ctxtype error. Something other than another Loop-category node's context object from this pack is wired into that socket.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ | |
| key | STRING | feedback_int | โ |
| value | INT | 0 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ |