Page 1 of 1

Typewriter SFX problem.

Posted: Sat Oct 07, 2017 6:09 am
by Amie
Hi guys, I'm using the code below to give my in-game dialogue the 'typewriter' sound effect.

Code: Select all

init python:
    def callback(event, **kwargs):
        if event == "show":
            renpy.music.play("SFX/Text.ogg", channel="typewriter", loop="True")
        elif event == "slow_done" or event == "end":
            renpy.music.stop(channel="typewriter")
This works great, but the problem is that if you open the main menu (by pressing the right mouse button) mid sentence, the text sound just loops forever unless you exit the menu screen, is there any way to make the typewriter sound automatically stop if the menu is opened?

Thanks in advance for any help. :)

Re: Typewriter SFX problem.

Posted: Sun Oct 08, 2017 2:40 am
by philat

Code: Select all

screen save():
    # This ensures that any other menu screen is replaced.
    tag menu
    on "show" action PauseAudio("typewriter", "toggle")
    on "hide" action PauseAudio("typewriter", "toggle")

Re: Typewriter SFX problem.

Posted: Sun Oct 08, 2017 5:13 pm
by Amie
Thanks Philat, I'll give this a try tomorrow :D

Re: Typewriter SFX problem.

Posted: Tue Oct 10, 2017 3:11 am
by Amie
Thanks again for trying to help, Philat, but I've given that code a try and it doesn't have the effect I was hoping for. With your code, I press the right mouse button and no menu shows up at all... but what I was hoping to do was just stop the typewriter sound when a menu is opened, I'm sure there must be a way to do it, but I'm not too good with the coding side of things yet...

Re: Typewriter SFX problem.

Posted: Tue Oct 10, 2017 3:58 am
by Imperf3kt
Where did you place it? In the save screen Ren'Py already comes with (removing the initial two lines) or elsewhere in your screens file?

Re: Typewriter SFX problem.

Posted: Tue Oct 10, 2017 12:37 pm
by Amie
Ah, that was what I was getting wrong I guess :D

OK, so I've put it in the right place now, replacing the old two lines, and it kinda works but there's some unexpected side effects, for example, sometimes you click to enter the menu, but then after a second it will automatically exit the menu for no apparent reason...