Going back from a menu to where you've last left off

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
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Going back from a menu to where you've last left off

#1 Post by Praeliumm »

What I'm aiming for is to have a menu that's available at certain points but I want it to go back to the previous screen instead of needing to choose a certain label to go back to every time

This is what I have so far and it doesn't really work for me

Code: Select all

        vbox: 
            textbutton "Continue" action [Hide("home"), Hide ("menu"), Return()]
Originally it was this

Code: Select all

        vbox: 
            textbutton "Continue" action [Hide("home"), Hide ("menu"), Jump("statis")]
If I leave the code like this, it'll keep going back to the statis label, which is basically the intro

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Going back from a menu to where you've last left off

#2 Post by 78909087 »

What do you mean that it 'doesn't work out' for you?
Does it do the job? What is it that you're unsatisfied with?
I'm only familiar with Return() being able to return to a player's previous progress point. If choosing/inserting a label to where you want to return the player is closer to what you want from your code, why not use it? A little extra work isn't that bad.

I'm not sure what it is you're asking for.
I am not friends with the sun.
Image

User avatar
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Re: Going back from a menu to where you've last left off

#3 Post by Praeliumm »

What I meant was that all it did was hide the menu and textbuttons. It doesn't show any dialogue or anything, so no it doesn't exactly do the job I hoped for....

If there's no actual call to a previous scene, then that's fine though. I just wanted to know if there was an easier way

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Going back from a menu to where you've last left off

#4 Post by namastaii »

Return() should do what you're wanting, I believe. hmm. Do you need to hide 'home' and 'menu'? do they not go away with return() on it's own? what if you just hide the two without the return()? It'll probably be easier to help if I knew exactly what you were going for.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Going back from a menu to where you've last left off

#5 Post by trooper6 »

Are you talking about a menu like the regular menus you have in your text...or a custom screen with some button you've made yourself? There are different ways to achieve what you want based on what you are doing.

Could you provide more complete code so we can see what exactly you are trying to do?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Re: Going back from a menu to where you've last left off

#6 Post by Praeliumm »

namastaii wrote:Return() should do what you're wanting, I believe. hmm. Do you need to hide 'home' and 'menu'? do they not go away with return() on it's own? what if you just hide the two without the return()? It'll probably be easier to help if I knew exactly what you were going for.
Unfortunately it doesn't. When I took off the hide 'home' and 'menu', this is what it looked like
Image

And likewise here, when it appears a second time
Image
When I add hide 'home' and 'menu', it disappears after you press continue.
However, when I do hit continue, it goes back to the first time it appears (in picture 1) instead of continuing the story or even going to the previous label or choice menu

Here's the code for the menu

Code: Select all

screen home:
    tag menu2
    
    frame:
        style_group "home"
        xalign 1.0
        yalign 0.84
        
        grid 4 1:
            transpose False
            textbutton "Stats" action Show("stats")
            textbutton "Talk" action Show("talk")
            textbutton "Codex" action ShowMenu("codex")
            textbutton "Info" action Show("info")
             
    frame:
        style_group "home2"
        xalign 1.0
        yalign 1.0
        vbox: 
            textbutton "Continue" action [Hide("home"), Hide ("menu"), Return()]
And this is the label for it

Code: Select all

label home:
    #scene bg default
    show screen home
    with dissolve
    $renpy.pause()
    
#    while True:
 #       $ result = ui.interact()

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Going back from a menu to where you've last left off

#7 Post by namastaii »

Sorry in advanced since I'm super tired and I may have a bad response and will realize it tomorrow when I'm more awake. But if I'm understanding correctly.. you should just be able to hide the screens with your 'continue' button and not really need a return to keep clicking through the story.

if it is showing the screen again after you try to continue, maybe it is somehow trying to start the scene from the beginning, which I don't see how or why with my tired mind right now lol

User avatar
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Re: Going back from a menu to where you've last left off

#8 Post by Praeliumm »

I got rid of Return() for the continue button, but it still does the same thing. When it appears after the first time, the Continue button acts as if it's appearing for the first time

Here's the code for the first time I show it.

Code: Select all

label home:
    #scene bg default
    show screen home
    with dissolve
    $renpy.pause()
    
#    while True: # This makes sure that we can toy with it without leaving the game.
 #       $ result = ui.interact()
    
    
label statis:
    scene filler
    with fade
    r "Phew!"
And this is the code that I put that allows for the menu to show up the second time

Code: Select all

    menu:
        r "What else should I do?"
        "Study":#wis+2
            jump friend
        "Explore" if explore1 == False: #Frn+0.5
            jump friend
        "Eat" if eat1 == False: #atk+0.5
            jump friend
        "Rest":
            call home

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Going back from a menu to where you've last left off

#9 Post by namastaii »

Hmm weird. I have a lot of stuff like this in my game so idk what could be wrong unless I'm missing something obvious. If you want, you could send me over the game file and I could see if I could look at it and fix it directly and send it back XD no idea

User avatar
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Re: Going back from a menu to where you've last left off

#10 Post by Praeliumm »

Sorry for the late reply! Got a little busy.... But here's a simplified version of the code I have (I hope this is alright!)

I've also noticed that the dialogue also moves on even if you click out of the menu button, which I don't really want happening either
Attachments
Sample-1.0-all.zip
(29.38 MiB) Downloaded 25 times

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Going back from a menu to where you've last left off

#11 Post by namastaii »

I fixed the clicking out of the menu thing. It will no longer continue the dialogue but with your version you sent me, the menu doesn't do anything else wrong that I can see. It shows, I click continue, and it hides the menu and continues. Was that the main problem is that it wouldn't hide or?

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Going back from a menu to where you've last left off

#12 Post by namastaii »

Just small changes:

Code: Select all

screen home:
    tag menu2
    modal True
    
    frame:
        style_group "home"
        xalign 1.0
        yalign 0.84
        
        grid 4 1:
            transpose False
            textbutton "Stats" action Show("stats")
            textbutton "Talk" #action Show("talk")
            textbutton "Codex" #action ShowMenu("codex")
            textbutton "Info" #action Show("info")
            

    
    frame:
        style_group "home2"
        xalign 1.0
        yalign 1.0
        vbox: 
            textbutton "Continue" action [Hide("home"), Hide ("menu"), Return()]
I added 'modal True' so that you can't click outside of the menu.
and instead of show screen, use call screen so that when the player uses the mouse scroll and goes back and forth between dialogue, it won't have the menu showing up in places it isn't meant to be.

Code: Select all


label home:
    label home:
    #scene bg default
    call screen home
    with dissolve
    $renpy.pause()

User avatar
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Re: Going back from a menu to where you've last left off

#13 Post by Praeliumm »

I inputted the code and it did fix the problem with clicking out of the menu thing! But the main problem remains. It's still in kind of a loop and doesn't advance.

Every time the menu is called, when I hit Continue, it still acts as if it was shown for the first time.
It's basically acting as if this code was inputted instead (which is not what I want)

Code: Select all

label home:
    scene bg default
    call screen home
    with dissolve
    $renpy.pause()

label statis:
    r "This is the first time that screen was called."

label parttwo:
    r "I'm gonna call the menu a second time."
    menu:
        r "What else should I do?"
        "Rest":
            jump statis

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Going back from a menu to where you've last left off

#14 Post by namastaii »

Hmm I'm not fully understanding what you mean D: lol

User avatar
Praeliumm
Newbie
Posts: 14
Joined: Sun Jun 05, 2016 12:40 am
Projects: The Executioner's Judgement
Tumblr: praeliumm
Contact:

Re: Going back from a menu to where you've last left off

#15 Post by Praeliumm »

It doesn't continue for me; instead it's stuck in a loop

Post Reply

Who is online

Users browsing this forum: No registered users