[SOLVED]Music Continue

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.
Message
Author
User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

[SOLVED]Music Continue

#1 Post by senisanti »

Hi Friends

The music stops as soon as we change labels or there is a choice, is there a way to play the music continuously and stop it only as I want.
Last edited by senisanti on Thu Oct 24, 2019 2:14 pm, edited 3 times in total.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Music Continue

#2 Post by isobellesophia »

senisanti wrote: Sun Oct 20, 2019 11:03 am Hi Friends

The music stops as soon as we change labels or there is a choice, is there a way to play the music continuously and stop it only as I want.
Can you show us the code exactly? That'll much give information about your problem.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Music Continue

#3 Post by senisanti »

I put this code before the label start

Code: Select all

label splashscreen:
    play music "tropicalflow.MP3"
    scene first
    with Dissolve(.95)
    pause 4.95
    scene first2
    with Dissolve(.95)
    pause 8.95
    scene black
    "Do you agree the rules?"
    menu:
        "Yes":
            return
        "No":
            $ renpy.quit()
    return

label before_main_menu:
    $ renpy.movie_cutscene("santirosa.mpg")
    call screen main_menu
I can't put the cutscene on because the music stops.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Music Continue

#4 Post by Per K Grok »

senisanti wrote: Sun Oct 20, 2019 12:49 pm I put this code before the label start

Code: Select all

label splashscreen:
    play music "tropicalflow.MP3"
    scene first
    with Dissolve(.95)
    pause 4.95
    scene first2
    with Dissolve(.95)
    pause 8.95
    scene black
    "Do you agree the rules?"
    menu:
        "Yes":
            return
        "No":
            $ renpy.quit()
    return

label before_main_menu:
    $ renpy.movie_cutscene("santirosa.mpg")
    call screen main_menu
I can't put the cutscene on because the music stops.
try

$ renpy.movie_cutscene("santirosa.mpg", stop_music=False)

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Music Continue

#5 Post by senisanti »

Doesn't worked.

with a different organization, can I manage to put everything in the same block?

After a few works more, i've found this

play movie is better than cutscene

Code: Select all

label splashscreen:
    play music "tropicalflow.MP3"
    play movie "santirosa.mpg"
    scene first
    with Dissolve(.95)
    pause 4.95
    scene first2
    with Dissolve(.95)
    pause 8.95
    scene black
    "Do you agree the rules?"
    menu:
        "Yes":
            call screen main_menu
        "No":
            $ renpy.quit()
    
label before_main_menu:
    call screen main_menu
    
Now i've the movie and the music tougther.
but i've already few problems:
the first image "scene first" don't apear...
and the music stop when i come to the main menu, i d'on't wan't she stop now, i want the music stop only when the game start...
how can'i ressolve this two problems?

User avatar
pyPat
Regular
Posts: 30
Joined: Wed Sep 11, 2019 5:34 pm
Github: patlol
Location: France
Contact:

Re: Music Continue

#6 Post by pyPat »

If "first2" appears that a pause between play movie and scene first would allow "first" to be displayed ?

Why a call, and not a jump label main_menu? Maybe it would work?
English is not my native language; please excuse typing errors.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Music Continue

#7 Post by isobellesophia »

Call functions is actually calling a screen, unless you'll click it or press it to continue.

While label is just a label with a normal dialogue to put on.

Main menu has a label itself as pyPat said, it will jump into the main menu label.

Code: Select all

label before_main_menu:
    jump main_menu
    
label main_menu:
   "Aaa."
Maybe you'll try it for a chance.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Music Continue

#8 Post by senisanti »

No it doesn't work, if I put jump there is no main menu, after the jump I see the Aaa with a black screen and the game starts automatically.

And with a "pause" between the movie and the fist it doesn't work.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Music Continue

#9 Post by Donmai »

senisanti wrote: Sun Oct 20, 2019 11:03 amThe music stops as soon as we change labels or there is a choice, is there a way to play the music continuously and stop it only as I want.
I've been following this discussion and I am slightly confused about what exactly are you wanting to achieve. If the only problem is the music stopping when leaving a label, try simply playing the same music in the other label. Chances are the music won't restart, but will continue playing seamlessly until you command it to stop.
In most of my games (The Other Question is a good example), I like to have a song that starts in the splash screen label, continues playing through the main menu, and ends with a fade after the game has started. To achieve this I simply start the song normally in the splash screen. When the game reaches the main menu, Ren'Py finds out the defined "main menu music" is the same song that's already playing and just keeps playing it.

Code: Select all

    ## Music that is played while the user is at the main menu.

    config.main_menu_music = "bgm/yeah.OGG"

Code: Select all

label splashscreen:
    scene black
    show splash:
        truecenter
    with Dissolve(1.0)
    play music "bgm/yeah.OGG"
    scene black
    with Dissolve(2.0)
    return

Code: Select all

# The game starts here.
label start:
    
    stop music fadeout 2.0
    
    scene classroom
    "Well, professor Eileen's lecture was interesting."
What's confusing me? If I understood it correctly, you're trying to play a song and a movie at the same time. The problem is Ren'Py only accepts movies with a soundtrack, even if it's a silent soundtrack. The other thing is I can't remember seeing someone using the scene command on a splash screen. Usually we just use:

Code: Select all

add "image_name"
In the menu, I would use the options:

Code: Select all

    menu:
        "Yes":
            return #return should close the splash screen and proceed to the main menu, but I never tested it
        "No":
            $ renpy.quit() # that's fine, although quitting the program suddenly may upset the player
:)
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Music Continue

#10 Post by senisanti »

Congratulations Donmai.

you understood very well what I wanted, my English is bad and the translator is not good. "smiley yellow"

the technique of putting the identical music on the option file and on the splashscreen works very well.
that's the main thing I wanted to do.

the code still has problems.

yes, it is possible to put a video and a music at the same time.

Code: Select all

 play music "tropicalflow.MP3"
    play movie "santirosa.mpg" 

with this method he plays music and video at the same time.
but it deletes one of the first two images.

Code: Select all

label splashscreen:
    play music "tropicalflow.MP3"
    play movie "santirosa.mpg"
    scene first
    with Dissolve(.95)
    pause 4.95
    scene first2
    with Dissolve(.95)
    pause 8.95
    scene black
    "Do you agree the rules?"
    menu:
        "Yes":
            call screen main_menu
        "No":
            $ renpy.quit()

label before_main_menu:
    call screen main_menu
With my whole code, I make two images appear after the video, if I put the video only one image appears, if I do not put the video both images appear.
I don't understand why and the PyPat technique, "pause" doesn't work

I would also like to prevent the players from clicking and passing the images and video because it displays the rules and right after I ask if they accept these rules, so I want to block the scrolling so that the player is forced to read.
I tried with the "block" "clickable"... and other stuff but I failed.


I don't understand with add, I have a mistake that tells me "sayer add isn't defined"

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Music Continue

#11 Post by Donmai »

Oops! My fault! :shock:
We only use "add" to show images on screens. Instead of "scene", you can simply use "show" (as in my example splash screen code).
(Silly me. Yes, the scene command works well on a splash screen. I've been using it for years... :? )
Probably a silly question, but have you tried inserting a pause before showing the images?
https://www.renpy.org/dev-doc/html/othe ... enpy.pause

BTW, not a native English speaker here, also. :)
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Music Continue

#12 Post by senisanti »

Donmai wrote: Tue Oct 22, 2019 10:51 am Oops! My fault! :shock:
We only use "add" to show images on screens. Instead of "scene", you can simply use "show" (as in my example splash screen code).
(Silly me. Yes, the scene command works well on a splash screen. I've been using it for years... :? )
Probably a silly question, but have you tried inserting a pause before showing the images?
https://www.renpy.org/dev-doc/html/othe ... enpy.pause

BTW, not a native English speaker here, also. :)
Yes pyPat has proposed this idea but it doesn't work.

I''ve succedeed, pause 4.95 don't work, but pause 8.95 work fine ???

The last probleme now...
I still haven't been able to find out how to prevent the player from clicking to move the images forward, I want him to be forced to read...
I'm sure blocking the mouse click exists, I saw it somewhere but I can't find it anymore.

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Music Continue

#13 Post by senisanti »

Up!

Nobody know the soluce?

I still haven't been able to find out how to prevent the player from clicking to move the images forward, I want him to be forced to read...
I'm sure blocking the mouse click exists, I saw it somewhere but I can't find it anymore.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Music Continue

#14 Post by Donmai »

Remember that forcing someone to do something is always a no-no... :lol:
But if you look at the documentation link I gave you you will see there is a hard pause option.
Set it to True and the mouse click user interaction will be disabled during the pause.

Code: Select all

$ renpy.pause(12, hard=True)
Of course, loooooong pauses will make the player believes the program crashed. :(
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

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

Re: Music Continue

#15 Post by Imperf3kt »

12 seconds is an extremely long time for a pause 🤨
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: No registered users