Music Will Not Play

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
Wrath Reign
Newbie
Posts: 3
Joined: Wed Jun 12, 2019 2:23 am
Contact:

Music Will Not Play

#1 Post by Wrath Reign » Wed Jun 12, 2019 2:32 am

So this is my first day in Ren'py, so it's quite possible I'm pulling a stupid here. I've spent the past 2 hours trying to make it so I can play music over a scene in my learning-the-works game (a throw away thing I'm using to learn it with) and it just won't work. Music is set to true, I've tried putting the audio files in the main game folder, a folder titled "music", a folder titled "audio," and even the images folder because I read that other people had success with it. So, here's my code I guess.

Code: Select all

	play music "mysong4.ogg"        
        
        scene bg classroom
        
        transform left:
            xalign 0.0
            yalign 1.0
        
        transform right:
            xalign 1.0
            yalign 1.0
        
        define R = Character("Royal", color="#D5BC2F")
            
        define T = Character("Terry", color="961c67")
        
        label start:
            
        "I'm afraid of myself. Can you understand that feeling?"
        
        scene bg classroom
        
        show royal neutral at right
        
        "Royal" "Hey, Terry, what are you doing in here by yourself?"
        
        hide royal neutral
        
        show terry neutral at left
        
        "Terry" "Er... Nothing. Was just looking for something, but it doesn't appear to be in here so I'll uh-- I'll just forget it."
        
        hide terry neutral
        
        show royal neutral at right
        
        R "Ah, what was it? Maybe I could help?"
        
        hide royal neutral
        
        show terry neutral at left
        
        T "No-no. Forget it, okay?"
        
        define slowdissolve = Dissolve(1.0)
        
        scene bg classroom
        show terry neutral at left
        with slowdissolve
        
        scene bg forest
        show terry neutral at left
        with slowdissolve
            
        T "It's getting dark, you should head home."
            
        hide terry neutral
        show royal neutral at right
        
        R "But what about you? It's dark, you shouldn't walk home by yourself."
        
        hide royal neutral
        show terry neutral at left
        
        T "Trust me, I'll be fine."

Crazy Li
Regular
Posts: 112
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: Music Will Not Play

#2 Post by Crazy Li » Wed Jun 12, 2019 6:43 am

You've told the game to play music before the game has even started. I wonder if that has something to do with it? Try moving your "play music ..." statement after "label start:" and see if that fixes anything.

Wrath Reign
Newbie
Posts: 3
Joined: Wed Jun 12, 2019 2:23 am
Contact:

Re: Music Will Not Play

#3 Post by Wrath Reign » Wed Jun 12, 2019 10:27 am

Crazy Li wrote:
Wed Jun 12, 2019 6:43 am
You've told the game to play music before the game has even started. I wonder if that has something to do with it? Try moving your "play music ..." statement after "label start:" and see if that fixes anything.
Oh, I should've mentioned I've moved it before and after the label a few times. When I put it there this time, I got this message. (It won't let me copy-paste it and my screenshots are too big so I apologize but I'll have to use links.)

https://i.imgur.com/EVMJS0y.png
https://i.imgur.com/MUxzsaI.png

Where am I supposed to have the music files stored, anyway? Right now they're in the main folder, but like I said I've tried a "music" folder, an "audio" folder, and the images folder as well.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 2844
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Music Will Not Play

#4 Post by Imperf3kt » Wed Jun 12, 2019 12:00 pm

You need to be aware of indentation.
https://www.renpy.org/doc/html/language ... and-blocks

"label start:" should be all the way to the left with no spacing. The lines after it should be spaced four spaces in. You don't need transform left / right either, renpy already knows what left/right mean, any defines should be placed before the start label with no indentation. I'm not sure why you kept changing the scene to the same scene that was already showing.

Code: Select all

define R = Character("Royal", color="#D5BC2F")
            
define T = Character("Terry", color="961c67")
define slowdissolve = Dissolve(1.0) 

label start:

    play music "mysong4.ogg"        
        
    scene bg classroom
            
    "I'm afraid of myself. Can you understand that feeling?"
        
    show royal neutral at right
        
    "Royal" "Hey, Terry, what are you doing in here by yourself?"
        
    hide royal neutral
        
    show terry neutral at left
        
    "Terry" "Er... Nothing. Was just looking for something, but it doesn't appear to be in here so I'll uh-- I'll just forget it."
        
    hide terry neutral
        
    show royal neutral at right
        
    R "Ah, what was it? Maybe I could help?"
        
    hide royal neutral
        
    show terry neutral at left
        
    T "No-no. Forget it, okay?"

    show terry neutral at left
    with slowdissolve
        
    scene bg forest
    show terry neutral at left
    with slowdissolve
            
    T "It's getting dark, you should head home."
            
    hide terry neutral
    show royal neutral at right
        
    R "But what about you? It's dark, you shouldn't walk home by yourself."
        
    hide royal neutral
    show terry neutral at left
        
    T "Trust me, I'll be fine."
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

Wrath Reign
Newbie
Posts: 3
Joined: Wed Jun 12, 2019 2:23 am
Contact:

Re: Music Will Not Play

#5 Post by Wrath Reign » Wed Jun 12, 2019 4:36 pm

Imperf3kt wrote:
Wed Jun 12, 2019 12:00 pm
You need to be aware of indentation.
https://www.renpy.org/doc/html/language ... and-blocks

"label start:" should be all the way to the left with no spacing. The lines after it should be spaced four spaces in. You don't need transform left / right either, renpy already knows what left/right mean, any defines should be placed before the start label with no indentation. I'm not sure why you kept changing the scene to the same scene that was already showing.
Er-- I actually didn't realize I went to the same scene twice. I wonder when I managed to do that-- thank you for pointing it out. As for why I defined left & right, I was just following what the ren'py tutorial told me, perhaps I misunderstood, so thank you for clearing it up for me. And also thank you for explaining the indentations to me, because I couldn't seem to get a grasp on it and I think I understand now.

I sort of restarted from scratch when I realized I had so many problems and wanted to go at it with a clear head. I now have everything working thanks to you guys, so thank you!

Post Reply

Who is online

Users browsing this forum: darkforte