Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
Amie
- Regular
- Posts: 28
- Joined: Tue Jun 06, 2017 4:48 am
-
Contact:
#1
Post
by Amie » Sat Oct 07, 2017 6:09 am
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.

-
philat
- Eileen-Class Veteran
- Posts: 1853
- Joined: Wed Dec 04, 2013 12:33 pm
-
Contact:
#2
Post
by philat » Sun Oct 08, 2017 2:40 am
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")
-
Amie
- Regular
- Posts: 28
- Joined: Tue Jun 06, 2017 4:48 am
-
Contact:
#3
Post
by Amie » Sun Oct 08, 2017 5:13 pm
Thanks Philat, I'll give this a try tomorrow

-
Amie
- Regular
- Posts: 28
- Joined: Tue Jun 06, 2017 4:48 am
-
Contact:
#4
Post
by Amie » Tue Oct 10, 2017 3:11 am
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...
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#5
Post
by Imperf3kt » Tue Oct 10, 2017 3:58 am
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?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
Amie
- Regular
- Posts: 28
- Joined: Tue Jun 06, 2017 4:48 am
-
Contact:
#6
Post
by Amie » Tue Oct 10, 2017 12:37 pm
Ah, that was what I was getting wrong I guess
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...
Users browsing this forum: Bing [Bot], Google [Bot]