Ren'py how do I jump to bottom most stack for Return()?

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
wraithseeker
Newbie
Posts: 18
Joined: Sat Nov 21, 2015 8:10 am
Github: wraithseeker
Contact:

Ren'py how do I jump to bottom most stack for Return()?

#1 Post by wraithseeker »

I am calling a screen "side_nav" from a label and from "side_nav", I am calling "task" screen on top of it.

I want to return to the bottom stack which is to my label instead of having to click the button with action Return() two times to return to the label. I tried using Jump() as well but it messes up the Rollback functionality of Ren'py.

The current navigation stack looks like this.

1. label
2. "side_nav" screen
3. "task" screen


I want it to go from 3 => to 1 instead of 3 => 2 => 1

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Ren'py how do I jump to bottom most stack for Return()?

#2 Post by Alex »

Why do you call screens in the first place? You can set the modal property of a screen to True to force player interact with this screen only, and in your "task" screen you can add an action to hide "side_nav" screen.
https://www.renpy.org/doc/html/screens. ... -statement
Will this construction suit for you?

Code: Select all

screen side_nav:
    modal True
    frame:
        maximum (200, 200)
        minimum (200, 200)
        align (0.05, 0.5)
        vbox:
            xfill True
            align (0.5, 0.5)
            textbutton "tasks" action Show("tasks")
            null height 20
            textbutton "close" action [Hide ("side_nav"), Return()]    # the Return() action will make game progress to next sentence without player's click
            
screen tasks:
    modal True
    frame:
        maximum (200, 200)
        minimum (200, 200)
        align (0.95, 0.5)
        vbox:
            xfill True
            align (0.5, 0.5)
            textbutton "Task 1" action [SetVariable("task", "Task 1"), Hide("tasks"), Hide("side_nav"), Return()]  
            null height 20
            textbutton "Task 2" action [SetVariable("task", "Task 2"), Hide("tasks"), Hide("side_nav"), Return()]
            
# The game starts here.
label start:
    $ task = "None"
    "..."
    show screen side_nav
    "?"
    "Task - [task]"
    "..."

Post Reply

Who is online

Users browsing this forum: Google [Bot], kedta35