Jumping back to the intro instead of the 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.
Post Reply
Message
Author
User avatar
chesarty
Regular
Posts: 116
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Contact:

Jumping back to the intro instead of the main menu?

#1 Post by chesarty »

Hello again. I have this little issue where every time I click back to the main menu or finish playing the game, instead of just showing me the menu the game goes to the intro I have (a warning screen and a screen where you can input your name. I will be also adding a logo and an intro so those would also probably play...)

This is kind of annoying so is there a way to make it not loop from the very beginning?

Here is the start of my game:

Code: Select all

label before_main_menu:
    n"The game includes violence, crude language, gore and sexual content, and is not recommended for those
     under the age of 16 or for the weak-minded. By clicking 'NEXT' you understand this and proceed with caution."
    
    
    show popup
    $ player_name = renpy.input("")    
    $ player_name = player_name.strip()
    $ you.name = player_name.capitalize()

    if player_name == "":
        $ player_name="MC"
    hide popup with fade
        #play intro here
        
label main_menu:
    call screen main_menu
label restart:
    call screen confirm (message = u "Restart?", yes_action = Start(), no_action = Jump("main_menu"))



label start:
I even intentionally put

Code: Select all

call main_menu
instead of

Code: Select all

return
at the very end of my script to prevent this from happening, but it loops no matter what :/

User avatar
bonnie_641
Regular
Posts: 133
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: Jumping back to the intro instead of the main menu?

#2 Post by bonnie_641 »

Try this one:

Code: Select all

#variables
#(...)
#-------

#code intro
label splashscreen:
#(...)

#-----------
label start:
# More code here....

#------------

label final:
    "This is the end. Goodbye."

    # Reset splashscreen label game
    $ renpy.full_restart(transition=False, label='splashscreen', target='_splashscreen') #<----this line

I tried this function.
I hope it works for you.
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

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

Re: Jumping back to the intro instead of the main menu?

#3 Post by Imperf3kt »

Calling things like that isn't advised, I suspect it's the cause of your issue (you must "return" from a call, unlike a jump). The main menu isn't a regular screen either, it exists in a different context, so calling it like that will not fix your issue, rather it will compound it.

If you just want to brute force your way back to the main menu, add this to the end of your script (in place of a final "return")

https://www.renpy.org/doc/html/other.ht ... ll_restart
$renpy.full_restart()
Or alternatively
https://www.renpy.org/doc/html/screen_a ... l#MainMenu
$MainMenu()


Again, I strongly suggest using this as a last resort only and instead focus on finding the cause of the loop.


"main_menu" is on the reserved names index. As well as Main_Menu
https://www.renpy.org/doc/html/store_va ... -main_menu
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

User avatar
bonnie_641
Regular
Posts: 133
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: Jumping back to the intro instead of the main menu?

#4 Post by bonnie_641 »

I'm sorry, but it works on every project I have.

Alternative 1:

Code: Select all

$ renpy.full_restart(transition=False, label='splashscreen', target='_splashscreen')
Alternative 2:

Code: Select all

$ renpy.utter_restart()
Source: Plugin for Renpy in Sublime Text editor
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
chesarty
Regular
Posts: 116
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Contact:

Re: Jumping back to the intro instead of the main menu?

#5 Post by chesarty »

bonnie_641 wrote: Sat Aug 24, 2019 10:41 pm I'm sorry, but it works on every project I have.

Alternative 1:

Code: Select all

$ renpy.full_restart(transition=False, label='splashscreen', target='_splashscreen')
Alternative 2:

Code: Select all

$ renpy.utter_restart()
Source: Plugin for Renpy in Sublime Text editor
the problem is that those codes "fully restart" the game, which means it will automatically show the warning screen again, too...

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

Re: Jumping back to the intro instead of the main menu?

#6 Post by Imperf3kt »

chesarty wrote: Sun Aug 25, 2019 9:48 am
bonnie_641 wrote: Sat Aug 24, 2019 10:41 pm I'm sorry, but it works on every project I have.

Alternative 1:

Code: Select all

$ renpy.full_restart(transition=False, label='splashscreen', target='_splashscreen')
Alternative 2:

Code: Select all

$ renpy.utter_restart()
Source: Plugin for Renpy in Sublime Text editor
the problem is that those codes "fully restart" the game, which means it will automatically show the warning screen again, too...

This one doesn't
Imperf3kt wrote: Thu Aug 22, 2019 9:59 pm
https://www.renpy.org/doc/html/screen_a ... l#MainMenu
$MainMenu()
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

User avatar
chesarty
Regular
Posts: 116
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Contact:

Re: Jumping back to the intro instead of the main menu?

#7 Post by chesarty »

[/quote]

the problem is that those codes "fully restart" the game, which means it will automatically show the warning screen again, too...
[/quote]


This one doesn't
Imperf3kt wrote: Thu Aug 22, 2019 9:59 pm
https://www.renpy.org/doc/html/screen_a ... l#MainMenu
$MainMenu()
[/quote]

Oof, that's the one I'm currently using and yes, it does go through the before_main_menu label :(

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: Jumping back to the intro instead of the main menu?

#8 Post by isobellesophia »

chesarty wrote: Mon Aug 26, 2019 4:13 am
the problem is that those codes "fully restart" the game, which means it will automatically show the warning screen again, too...

Oof, that's the one I'm currently using and yes, it does go through the before_main_menu label :(

Code: Select all

label main_menu: 
call screen before_main_menu 

label restart: call screen confirm (message = u "Restart?", yes_action = Start(), no_action Jump("before_main_menu"))
For what i see, main_menu will be called as you restart and it will cause a infinite loop, try this one, so lets see if it works now.
I am a friendly user, please respect and have a good day.


Image

Image


Post Reply

Who is online

Users browsing this forum: Google [Bot]