[SOLVED] How to have the game skip main menu conditionally

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
nairi_0
Newbie
Posts: 5
Joined: Wed Oct 04, 2023 1:40 pm
Contact:

[SOLVED] How to have the game skip main menu conditionally

#1 Post by nairi_0 »

Hello!! I'm new here, I hope the question isn't too confusing...

In my game, upon entering certain names in the naming input, I set persistent data to true and then make the game automatically quit. Using that persistent data, I was hoping that when the game launches again it skips straight into a scene without going through the main menu.

This is what that part looks like

Code: Select all

default persistent.gastername = False

label main_menu:
  if persistent.gastername == True:
    $ persistent.gastername = False
    jump namecrash
    # this skips the main menu in a "splashscreen" way and launches game straight into dialogue (mid-game)
  else:
    call screen main_menu
    # this loads main menu when launching game, and no issues here

label start:
# the game works fine here, it's the start of dialogue (beginning of the game)
Image
this is how it looks like normally -- nevermind the lack of visuals.

but when i try to skip the main menu, it's like game is stuck in "splashscreen mode" ><;;;
Image
i can't right click, can't save, can't load. every button is gone except continuing to read, which is not my goal.

i want it to work exactly like normal, except the very start jumps straight to the label.

It's only an issue when it jumps to the namecrash label, game works fine if I don't name character the certain names.

Do you know how to make this work...? Q7Q
Last edited by nairi_0 on Thu Apr 11, 2024 4:52 am, edited 3 times in total.

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

Re: How to have the game skip main menu conditionally

#2 Post by m_from_space »

nairi_0 wrote: Thu Nov 09, 2023 9:34 am Do you know how to make this work...? Q7Q
First of all, make sure to understand that you're not going to load a game or something just by jumping straight towards a label before main menu.

So do you want the player to jump to that label with their last game or something? Because multiple players or playthroughs could be saved and which one should be considered important for that decision? If the player's variables don't matter (besides the name), you have to make it work inside label start and imagine that a player starts a new game, didn't already pick that name (because it's using your default value) and then you set the name yourself and jump to a label of your choice. But again, this ignores playthroughs of other players inside your Renpy saves.

Or is it just a cutscene or something? Also what should happen after this special label?

Code: Select all

label main_menu:
    if persistent.gastername:
        # jump to label start, basically starting a new game (don't use jump)
        return
    else:
        # i'm really not sure this is the right approach to be honest, maybe somebody could confirm
        call screen main_menu

label start:
    if persistent.gastername:
        $ persistent.gastername = False
        # change your character's name here, if it's important
        # all other variables will be reset to their default value though!
        $ mcname = "specialname"
        jump namecrash
    # here follows the normal game when starting it.
    "Hello, this is a perfectly fresh game."
But that's just weird of course, since it doesn't care about a specific player. The best approach if the player's save is important is to call that special label after a player loads their game. I don't know if you can load a game without showing the main menu on the other hand. (You wouldn't need a persistent variable here of course, since every player can just have their own variable if they chose a specific name.)

Code: Select all

label after_load:
    if persistent.gastername:
        $ persistent.gastername= False
        jump namecrash
    return
Last edited by m_from_space on Fri Nov 10, 2023 9:18 am, edited 1 time in total.

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

Re: How to have the game skip main menu conditionally

#3 Post by m_from_space »

Something else that came to mind by the way: It's probably a bad idea to not show the main menu at all. Because always imagine that multiple players are using your game on one computer (maybe a brother and his sister). So if I am the brother and chose this special character name, then save and quit and some hours later my sister is going to play her own game, while I am away, she will see this cutscene or special label for no reason. And I won't even see it. Also even if I am the only player on my computer, what if I just start Renpy, go to the toilet in the meantime and miss out on whatever happens inside the special label?

TL;DR Do *not* skip main menu! Let players decide when they are ready to play!

nairi_0
Newbie
Posts: 5
Joined: Wed Oct 04, 2023 1:40 pm
Contact:

Re: How to have the game skip main menu conditionally

#4 Post by nairi_0 »

m_from_space wrote: Fri Nov 10, 2023 8:54 am
nairi_0 wrote: Thu Nov 09, 2023 9:34 am Do you know how to make this work...? Q7Q
So do you want the player to jump to that label with their last game or something? Because multiple players or playthroughs could be saved and which one should be considered important for that decision? If the player's variables don't matter (besides the name), you have to make it work inside label start and imagine that a player starts a new game, didn't already pick that name (because it's using your default value) and then you set the name yourself and jump to a label of your choice. But again, this ignores playthroughs of other players inside your Renpy saves.

Or is it just a cutscene or something? Also what should happen after this special label?
Thank you for answering!! I guess i didn't explain it correctly. Essentially, the special name makes the game quit, (it's a horror element, and very brief 4th wall breaking.) the player who inserts that name will expect this to happen, as it's a reference to another game (a fun easter egg). After the game quits, if the player tries opening the game, it will pick up exactly where it left off, with some dialogue about confusion and whatnot. The main menu doesn't disappear forever afterwards! It's just this one instance. Your points about multiple players makes sense, but it hopefully wouldn't be an issue in this case
Last edited by nairi_0 on Mon Apr 08, 2024 4:31 pm, edited 1 time in total.

left_sock
Newbie
Posts: 1
Joined: Mon Apr 08, 2024 4:11 pm
Contact:

Re: How to have the game skip main menu conditionally

#5 Post by left_sock »

Hello! did anyone find the answer to this? I'm also having the same problem :\

nairi_0
Newbie
Posts: 5
Joined: Wed Oct 04, 2023 1:40 pm
Contact:

Re: How to have the game skip main menu conditionally

#6 Post by nairi_0 »

left_sock wrote: Mon Apr 08, 2024 4:12 pm Hello! did anyone find the answer to this? I'm also having the same problem :\
Yes!! it's solved in viewtopic.php?p=566526#p566526 here!

Post Reply

Who is online

Users browsing this forum: Andredron, Google [Bot]