[Solved] How do I change the sound of a dropdown menu?

Place to get help with not working mods / modding interface.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 155
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

[Solved] How do I change the sound of a dropdown menu?

Post by yaim904 »

Hello, I am creating an interface and would like to customize the selection sound.
(10).png
(10).png (1.36 MiB) Viewed 1220 times


I created the custom dropdown style.

Code: Select all

    Styles["zzzYAIM0425_0900_drop_down_channels"] = {
        type = "dropdown_style",
        width = 282 + 32
    }
(11).png
(11).png (1.23 MiB) Viewed 1220 times


When the options are displayed, each option has a sound when selected, and I would like to change it.
(12).png
(12).png (1.19 MiB) Viewed 1220 times

I have a “sound” to replace the default sound, and I will take care of the sound effect from the code.

Code: Select all

left_click_sound = "__zzzYAIM0425-0900__/sound/empty_audio.ogg",
Could you provide me with the code to do so?
Last edited by yaim904 on Mon Jul 28, 2025 10:35 pm, edited 1 time in total.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 155
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: How do I change the sound of a dropdown menu?

Post by yaim904 »

Osmo wrote: Sat Jul 26, 2025 11:43 am
Seeing your response, it's possible that I didn't explain myself correctly.

I want to change the sound when selecting one of the options displayed.
Image

I am already changing the style of the dropdown.
Image

But, I still appreciate your response.

The following is the last code I tried, but it doesn't work.

Code: Select all

    Styles[Prefix .. "drop_down_channels"] = {
        type = "dropdown_style",
        width = 296 + 64,
        button_style =
        {
            type = "button_style",
            left_click_sound = This_MOD.sound .. "empty_audio.ogg",
            parent = "dropdown_button"
        },
        list_box_style = {
            type = "list_box_style",
            left_click_sound = This_MOD.sound .. "empty_audio.ogg",
        }
    }
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 329
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: How do I change the sound of a dropdown menu?

Post by Osmo »

yaim904 wrote: Sat Jul 26, 2025 8:32 pm
I am already changing the style of the dropdown.
Image
But you are not changing the opened_sound on the style. If you did, it would display in the Ctrl+F6 menu
User avatar
EvilPLa
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Sat Nov 14, 2020 7:26 am
Contact:

Re: How do I change the sound of a dropdown menu?

Post by EvilPLa »

Hmm, I think, because the buttons aren't built in the code, the dropdown items are no LuaGuiElements, you aren't able to change the sound.

But wait, the "left_click_sound" IS actually in the style definition...
I haven't lost my mind, it's backed up on tape somewhere.
User avatar
EvilPLa
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Sat Nov 14, 2020 7:26 am
Contact:

Re: How do I change the sound of a dropdown menu?

Post by EvilPLa »

The button you are changing is the closed Dropdown, you need to change this one https://lua-api.factorio.com/latest/typ ... item_style
Just confirmed it with "my" dropdown
07-27-2025, 16-21-51.png
07-27-2025, 16-21-51.png (29.75 KiB) Viewed 1048 times
I haven't lost my mind, it's backed up on tape somewhere.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 155
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: How do I change the sound of a dropdown menu?

Post by yaim904 »

EvilPLa wrote: Sun Jul 27, 2025 2:07 pm
This is what I need.
Thank you very much.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
Post Reply

Return to “Modding help”