[SOLVED] How to add a sound effect on screen load

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.
Post Reply
Message
Author
User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

[SOLVED] How to add a sound effect on screen load

#1 Post by Kinmoku »

Hi all,

I want to add a sound effect when a screen appears. This screen is a popup/ notification kind of thing, so I want a sound to play with it.

I don't really know what I'm doing, but I tried this:

Code: Select all

    on "show" action Play(audio, "sounds/notification.wav", selected=False)
However, it doesn't work and comes up with an error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/forum_ff.rpy", line 61, in script
    pause
  File "renpy/common/000statements.rpy", line 416, in execute_pause
    renpy.pause()
  File "renpy/common/00action_audio.rpy", line 64, in __call__
    renpy.music.play(self.file, channel=self.channel, **self.kwargs)
TypeError: argument of type 'StoreModule' is not iterable
Any ideas how to do this? :)
Last edited by Kinmoku on Fri Aug 07, 2020 3:29 am, edited 1 time in total.

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: How to add a sound effect on screen load

#2 Post by drKlauz »

Code: Select all

on "show" action Play("audio", "sounds/notification.wav", selected=False)
Channel is string id, you send audio module instead.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: How to add a sound effect on screen load

#3 Post by Kinmoku »

drKlauz wrote: Thu Aug 06, 2020 12:54 pm

Code: Select all

on "show" action Play("audio", "sounds/notification.wav", selected=False)
Channel is string id, you send audio module instead.
Ah, thank you :) It works now.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]