Page 1 of 1

Music Will Not Play

Posted: Wed Jun 12, 2019 2:32 am
by Wrath Reign
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."

Re: Music Will Not Play

Posted: Wed Jun 12, 2019 6:43 am
by Crazy Li
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.

Re: Music Will Not Play

Posted: Wed Jun 12, 2019 10:27 am
by Wrath Reign
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.

Re: Music Will Not Play

Posted: Wed Jun 12, 2019 12:00 pm
by Imperf3kt
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."

Re: Music Will Not Play

Posted: Wed Jun 12, 2019 4:36 pm
by Wrath Reign
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!