#(HELP) Using create_option_cycle to cycle between custom music

1 messages · Page 1 of 1 (latest)

north socket
#

Currently, I'm using create_toggle to switch between custom music and default music.
Now I wanna have different varieties of custom music you can choose from with the cycle option.

I've setup the create_toggle like this

    local custom_nodes = {}
    custom_nodes[#custom_nodes + 1] = 
    create_toggle({
        label = "Enable Custom Music",
        ref_table = OpandorasBox_config,
        ref_value = "custom_music"
    })
    
    return {
        n = G.UIT.ROOT,
        config = {
            emboss = 0.05,
            minh = 6,
            r = 0.1,
            minw = 10,
            align = "cm",
            padding = 0.2,
            colour = HEX("1D6A50"),
        },
        nodes = custom_nodes,
    }
end

SMODS.current_mod.config_tab = customMusicConfigTab

SMODS.Sound({
    key = "opandorasbox_music1",
    path = "opandorasbox_music1.ogg",
    pitch = 1,
    select_music_track = function()
        return OpandorasBox_config.custom_music
            and not (G.booster_pack_sparkles 
            or G.booster_pack_meteors 
            or G.booster_pack 
            or G.shop 
            or (G.GAME.blind and G.GAME.blind.boss))
    end,
})

SMODS.Sound({
    key = "opandorasbox_music2",
    path = "opandorasbox_music2.ogg",
    pitch = 1,
    select_music_track = function()
        return OpandorasBox_config.custom_music
            and (G.booster_pack_sparkles 
            and not G.booster_pack_sparkles.REMOVED)
    end,
})

SMODS.Sound({
    key = "opandorasbox_music3",
    path = "opandorasbox_music3.ogg",
    pitch = 1,
    select_music_track = function()
        return OpandorasBox_config.custom_music
            and (G.booster_pack_meteors 
            and not G.booster_pack_meteors.REMOVED)
    end,
})

SMODS.Sound({
    key = "opandorasbox_music4",
    path = "opandorasbox_music4.ogg",
    pitch = 1,
    select_music_track = function()
        return OpandorasBox_config.custom_music
            and (G.shop 
            and not G.shop.REMOVED)
    end,
})

SMODS.Sound({
    key = "opandorasbox_music5",
    path = "opandorasbox_music5.ogg",
    pitch = 1,
    select_music_track = function()
        return OpandorasBox_config.custom_music
            and (G.GAME.blind 
            and G.GAME.blind.boss)
    end,
})```
I've now changed the name `opandorasbox_musicX` to `opandorasbox_music_trippyX`
and added another music category(?) named `opandorasbox_music_bossanovaX`

I'm just at a dead end in terms of how to use create_option_cycle in this context