Nodes/comfyui_bmad_nodes/FromListGet1Int
ComfyUI Node Runs on cloud

FromListGet1Int

Grab One Integer From a List, Negative Indexes Welcome

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
FromListGet1Int
    • INT
    list
    index0

    FromListGet1Int pulls a single integer out of an INT list by index. It's the integer sibling of the pack's FromListGet1* family, and it exists for one reason: somewhere in your workflow a node produces a list of whole numbers and the next node wants just one.

    Why you'd reach for it

    Seeds are the canonical use. You've built an INT list of seed candidates (via ExtendIntList or a loop), and you want to pick one to feed a KSampler. FromListGet1Int does the picking. Wire the index input to a counter or a random INT node and you've got a poor man's seed picker - different index, different run, no list surgery.

    It also shows up in batch bookkeeping: steps-per-checkpoint lists, batch-size candidates, frame indexes. Anywhere a list of ints exists and one is needed downstream, this is the adapter.

    How it works

    Same lookup logic as every FromListGet1 node: index % len(list), so it never throws an out-of-range error, and negative indexes count from the end (-1 = last item). The index is zero-based.

    The list input is forced - it must be connected to a node emitting an INT list; you can't type a list into the widget. index is an INT widget by default but can be driven by a connection. Output is a single INT.

    Install

    It ships with bmad4ever's pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_bmad_nodes
    

    then restart ComfyUI. Manager users search "comfyui_bmad_nodes"; requirements install automatically and don't affect this node.

    Common issues

    • Single int into list. Won't connect - wrap with ToIntList.
    • Zero-based indexing. Index 0 is the first item. The "-1 gets the last item" trick is handy for seeds if you're building a fallback.
    • Wrapping surprises. An out-of-range index wraps around to index % len, so len on a 4-item list returns item 0. Deliberate, but easy to misread when debugging.

    A tiny, predictable node for a tiny job - set the index, get the int, keep moving.

    CategoryBmad/Lists/Get1

    Inputs (2)

    NameTypeDefaultDescription
    listINT
    indexINT0

    Outputs (1)

    NameTypeDescription
    INTINT