[Solved] Fade out main menu?

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
TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

[Solved] Fade out main menu?

#1 Post by TRIDENT_12 »

So, as the title says, I want to fade out the main menu before the start of the game.
The idea being that the music fades at the same time the audio does, so the transition isn't so jarring.
I imagine I need to add something to screens.rpy?
Or transitions.rpy and then do an "at" statement in screens?
As always, any and all help is always appreciated.
Last edited by TRIDENT_12 on Sat Jan 29, 2022 5:42 am, edited 1 time in total.

User avatar
m_from_space
Miko-Class Veteran
Posts: 941
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Fade out main menu?

#2 Post by m_from_space »

You actually don't have to do much for it. Something like this should suffice:

Code: Select all

label start:
	stop music fadeout 1.0
	scene black
	with Dissolve(1.0)
	...

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#3 Post by TRIDENT_12 »

m_from_space wrote: Tue Jan 25, 2022 6:56 am You actually don't have to do much for it. Something like this should suffice:

Code: Select all

label start:
	stop music fadeout 1.0
	scene black
	with Dissolve(1.0)
	...
I did try that
And I got this error...

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 10, in script
    with dissolve(3.0)
TypeError: 'Dissolve' object is not callable

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 10, in script
    with dissolve(3.0)
  File "renpy/ast.py", line 1443, in execute
    renpy.exports.with_statement(trans, paired)
  File "renpy/exports.py", line 1682, in with_statement
    return renpy.game.interface.do_with(trans, paired, clear=clear)
  File "renpy/display/core.py", line 2752, in do_with
    clear=clear)
  File "renpy/display/core.py", line 3315, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3674, in interact_core
    new_widget=layers_root)
TypeError: 'Dissolve' object is not callable

Windows-10-10.0.22000
Ren'Py 7.4.10.2178
LibitinaV2 1.0
Wed Jan 26 19:28:17 2022

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Fade out main menu?

#4 Post by Ocelot »

Spot the difference:

Code: Select all

# ↓ m_from_space suggestion (with timing correction)
with Dissolve(3.0)
with dissolve(3.0)
# ↑ your code
< < insert Rick Cook quote here > >

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#5 Post by TRIDENT_12 »

Ocelot wrote: Wed Jan 26, 2022 6:02 am Spot the difference:

Code: Select all

# ↓ m_from_space suggestion (with timing correction)
with Dissolve(3.0)
with dissolve(3.0)
# ↑ your code
Even after that it jumps straight into the game, regardless of the dissolve statement.
The fact it already said "Dissolve" in the traceback, tells me capitalization doesn't matter (unless I'm using some transition I wrote, and then it does)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Fade out main menu?

#6 Post by Ocelot »

TRIDENT_12 wrote: Wed Jan 26, 2022 7:25 am The fact it already said "Dissolve" in the traceback, tells me capitalization doesn't matter (unless I'm using some transition I wrote, and then it does)
That's wrong.
dissolve is an object of class Dissolve. In partivulat it is defined as dissolve = Dissolve(1.0). Trying to write dissolve(3.0) is like writing Dissolve(1.0)(3.0)

And for your problem. Try to trigger transition before starting the game. For example: action [With(Dissolve(3.0)), Start()]
< < insert Rick Cook quote here > >

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#7 Post by TRIDENT_12 »

Ocelot wrote: Wed Jan 26, 2022 9:22 am
TRIDENT_12 wrote: Wed Jan 26, 2022 7:25 am The fact it already said "Dissolve" in the traceback, tells me capitalization doesn't matter (unless I'm using some transition I wrote, and then it does)
That's wrong.
dissolve is an object of class Dissolve. In partivulat it is defined as dissolve = Dissolve(1.0). Trying to write dissolve(3.0) is like writing Dissolve(1.0)(3.0)
So from what I'm gathering, spelling is important.
I thought I only had to be mindful of spelling when writing variables, and user-defined transitions and stuff.
Ocelot wrote: Wed Jan 26, 2022 9:22 am And for your problem. Try to trigger transition before starting the game. For example: action [With(Dissolve(3.0)), Start()]
I tried that (making sure of my spelling and capitalization) and it faded.
But only for 0.25 seconds instead of the 3 seconds I'd specified.
What am I doing wrong?

Code: Select all

 textbutton _("Start") action [With(Dissolve(3.0)), Start(persistent.chapter[-1])]

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Fade out main menu?

#8 Post by Ocelot »

at the label where you want to start, add pause 3 statement. If you want to dissolve into specific image, show it before pause:

Code: Select all

# NOT scene, it is basically clear + show + with. And we don't need the last one there
show background
pause 3
< < insert Rick Cook quote here > >

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#9 Post by TRIDENT_12 »

Ocelot wrote: Thu Jan 27, 2022 4:18 am at the label where you want to start, add pause 3 statement. If you want to dissolve into specific image, show it before pause:

Code: Select all

# NOT scene, it is basically clear + show + with. And we don't need the last one there
show background
pause 3
This worked brilliantly!
Thank you so much!
But for some reason I can't fade out the main menu music at the same time as we fade out the main menu.
Is that even possible?

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Fade out main menu?

#10 Post by Ocelot »

How do you fade out your music?
< < insert Rick Cook quote here > >

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#11 Post by TRIDENT_12 »

Ocelot wrote: Thu Jan 27, 2022 5:44 am How do you fade out your music?
Like this

Code: Select all

 $ renpy.music.stop(channel="music", fadeout=3)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Fade out main menu?

#12 Post by Ocelot »

I mean, where in your script it is, relative to script start, pause, show statements, etc.
< < insert Rick Cook quote here > >

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#13 Post by TRIDENT_12 »

Ocelot wrote: Thu Jan 27, 2022 6:21 am I mean, where in your script it is, relative to script start, pause, show statements, etc.
Whoops
My bad
I'm sorry, I misunderstood.

Code: Select all

label start:
    pause 3
    $ renpy.music.stop(channel="music", fadeout=3)

    $ s_name = "Sarah"
    $ k_name = "???"
    $ a_name = "???"
    $ style.say_dialogue = style.normal

if persistent.act == 1:
    menu:
        "Do you want to skip to the end?"
        "Yes":
            jump credits
        "No":
            pass

    menu:
        "Do want to go to act 2?"
        "Yes":
            $ persistent.act = 2
            jump ch21
        "No":
            pass
I tried putting it before the pause
It faded out the music, and then paused.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Fade out main menu?

#14 Post by Ocelot »

This is strange, because both ways to stop music works for me:

Code: Select all

# in  screens:
# textbutton _("Start") action [With(Dissolve(3.0)),  Start()]

define config.main_menu_music = "audio/Clock_All.wav"
image bg room = Solid('00FF00')
label start:
    # stop music fadeout 3
    $ renpy.music.stop(channel="music", fadeout=3)
    show bg room
    pause 3
    show eileen happy
    "You've created a new Ren'Py game."
    "Once you add a story, pictures, and music, you can release it to the world!"
    return
If you still having issues with pause taking longer than it should, you can try to make pause shirter to compensate for time lost on fadeout.
< < insert Rick Cook quote here > >

TRIDENT_12
Regular
Posts: 30
Joined: Tue Aug 03, 2021 4:29 pm
Projects: The Monster Within
Github: TRIDENT1313
Discord: TRIDENT_12#2285
Contact:

Re: Fade out main menu?

#15 Post by TRIDENT_12 »

I did this

Code: Select all

label start:
    pause 3 and renpy.music.stop(channel="music", fadeout=3)
And it faded out the main menu at the same time as the music
But it forces me to click to continue, instead of running straight to the choice.
I have the dissolve in screens.
The c2c is kinda annoying, and I can't have a {nw} in there, obviously.
Any ideas?
Sorry to be such a pain

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Ocelot