(
    ----------------------------------------------------------------
    -- 1. シーン設定とヘルパー配置（A1からC5まで拡張）
    ----------------------------------------------------------------
    delete objects

    -- パラメータ（元の値を保持しつつ、拡張に対応）
    global g_spacing   = 20.0  -- ヘルパー間の間隔（同系列内）
    global g_zHeight   = 0.0
    global g_size      = 10.0
    global g_targetDist = 20.0  -- 系列間の固定距離

    -- ヘルパー生成（A1からC5まで15個）とグローバル変数への割り当て
    -- Helper_A系列 (Y=+g_spacing)
    global g_hpA1 = Point name:"Helper_A1" pos:[0,           g_spacing, g_zHeight] size:g_size wirecolor:red cross:true box:false
    global g_hpA2 = Point name:"Helper_A2" pos:[g_spacing,   g_spacing, g_zHeight] size:g_size wirecolor:green cross:true box:false
    global g_hpA3 = Point name:"Helper_A3" pos:[g_spacing*2, g_spacing, g_zHeight] size:g_size wirecolor:blue cross:true box:false
    global g_hpA4 = Point name:"Helper_A4" pos:[g_spacing*3, g_spacing, g_zHeight] size:g_size wirecolor:yellow cross:true box:false
    global g_hpA5 = Point name:"Helper_A5" pos:[g_spacing*4, g_spacing, g_zHeight] size:g_size wirecolor:orange cross:true box:false

    -- Helper_B系列 (Y=0)
    global g_hpB1 = Point name:"Helper_B1" pos:[0,           0, g_zHeight] size:g_size wirecolor:white cross:true box:false
    global g_hpB2 = Point name:"Helper_B2" pos:[g_spacing,   0, g_zHeight] size:g_size wirecolor:gray cross:true box:false
    global g_hpB3 = Point name:"Helper_B3" pos:[g_spacing*2, 0, g_zHeight] size:g_size wirecolor:(color 255 0 255) cross:true box:false
    global g_hpB4 = Point name:"Helper_B4" pos:[g_spacing*3, 0, g_zHeight] size:g_size wirecolor:(color 0 255 255) cross:true box:false
    global g_hpB5 = Point name:"Helper_B5" pos:[g_spacing*4, 0, g_zHeight] size:g_size wirecolor:(color 255 255 0) cross:true box:false

    -- Helper_C系列 (Y=-g_spacing)
    global g_hpC1 = Point name:"Helper_C1" pos:[0,           -g_spacing, g_zHeight] size:g_size wirecolor:(color 128 0 0) cross:true box:false
    global g_hpC2 = Point name:"Helper_C2" pos:[g_spacing,   -g_spacing, g_zHeight] size:g_size wirecolor:(color 0 128 0) cross:true box:false
    global g_hpC3 = Point name:"Helper_C3" pos:[g_spacing*2, -g_spacing, g_zHeight] size:g_size wirecolor:(color 0 0 128) cross:true box:false
    global g_hpC4 = Point name:"Helper_C4" pos:[g_spacing*3, -g_spacing, g_zHeight] size:g_size wirecolor:(color 128 128 0) cross:true box:false
    global g_hpC5 = Point name:"Helper_C5" pos:[g_spacing*4, -g_spacing, g_zHeight] size:g_size wirecolor:(color 128 0 128) cross:true box:false

    -- リンク設定（チェーン構造）
    g_hpA2.parent = g_hpA1; g_hpA3.parent = g_hpA2; g_hpA4.parent = g_hpA3; g_hpA5.parent = g_hpA4
    g_hpB2.parent = g_hpB1; g_hpB3.parent = g_hpB2; g_hpB4.parent = g_hpB3; g_hpB5.parent = g_hpB4
    g_hpC2.parent = g_hpC1; g_hpC3.parent = g_hpC2; g_hpC4.parent = g_hpC3; g_hpC5.parent = g_hpC4

    -- 親をフリーズ（各系列の1番目）
    g_hpA1.isFrozen = true
    g_hpB1.isFrozen = true
    g_hpC1.isFrozen = true

    format "Helpers created and linked (A1-C5).\n"

    ----------------------------------------------------------------
    -- 2. キー修復システム（ティーポット方式）
    ----------------------------------------------------------------
    global g_isAdjusting = false
    global g_expectedKeyValues = #() -- 構造: #( #(Helper, Time, LocalPos), ... )

    -- 期待値データベース初期化関数
    fn initExpectedValues helpersList = -- 引数名を予約語回避
    (
        g_expectedKeyValues = #()
        for h_obj in helpersList do -- 変数名を予約語回避
        (
            local currentCtrl = h_obj.pos.controller -- 変数名を予約語回避
            if classof currentCtrl == Position_XYZ then
            (
                local allTimes = #() -- 変数名を予約語回避
                join allTimes (for k_item in currentCtrl.X_Position.controller.keys collect k_item.time) -- 変数名を予約語回避
                join allTimes (for k_item in currentCtrl.Y_Position.controller.keys collect k_item.time)
                join allTimes (for k_item in currentCtrl.Z_Position.controller.keys collect k_item.time)
                makeUniqueArray allTimes
                for t_val in allTimes do -- 変数名を予約語回避
                (
                    local currentLocalPos = at time t_val (in coordsys parent h_obj.pos) -- 変数名を予約語回避
                    append g_expectedKeyValues #(h_obj, t_val, currentLocalPos)
                )
            )
        )
    )

    -- キー修復関数（期待値データベースに基づいて全キーを再設定）
    fn repairKeys =
    (
        suspendEditing()
        try
        (
            for data_entry in g_expectedKeyValues do -- 変数名を予約語回避
            (
                local h_obj = data_entry[1] -- 変数名を予約語回避
                local time_val = data_entry[2] -- 変数名を予約語回避
                local local_pos = data_entry[3] -- 変数名を予約語回避
                local currentCtrl = h_obj.pos.controller -- 変数名を予約語回避
                if classof currentCtrl == Position_XYZ then
                (
                    local axisControllers = #(currentCtrl.X_Position.controller, currentCtrl.Y_Position.controller, currentCtrl.Z_Position.controller) -- 変数名を予約語回避
                    local axisValues = #(local_pos.x, local_pos.y, local_pos.z) -- 変数名を予約語回避
                    
                    for i_idx = 1 to 3 do -- 変数名を予約語回避
                    (
                        local currentAxisCtrl = axisControllers[i_idx] -- 変数名を予約語回避
                        local currentVal = axisValues[i_idx] -- 変数名を予約語回避
                        local foundKeyIdx = getKeyIndex currentAxisCtrl time_val -- 変数名を予約語回避
                        if foundKeyIdx > 0 then
                            currentAxisCtrl.keys[foundKeyIdx].value = currentVal
                        else
                        (
                            addNewKey currentAxisCtrl time_val
                            currentAxisCtrl.keys[(getKeyIndex currentAxisCtrl time_val)].value = currentVal
                        )
                    )
                )
            )
            format "キー修復完了 (Frame %)\n" sliderTime
        )
        catch
        (
            format "修復エラー: %\n" (getCurrentException())
        )
        resumeEditing()
    )

    -- 期待値更新関数（現在のフレームの位置をデータベースに反映）
    fn updateExpectedValues helpersList currentFrame = -- 引数名を予約語回避
    (
        for h_obj in helpersList do -- 変数名を予約語回避
        (
            local currentLocalPos = in coordsys parent h_obj.pos -- 変数名を予約語回避
            local entryFound = false -- 変数名を予約語回避
            for i_idx = 1 to g_expectedKeyValues.count do -- 変数名を予約語回避
            (
                if g_expectedKeyValues[i_idx][1] == h_obj and g_expectedKeyValues[i_idx][2] == currentFrame then
                (
                    g_expectedKeyValues[i_idx][3] = currentLocalPos
                    entryFound = true
                    exit
                )
            )
            if not entryFound do
                append g_expectedKeyValues #(h_obj, currentFrame, currentLocalPos)
        )
    )

    ----------------------------------------------------------------
    -- 3. 移動イベントハンドラ（元のロジックを再現）
    ----------------------------------------------------------------
    
    -- 安全なnormalize関数
    fn safeNormalize inputVec =
    (
        local vecLength = length inputVec
        if vecLength < 0.001 then [1,0,0] else inputVec / vecLength
    )

    -- A系列のヘルパーが動いた時の処理
    fn onASeriesMoved movedHelper =
    (
        if not g_isAdjusting then
        (
            g_isAdjusting = true
            local currentFrame = sliderTime
            local affectedHelpers = #() -- このリストに追加されたヘルパーのキーが修復される
            
            -- hpA1からhpA5までの配列を定義 (内部処理用)
            local aHelpers = #(g_hpA1, g_hpA2, g_hpA3, g_hpA4, g_hpA5)
            local bHelpers = #(g_hpB1, g_hpB2, g_hpB3, g_hpB4, g_hpB5)
            local cHelpers = #(g_hpC1, g_hpC2, g_hpC3, g_hpC4, g_hpC5)
            
            -- 移動したヘルパーのインデックスを特定
            local movedIndex = findItem aHelpers movedHelper
            
            case movedIndex of
            (
                2: ( -- A2が動いた場合
                    -- A1は不動なので、A2の位置をA1から固定距離に制限
                    local offsetVec = g_hpA2.pos - g_hpA1.pos
                    local expectedOffsetVec = safeNormalize(offsetVec) * g_spacing
                    if length offsetVec != g_spacing then
                        g_hpA2.pos = g_hpA1.pos + expectedOffsetVec
                    
                    -- A3以降を調整
                    for i = 3 to 5 do
                    (
                        local parentHelper = aHelpers[i-1]
                        local childHelper = aHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                    
                    -- B系列を調整（B2の位置をA2に合わせる）
                    local dirB = safeNormalize(g_hpB2.pos - g_hpA2.pos)
                    g_hpB2.pos = g_hpA2.pos + dirB * g_targetDist
                    -- B系列のB3以降も調整
                    for i = 3 to 5 do
                    (
                        local parentHelper = bHelpers[i-1]
                        local childHelper = bHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )

                    -- C系列を調整（C2の位置をA2に合わせる）
                    local dirC = safeNormalize(g_hpC2.pos - g_hpA2.pos)
                    g_hpC2.pos = g_hpA2.pos + dirC * g_targetDist * 2  -- CはAから2倍の距離
                    -- C系列のC3以降も調整
                    for i = 3 to 5 do
                    (
                        local parentHelper = cHelpers[i-1]
                        local childHelper = cHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                )
                
                default: ( -- A3, A4, A5が動いた場合
                    -- 移動したヘルパーの親を調整（親を子の動きに合わせる、距離を固定）
                    -- ここからが特に複雑な連鎖ロジック
                    for i = movedIndex to 2 by -1 do
                    (
                        local childHelper = aHelpers[i]
                        local parentHelper = aHelpers[i-1]
                        local offsetVec = childHelper.pos - parentHelper.pos
                        local expectedOffsetVec = safeNormalize(offsetVec) * g_spacing
                        if length offsetVec != g_spacing then
                            parentHelper.pos = childHelper.pos - expectedOffsetVec
                        
                        -- 親が動いたので、その親（A1）からの距離を制限（A1は不動）
                        if i-1 == 1 and aHelpers[1].isFrozen then
                        (
                            local offsetFromFrozenParent = aHelpers[2].pos - aHelpers[1].pos
                            local expectedOffsetFromFrozenParent = safeNormalize(offsetFromFrozenParent) * g_spacing
                            if length offsetFromFrozenParent != g_spacing then
                            (
                                aHelpers[2].pos = aHelpers[1].pos + expectedOffsetFromFrozenParent
                                -- A2が調整されたら、A3以降も再調整
                                for j = 3 to 5 do
                                (
                                    local currentParent = aHelpers[j-1]
                                    local currentChild = aHelpers[j]
                                    local currentChainOffset = currentChild.pos - currentParent.pos
                                    local fixedChainOffset = safeNormalize(currentChainOffset) * g_spacing
                                    currentChild.pos = currentParent.pos + fixedChainOffset
                                )
                            )
                        )
                    )
                    
                    -- 移動したヘルパーより後の子を調整
                    for i = movedIndex+1 to 5 do
                    (
                        local childHelper = aHelpers[i]
                        local parentHelper = aHelpers[i-1]
                        local offsetVec = childHelper.pos - parentHelper.pos
                        if length offsetVec != g_spacing then
                            childHelper.pos = parentHelper.pos + safeNormalize(offsetVec) * g_spacing
                    )
                    
                    -- 他の系列を調整（各ヘルパーがA系列の対応するヘルパーに追従）
                    for i = 2 to 5 do -- A2からA5まで連動
                    (
                        -- B系列
                        local dirB = safeNormalize(bHelpers[i].pos - aHelpers[i].pos)
                        bHelpers[i].pos = aHelpers[i].pos + dirB * g_targetDist
                        -- C系列
                        local dirC = safeNormalize(cHelpers[i].pos - aHelpers[i].pos)
                        cHelpers[i].pos = aHelpers[i].pos + dirC * g_targetDist * 2 -- CはAから2倍の距離
                    )

                    -- B系列内の距離を再調整
                    for i = 3 to 5 do
                    (
                        local parentHelper = bHelpers[i-1]
                        local childHelper = bHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )

                    -- C系列内の距離を再調整
                    for i = 3 to 5 do
                    (
                        local parentHelper = cHelpers[i-1]
                        local childHelper = cHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                )
            )
            
            -- 影響を受けた全てのヘルパーをリストに追加
            join affectedHelpers aHelpers
            join affectedHelpers bHelpers
            join affectedHelpers cHelpers
            
            updateExpectedValues affectedHelpers currentFrame
            repairKeys()
            g_isAdjusting = false
        )
    )

    -- B系列のヘルパーが動いた時の処理
    fn onBSeriesMoved movedHelper =
    (
        if not g_isAdjusting then
        (
            g_isAdjusting = true
            local currentFrame = sliderTime
            local affectedHelpers = #()
            
            local aHelpers = #(g_hpA1, g_hpA2, g_hpA3, g_hpA4, g_hpA5)
            local bHelpers = #(g_hpB1, g_hpB2, g_hpB3, g_hpB4, g_hpB5)
            local cHelpers = #(g_hpC1, g_hpC2, g_hpC3, g_hpC4, g_hpC5)
            
            local movedIndex = findItem bHelpers movedHelper
            
            case movedIndex of
            (
                2: ( -- B2が動いた場合
                    local offsetVec = g_hpB2.pos - g_hpB1.pos
                    local expectedOffsetVec = safeNormalize(offsetVec) * g_spacing
                    if length offsetVec != g_spacing then
                        g_hpB2.pos = g_hpB1.pos + expectedOffsetVec
                    
                    for i = 3 to 5 do
                    (
                        local parentHelper = bHelpers[i-1]
                        local childHelper = bHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                    
                    -- A系列を調整（A2の位置をB2に合わせる）
                    local dirA = safeNormalize(g_hpA2.pos - g_hpB2.pos)
                    g_hpA2.pos = g_hpB2.pos + dirA * g_targetDist
                    for i = 3 to 5 do
                    (
                        local parentHelper = aHelpers[i-1]
                        local childHelper = aHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                    
                    -- C系列を調整
                    local dirC = safeNormalize(g_hpC2.pos - g_hpB2.pos)
                    g_hpC2.pos = g_hpB2.pos + dirC * g_targetDist
                    for i = 3 to 5 do
                    (
                        local parentHelper = cHelpers[i-1]
                        local childHelper = cHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                )
                
                default: ( -- B3, B4, B5が動いた場合
                    for i = movedIndex to 2 by -1 do
                    (
                        local childHelper = bHelpers[i]
                        local parentHelper = bHelpers[i-1]
                        local offsetVec = childHelper.pos - parentHelper.pos
                        local expectedOffsetVec = safeNormalize(offsetVec) * g_spacing
                        if length offsetVec != g_spacing then
                            parentHelper.pos = childHelper.pos - expectedOffsetVec
                        
                        if i-1 == 1 and bHelpers[1].isFrozen then
                        (
                            local offsetFromFrozenParent = bHelpers[2].pos - bHelpers[1].pos
                            local expectedOffsetFromFrozenParent = safeNormalize(offsetFromFrozenParent) * g_spacing
                            if length offsetFromFrozenParent != g_spacing then
                            (
                                bHelpers[2].pos = bHelpers[1].pos + expectedOffsetFromFrozenParent
                                for j = 3 to 5 do
                                (
                                    local currentParent = bHelpers[j-1]
                                    local currentChild = bHelpers[j]
                                    local currentChainOffset = currentChild.pos - currentParent.pos
                                    local fixedChainOffset = safeNormalize(currentChainOffset) * g_spacing
                                    currentChild.pos = currentParent.pos + fixedChainOffset
                                )
                            )
                        )
                    )
                    
                    for i = movedIndex+1 to 5 do
                    (
                        local childHelper = bHelpers[i]
                        local parentHelper = bHelpers[i-1]
                        local offsetVec = childHelper.pos - parentHelper.pos
                        if length offsetVec != g_spacing then
                            childHelper.pos = parentHelper.pos + safeNormalize(offsetVec) * g_spacing
                    )
                    
                    for i = 2 to 5 do
                    (
                        local dirA = safeNormalize(aHelpers[i].pos - bHelpers[i].pos)
                        aHelpers[i].pos = bHelpers[i].pos + dirA * g_targetDist
                        
                        local dirC = safeNormalize(cHelpers[i].pos - bHelpers[i].pos)
                        cHelpers[i].pos = bHelpers[i].pos + dirC * g_targetDist
                    )

                    for i = 3 to 5 do
                    (
                        local parentHelper = aHelpers[i-1]
                        local childHelper = aHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )

                    for i = 3 to 5 do
                    (
                        local parentHelper = cHelpers[i-1]
                        local childHelper = cHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                )
            )
            
            join affectedHelpers aHelpers
            join affectedHelpers bHelpers
            join affectedHelpers cHelpers
            
            updateExpectedValues affectedHelpers currentFrame
            repairKeys()
            g_isAdjusting = false
        )
    )

    -- C系列のヘルパーが動いた時の処理
    fn onCSeriesMoved movedHelper =
    (
        if not g_isAdjusting then
        (
            g_isAdjusting = true
            local currentFrame = sliderTime
            local affectedHelpers = #()
            
            local aHelpers = #(g_hpA1, g_hpA2, g_hpA3, g_hpA4, g_hpA5)
            local bHelpers = #(g_hpB1, g_hpB2, g_hpB3, g_hpB4, g_hpB5)
            local cHelpers = #(g_hpC1, g_hpC2, g_hpC3, g_hpC4, g_hpC5)
            
            local movedIndex = findItem cHelpers movedHelper
            
            case movedIndex of
            (
                2: ( -- C2が動いた場合
                    local offsetVec = g_hpC2.pos - g_hpC1.pos
                    local expectedOffsetVec = safeNormalize(offsetVec) * g_spacing
                    if length offsetVec != g_spacing then
                        g_hpC2.pos = g_hpC1.pos + expectedOffsetVec
                    
                    for i = 3 to 5 do
                    (
                        local parentHelper = cHelpers[i-1]
                        local childHelper = cHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                    
                    -- B系列を調整（B2の位置をC2に合わせる）
                    local dirB = safeNormalize(g_hpB2.pos - g_hpC2.pos)
                    g_hpB2.pos = g_hpC2.pos + dirB * g_targetDist
                    for i = 3 to 5 do
                    (
                        local parentHelper = bHelpers[i-1]
                        local childHelper = bHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                    
                    -- A系列を調整（A2の位置をC2に合わせる）
                    local dirA = safeNormalize(g_hpA2.pos - g_hpC2.pos)
                    g_hpA2.pos = g_hpC2.pos + dirA * g_targetDist * 2 -- AはCから2倍の距離
                    for i = 3 to 5 do
                    (
                        local parentHelper = aHelpers[i-1]
                        local childHelper = aHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                )
                
                default: ( -- C3, C4, C5が動いた場合
                    for i = movedIndex to 2 by -1 do
                    (
                        local childHelper = cHelpers[i]
                        local parentHelper = cHelpers[i-1]
                        local offsetVec = childHelper.pos - parentHelper.pos
                        local expectedOffsetVec = safeNormalize(offsetVec) * g_spacing
                        if length offsetVec != g_spacing then
                            parentHelper.pos = childHelper.pos - expectedOffsetVec
                        
                        if i-1 == 1 and cHelpers[1].isFrozen then
                        (
                            local offsetFromFrozenParent = cHelpers[2].pos - cHelpers[1].pos
                            local expectedOffsetFromFrozenParent = safeNormalize(offsetFromFrozenParent) * g_spacing
                            if length offsetFromFrozenParent != g_spacing then
                            (
                                cHelpers[2].pos = cHelpers[1].pos + expectedOffsetFromFrozenParent
                                for j = 3 to 5 do
                                (
                                    local currentParent = cHelpers[j-1]
                                    local currentChild = cHelpers[j]
                                    local currentChainOffset = currentChild.pos - currentParent.pos
                                    local fixedChainOffset = safeNormalize(currentChainOffset) * g_spacing
                                    currentChild.pos = currentParent.pos + fixedChainOffset
                                )
                            )
                        )
                    )
                    
                    for i = movedIndex+1 to 5 do
                    (
                        local childHelper = cHelpers[i]
                        local parentHelper = cHelpers[i-1]
                        local offsetVec = childHelper.pos - parentHelper.pos
                        if length offsetVec != g_spacing then
                            childHelper.pos = parentHelper.pos + safeNormalize(offsetVec) * g_spacing
                    )
                    
                    for i = 2 to 5 do
                    (
                        local dirB = safeNormalize(bHelpers[i].pos - cHelpers[i].pos)
                        bHelpers[i].pos = cHelpers[i].pos + dirB * g_targetDist
                        
                        local dirA = safeNormalize(aHelpers[i].pos - cHelpers[i].pos)
                        aHelpers[i].pos = cHelpers[i].pos + dirA * g_targetDist * 2 -- AはCから2倍の距離
                    )

                    for i = 3 to 5 do
                    (
                        local parentHelper = bHelpers[i-1]
                        local childHelper = bHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )

                    for i = 3 to 5 do
                    (
                        local parentHelper = aHelpers[i-1]
                        local childHelper = aHelpers[i]
                        local currentOffset = childHelper.pos - parentHelper.pos
                        local fixedOffset = safeNormalize(currentOffset) * g_spacing
                        childHelper.pos = parentHelper.pos + fixedOffset
                    )
                )
            )
            
            join affectedHelpers aHelpers
            join affectedHelpers bHelpers
            join affectedHelpers cHelpers
            
            updateExpectedValues affectedHelpers currentFrame
            repairKeys()
            g_isAdjusting = false
        )
    )

    ----------------------------------------------------------------
    -- 4. 初期化とハンドラ登録
    ----------------------------------------------------------------
    
    -- 全てのヘルパーをリスト化
    local allManagedHelpers = #(
        g_hpA1, g_hpA2, g_hpA3, g_hpA4, g_hpA5,
        g_hpB1, g_hpB2, g_hpB3, g_hpB4, g_hpB5,
        g_hpC1, g_hpC2, g_hpC3, g_hpC4, g_hpC5
    )

    -- initExpectedValues の呼び出しをヘルパー作成後、ハンドラ登録前に移動
    initExpectedValues allManagedHelpers
    deleteAllChangeHandlers id:#HelperMoveMonitor
    
    -- ハンドラ登録（子ヘルパーのみ）
    -- A系列
    when transform g_hpA2 changes id:#HelperMoveMonitor do onASeriesMoved g_hpA2
    when transform g_hpA3 changes id:#HelperMoveMonitor do onASeriesMoved g_hpA3
    when transform g_hpA4 changes id:#HelperMoveMonitor do onASeriesMoved g_hpA4
    when transform g_hpA5 changes id:#HelperMoveMonitor do onASeriesMoved g_hpA5
    
    -- B系列
    when transform g_hpB2 changes id:#HelperMoveMonitor do onBSeriesMoved g_hpB2
    when transform g_hpB3 changes id:#HelperMoveMonitor do onBSeriesMoved g_hpB3
    when transform g_hpB4 changes id:#HelperMoveMonitor do onBSeriesMoved g_hpB4
    when transform g_hpB5 changes id:#HelperMoveMonitor do onBSeriesMoved g_hpB5
    
    -- C系列
    when transform g_hpC2 changes id:#HelperMoveMonitor do onCSeriesMoved g_hpC2
    when transform g_hpC3 changes id:#HelperMoveMonitor do onCSeriesMoved g_hpC3
    when transform g_hpC4 changes id:#HelperMoveMonitor do onCSeriesMoved g_hpC4
    when transform g_hpC5 changes id:#HelperMoveMonitor do onCSeriesMoved g_hpC5

    format "\nSetup complete. Auto-keying and key repair active.\n"
    format "Extended to 3 series x 5 helpers (A1-C5).\n"
)
このMAXSCRIPTでA2を動かしてもA1は動かないのに、A3を動かすとA1が動くのはなぜ