Nodes/VRGameDevGirl Video Enhancement Nodes/VRGDG_PromptSpitterWithIndex
ComfyUI Node

VRGDG_PromptSpitterWithIndex

Pick scene prompt N from a JSON list, without touching the graph

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG_PromptSpitterWithIndex
    • text_output
    • image_index
    json_string[]
    index0

    VRGDG_PromptSpitterWithIndex takes a JSON array of prompts and a number, and returns the prompt at that position. Yes, "Spitter" - the typo is the author's, it's a splitter. Before you judge, it's one of the more genuinely useful nodes in the pack, because it's how the "unlimited length" music-video workflow walks through scene prompts one at a time.

    You feed it json_string (a JSON array like ["scene one prompt", "scene two prompt", ...]) and index (0 to 10000), and it hands you text_output (the prompt at that index) and image_index (the same position, as a string - handy for building output filenames so scene 7's image and video files line up). Nothing else. It's a lookup node wearing a fancy name.

    Why this pattern matters

    The music-video workflow isn't one generation - it's dozens: a reference image per scene, then an image-to-video pass per scene, all stacked into a final edit. The natural way to drive that is to give the graph a list of scene prompts and a counter that advances per run, and let each run pull the next prompt. That's exactly the loop here: VRGDG_TriggerCounter advances an index on every queue run, this node fetches the matching prompt from the JSON list, and the graph generates scene N without you editing a text box between runs. It's the "run 40 scenes by clicking queue forty times" pattern made painless.

    The one thing to keep straight: it indexes a JSON array, so the first scene is index 0, not 1. If your scenes come out shifted by one, that's the first thing to check - it's the most common mistake, and the fix is just bumping the counter's starting value.

    Setting it up

    Shared pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl
    

    or ComfyUI Manager → search "vrgamedev", then restart. No models, no special dependencies for this node beyond the pack's shared requirements.txt.

    Where it can bite: paste your JSON in with the wrong shape and you'll get empty output. The node expects an array of strings, not an object and not a single string. Validate with anything that parses JSON before you queue a long run - a missing bracket at the end of a 40-scene list is a classic way to waste an afternoon. Also, keep the index within range; indexing past the end of the list is the "asked for scene 41 of 40" failure, and it won't politely tell you. Wire the counter's range to match your prompt count and this node just quietly does its one job.

    CategoryVRGDG

    Inputs (2)

    NameTypeDefaultDescription
    json_stringSTRING[]
    indexINT00–10000

    Outputs (2)

    NameTypeDescription
    text_outputSTRING
    image_indexSTRING