Page 1 of 1

Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Wed Nov 15, 2017 10:56 am
by [Admin-C]
Hello everyone,

I may need some help today regarding SFX. Apparently, whenever I head over to the Main Menu, the current SFX that is being played in the story is still playing even if you are no longer in the story mode.

I heard that there is a stop play script but I don't know any commands on where to put it.

This is the code that I currently have at the start of the game.

Code: Select all

 scene black with Pause(1)
    play sound ("SFX/chirpingBirds.wav") fadeout 1.0
    scene Gym with fade
    show sample
I was wondering if there is a way that I can end the SFX if ever a player or myself decide to go to the Main Menu regardless if the sound that is being played is over or not.

Any help would be very much appreciated.

Re: Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Wed Nov 15, 2017 11:04 am
by NineBells
Try adding

Code: Select all

Stop("sound")
into the action of the button you use to go to the main menu.

Re: Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Wed Nov 15, 2017 12:02 pm
by [Admin-C]
Hello NineBells,

Thank you for your reply, I have tried your suggestion but I only end up receiving an error. I don't know if the exact codes were right or if I placed the codes correctly. Regardless of this, kindly see the following codes below and let me know the error(s) that is in my script.

From screens.rpy

Code: Select all

screen navigation():

    vbox:
        style_prefix "navigation"

        xpos gui.navigation_xpos
        yalign 0.5

        spacing gui.navigation_spacing

        if main_menu:

            textbutton _("Start") action Start()
            Stop("SFX/chirpingBirds.wav")
I am guessing that I might have placed it in the wrong part of the scripts but please show me an example of where to put it.

Thank you in advance!

Re: Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Wed Nov 15, 2017 12:07 pm
by NineBells
Try this:

Code: Select all

textbutton _("Start") action [Stop("sound"), Start()]

Re: Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Wed Nov 15, 2017 1:30 pm
by [Admin-C]
NineBells wrote: Wed Nov 15, 2017 12:07 pm Try this:

Code: Select all

textbutton _("Start") action [Stop("sound"), Start()]
Hello NineBells,

I am very pleased to let you know that this part has worked!

I can now able to stop ongoing sounds that are still playing when heading back to the Main Menu. However, the sounds are already being cut-off during the confirmation dialogue box (asking you to confirm your decision to go to the Main Menu). As for that, I cannot find the codes for the confirmation box in any of my scripts. I tried tracing the confirmation dialogue but I couldn't find it.

Below is the sample of the confirmation dialogue box that I am talking about.
Image

I hope you could help me out on this one. Thank you in advance!

Re: Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Wed Nov 15, 2017 4:15 pm
by Imperf3kt
It might be better to stop the sounds using the "on show" command withing the main menu?

I can't think of a way right now, but the documentation may have some clues.

Re: Ren'Py In-game SFX is still playing on [Main Menu]

Posted: Sun Dec 10, 2017 11:47 am
by [Admin-C]
Imperf3kt wrote: Wed Nov 15, 2017 4:15 pm It might be better to stop the sounds using the "on show" command withing the main menu?

I can't think of a way right now, but the documentation may have some clues.
Hello Imperf3kt,

I apologize for the late reply as I was so caught up with my irl job. I find the documentation to bear less information on what I need I'm afraid. However, upon checking some of the recently solved threads related to my concern, I found some helpful tips for fixing my problems. Regardless, thank you for your reply and I appreciate it very much!