Page 1 of 1

[SOLVED] Music on a Screen?

Posted: Mon Jul 06, 2020 10:39 pm
by Shocking Alberto
Curious to know if there's a way to play music on a screen besides using the MusicRoom screen code? I'm building a CG/event gallery right now and while music is playing in said gallery, which is piped in from the BGM set for the main menu, it would be ideal to be able to use a different track for the gallery itself. Short of making a button to use an action to use a music file, I'm not sure what other options there are.

If a thread on this already exists, just kick me to the thread. I'll figure it out from there. o/

Re: Music on a Screen?

Posted: Mon Jul 06, 2020 11:00 pm
by Shocking Alberto
After some searching, it seems the easiest is still to change the action from screens.rpg to go to a label where you can change the music then call the screen for the CG gallery.

Only problem is if you exit the gallery, it will be playing the music from the gallery, rather than the main menu. Welp, nearly there... /o/

Re: Music on a Screen?

Posted: Tue Jul 07, 2020 1:36 pm
by Jackkel Dragon
The simple idea that comes to mind is to use multiple actions. On the button to enter the gallery, instead of

Code: Select all

action <action>
use:

Code: Select all

action [<action>, <action>]
This will play the actions from the list, in order. As long as you play music before you switch screens, it should carry over.

For returning to the title screen, you could use the dedicated main menu action instead of "return", or do the above method to change the music before popping the current screen to return.

There's a complex idea that comes to mind that involves overriding internal labels, but I don't know if it would even work. I'd heavily recommend the multiple action list for the related buttons.

Re: Music on a Screen?

Posted: Sun Jul 12, 2020 3:48 pm
by Shocking Alberto
Thank you for the suggestion! I keep forgetting that you can use multiple actions at once.

With that said, it seems that the button to return back to the main menu with no longer becomes responsive when you add multiple actions. Currently I am using this code which should work:

Code: Select all

    imagebutton:
        xalign 0.98
        yalign 0.98
        idle "gui/return.png"
        hover "gui/return_hover.png"
        hovered Play ("sound", "SE/sound_hover.ogg")
        activate_sound "SE/sound_click.ogg"
        action [Call("music_reset"), MainMenu(confirm=False)]
The "music_reset" label itself just contains a single line to play the main menu screen and that's it. Maybe there's some limitations as to what can be put in the action line. Guess I'll snoop around some more till I figure it out.

Re: Music on a Screen?

Posted: Sun Jul 12, 2020 4:25 pm
by Shocking Alberto
Okay, never mind I am dumb and didn't read the documentation thoroughly. Again. I forgot that there were audio actions I can use and it worked as suggested. Thanks, Jackkel!