Error When Adding New Audio Channel

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
Bishima
Newbie
Posts: 10
Joined: Fri Nov 29, 2019 10:45 am
Contact:

Error When Adding New Audio Channel

#1 Post by Bishima » Sun Jul 26, 2020 10:11 am

Hello LSF!

This is my first time posting here so I hope I'm doing it right.

I want to create a new audio channel so that I can have multiple sound effects looping, but every time I do I get an error message. I've tried everything I can think of and tried to look up if I'm getting the syntax wrong but I'm still not that bright when it comes to programming. Can someone help direct me what I'm doing wrong? It will be much appreciated~

Here is the most recent code I am putting into the options.rpy script (I am putting it in the section by default marked "Sounds and Music" underneath the mixer controls if that makes a difference)

Code: Select all

define renpy.music.register_channel("nature", "sfx", loop=True)
And here is the error message that comes out.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/options.rpy", line 55: expected '=' not found.
    define renpy.music.register_channel("nature", "sfx", loop=True)
                                       ^

Ren'Py Version: Ren'Py 7.3.5.606
Sun Jul 26 10:09:32 2020

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Error When Adding New Audio Channel

#2 Post by IrinaLazareva » Sun Jul 26, 2020 11:03 am

Code: Select all

init python:
    renpy.music.register_channel("nature", "sfx", loop=True)

User avatar
Bishima
Newbie
Posts: 10
Joined: Fri Nov 29, 2019 10:45 am
Contact:

Re: Error When Adding New Audio Channel

#3 Post by Bishima » Sun Jul 26, 2020 3:42 pm

IrinaLazareva wrote:
Sun Jul 26, 2020 11:03 am

Code: Select all

init python:
    renpy.music.register_channel("nature", "sfx", loop=True)
Oh! It worked when I put it into options. Do you mind explaining it? I thought init was something innate when you start running the code. If not that's okay, too, I'll just try and look it up for myself. I appreciate the assist tho!

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Error When Adding New Audio Channel

#4 Post by IrinaLazareva » Sun Jul 26, 2020 4:09 pm

Bishima wrote:
Sun Jul 26, 2020 3:42 pm
Oh! It worked when I put it into options. Do you mind explaining it? I thought init was something innate when you start running the code. If not that's okay, too, I'll just try and look it up for myself. I appreciate the assist tho!
look this
https://www.renpy.org/doc/html/python.h ... -statement

User avatar
Bishima
Newbie
Posts: 10
Joined: Fri Nov 29, 2019 10:45 am
Contact:

Re: Error When Adding New Audio Channel

#5 Post by Bishima » Thu Jul 30, 2020 1:54 am

Thanks!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]