How to skip the menu *once*

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
User avatar
thelastsecret
Regular
Posts: 53
Joined: Tue Mar 01, 2022 1:32 pm
itch: thelastsecret
Contact:

How to skip the menu *once*

#1 Post by thelastsecret » Sat Jul 30, 2022 3:06 am

How can I skip the main menu depending on whether a certain (persistent) variable is set?
(More precisely, I need to skip the main menu only the first time the player plays the game.)

I know about

Code: Select all

label main_menu:
    return
But this skips the game always and I don't see any way to put this into an IF construction... :|

A naive jump start from the splashscreen also doesn't quite work: for some mysterious reasons the quick menu is then not displayed (even if I open that screen by adding a show screen command), so it looks like there is some magic going on in the background at the start of the game that should not be entirely bypassed for best results.

Reason why I need this: At the beginning of my game when started the first time a short intro in how to play the game is provided. Now if the game is started the first time and the player ends up in the main menu, he might not start immediately (and get the intro). Instead, at least one test player started some extra first and then didn't know how to use it and got stuck. (You know, people can even be stuck in a VN when all they had to do would be to press space or mouse click to continue... :D ) If the first time they launched the game they would immediately end up starting the game (without menu first), that problem would be solved.

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to skip the menu *once*

#2 Post by m_from_space » Sat Jul 30, 2022 6:31 am

So the first time a player starts your game, you want him to go play a demo/tutorial, but after every other start the normal game menu should get shown?

Code: Select all

# this label is called after the game loads, but before the main menu shows
label splashscreen:
    if persistent.first_time is None:
        $ persistent.first_time = True
        # when the game tutorial returns, we end up here again
        call game_tutorial
    # returning from the splashscreen will call the main menu
    return

User avatar
thelastsecret
Regular
Posts: 53
Joined: Tue Mar 01, 2022 1:32 pm
itch: thelastsecret
Contact:

Re: How to skip the menu *once*

#3 Post by thelastsecret » Sat Jul 30, 2022 8:20 am

Thank you, but unfortunately, it's not that easy: I want the game to start directly (the first time), not just have it call a tutorial there. (The tutorial is integrated into the game start, so I don't want to make it "stand alone".)

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

Re: How to skip the menu *once*

#4 Post by Ocelot » Sat Jul 30, 2022 10:16 am

Ok, a little bit of using undocumented RenPy internals:

Code: Select all

label main_menu:
    if not persistent.tutorial_finished: # Do not forget to set it to True after finishing tutorial
        return # Or Start(something) or something else
    else:
        # That's the actual internal label responsible for showing main menu. 
        # Surprisingly, it does not start with underscore or present in reserved names section in documentation
        jump expression "main_menu_screen" 
< < insert Rick Cook quote here > >

User avatar
thelastsecret
Regular
Posts: 53
Joined: Tue Mar 01, 2022 1:32 pm
itch: thelastsecret
Contact:

Re: How to skip the menu *once*

#5 Post by thelastsecret » Sat Jul 30, 2022 3:25 pm

Wow! Thank you very much! That was some Voodoo-Ren'py-Magic, but it works like a charm. :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]