ComfyUI Node

Integer

An integer that increments, decrements, or randomizes itself between runs

By rookiepsi·Created about a year ago·Updated 11 months ago· 9
Integer
    • INT
    value0
    step1
    min0
    max1000000000000000
    methodfixed

    The classic ComfyUI pain: you want to try steps 20, 30, 40... and you sit there editing a widget by hand between every run. Primitive Integer from ComfyUI Extended automates the boring part. Set a value, a step, and a method - increment, decrement, randomize, even previous - and the node changes its own value between queue runs. It's a seed-cycler for any integer, not just seeds.

    This is the pack's most genuinely clever node, because it works in two places: the Python side picks the value and decides when to force a re-run, and the frontend (web/primitive.js) actually updates the widget you're looking at. The result feels like magic - the number visibly changes on the node between runs.

    Inputs that matter

    • value (INT) - the starting number.
    • step (INT) - how much increment/decrement moves each run.
    • min / max (INT) - the clamp range. Increment stops at max, decrement at min.
    • method - fixed (output value as-is), increment, decrement, randomize (picks a random value on the step grid inside the range), or previous (hand back the last value used).

    Output is a single INT.

    How it works

    The Python side sends state over a websocket (comfyui-extended_primitive), the frontend clamps and steps the widget. randomize also returns NaN from IS_CHANGED, which forces ComfyUI to consider the node changed on every queue run - so a randomized value genuinely re-rolls each time rather than being cached. That's the same trick the pack's Expression and Dimensions nodes use for randomness, and it's the detail that makes this node actually work instead of just looking like it should.

    Install

    cd /path/to/your/ComfyUI/custom_nodes
    git clone https://github.com/rookiepsi/comfyui-extended.git
    

    Restart, and it's under comfyui-extended/primitive. Or ComfyUI Manager → search "ComfyUI Extended" → install → restart. The pack has no dependencies and downloads nothing.

    Common issues

    • randomize forces a re-run every time. That's by design - it can't roll a new value if ComfyUI caches the old result. Don't put this node in a spot where you need a stable value between runs.
    • Value won't go past the clamp. Increment/decrement respect min/max hard. If your number seems stuck, your range is the culprit.
    • previous with a cold start. The first run has no prior value cached, so it falls back to value; subsequent runs hand back whatever was used last.

    Where it shines: step-count sweeps, seed exploration, batch counts. Where it's a trap: anywhere you need determinism. Know which side you're on and this node is a small superpower.

    Categorycomfyui-extended/primitive

    Inputs (5)

    NameTypeDefaultDescription
    valueINT0-1000000000000000–1000000000000000
    stepINT1-1000000000000000–1000000000000000
    minINT0-1000000000000000–1000000000000000
    maxINT1000000000000000-1000000000000000–1000000000000000
    methodCOMBOfixed5 options: fixed, increment, decrement, randomize, previous

    Outputs (1)

    NameTypeDescription
    INTINT