Ren'Py Questions

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
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#16 Post by PyTom »

The secret (and by that, I mean it's poorly documented) to fading into the main menu is to use the renpy.transition() function. This function will cause a transition to occur during the next interaction, regardless of what causes that interaction. So if you do something like:

Code: Select all

label main_menu:
    $ renpy.transition(dissolve)
 
    jump _library_main_menu
The dissolve will occur during the next interaction, which occurs during the _library_main_menu code.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#17 Post by monele »

Cool :) Didn't know that ^^

About music/sound : yes, you can use any format supported by Ren'Py. I think you could even use MOD files for sound effects, if needed :).

Mihel

#18 Post by Mihel »

PyTom wrote:The secret (and by that, I mean it's poorly documented) to fading into the main menu is to use the renpy.transition() function. This function will cause a transition to occur during the next interaction, regardless of what causes that interaction. So if you do something like:

Code: Select all

label main_menu:
    $ renpy.transition(dissolve)
 
    jump _library_main_menu
The dissolve will occur during the next interaction, which occurs during the _library_main_menu code.
Unfortunately, I used this code verbatim and it crashes the game with the error

Code: Select all

JumpOutException: start

The last script statement executed was on line 65 of common/mainmenu.rpy.
The traceback is nice and long and lovely, but it ends with something about ui.rpy having an exception with jumpsoutofcontext. I didn't want to tinker around with mainmenu.rpy and figure out what was causing it, so I decided to report it. (I'm on a Mac OS X 10.4.3 PPC G4, if it helps. Maybe it's just me...)

However, the same function can be used to do the same thing if it's called a the end of the splashscreen label:

Code: Select all

label splashscreen:
    ...
    $ renpy.transition(dissolve)
It's a nice effect. It's a shame that it doesn't work going out of the menu, though...

shaja
Regular
Posts: 73
Joined: Sun Oct 16, 2005 8:34 am
Contact:

#19 Post by shaja »

I just tried the same code

Code: Select all

label main_menu:
    $ renpy.transition(dissolve)
 
    jump _library_main_menu 
...in the demo on my linux workstation, and it doesn't crash, although neither does it provide the intended fade-in effect when starting the game, only when jumping to the main menu from the game menu, or at the end of the game.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#20 Post by PyTom »

Mihel wrote:The traceback is nice and long and lovely, but it ends with something about ui.rpy having an exception with jumpsoutofcontext.
It's also chock-full of information that helps me debug the problem. :-)

If you could send me the traceback, and perhaps a game script that demonstrates the problem, I'd appreciate it.

Re: dissolving in the menu, and why it isn't happening for shaja... I think it may be because it's the first screen of the game, and we've never set anything to dissolve from:

Try something like:

Code: Select all

label main_menu:
    with None
    $ renpy.transition(dissolve)
 
    jump _library_main_menu
And see if that makes it work.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

shaja
Regular
Posts: 73
Joined: Sun Oct 16, 2005 8:34 am
Contact:

#21 Post by shaja »

Code: Select all

label main_menu:
    with None
    $ renpy.transition(dissolve)
 
    jump _library_main_menu
Works as intended.

duck-and-wolf
Regular
Posts: 47
Joined: Thu Aug 29, 2019 6:20 pm
Completed: Head of the Class
Organization: Duck & Wolf
Contact:

Re: Ren'Py Questions

#22 Post by duck-and-wolf »

It stands to reason this 13 year old thread would have out-of-date information in it, but I can't get the most recent code example listed immediately above to work.

When I try this:

Code: Select all

label quitToMenu:

    pause

    $ quick_menu = False

    with None
    $ renpy.transition(pixellate)
    jump _library_main_menu
...this results in the below exception, I'm assuming because _library_main_menu is no longer what the main menu screen is referred to as.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 198, in script
    jump _library_main_menu
ScriptError: could not find label '_library_main_menu'.

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

Full traceback:
  File "game/script.rpy", line 198, in script
    jump _library_main_menu
  File "C:\Users\Derp\Desktop\renpy-7.3.2-sdk\renpy\ast.py", line 1695, in execute
    rv = renpy.game.script.lookup(target)
  File "C:\Users\Derp\Desktop\renpy-7.3.2-sdk\renpy\script.py", line 894, in lookup
    raise ScriptError("could not find label '%s'." % str(original))
ScriptError: could not find label '_library_main_menu'.

Windows-8-6.2.9200
Ren'Py 7.3.2.320
Derp 0.07
Wed Sep 11 15:25:36 2019
And when I try this:

Code: Select all

label quitToMenu:

    pause

    $ quick_menu = False

    with None
    $ renpy.transition(pixellate)
    return
...nothing happens, the game just immediately cuts to the main menu.

duck-and-wolf
Regular
Posts: 47
Joined: Thu Aug 29, 2019 6:20 pm
Completed: Head of the Class
Organization: Duck & Wolf
Contact:

Re: Ren'Py Questions

#23 Post by duck-and-wolf »

Also, these do the exact same as using return (meaning, nothing at all, the game does return to the main menu but without any sort of transition):

Code: Select all

label quitToMenu:

    pause

    $ quick_menu = False

    with None
    $ renpy.transition(pixellate)
    $ MainMenu(confirm=False)()

Code: Select all

label quitToMenu:

    pause

    $ quick_menu = False

    with None
    $ renpy.transition(pixellate)
    $ renpy.full_restart()
EDIT:

I have re-asked this question in its own thread here: viewtopic.php?f=8&t=56907

Post Reply

Who is online

Users browsing this forum: dragondatingsim