Jumping back to label from which screen was called (SOLVED)

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
meiri
Regular
Posts: 177
Joined: Wed Jun 25, 2014 6:21 pm
Projects: Tutor Tabitha, Movement
Organization: Blue Bottlecap Games
Location: East Coast, US
Contact:

Jumping back to label from which screen was called (SOLVED)

#1 Post by meiri »

Alright, so I'm going to be reusing a screen several times during my VN, and obviously the screen will be called from a different label each time. But each time I call the screen, and the player clicks a certain button, I want them to be able to jump back to the label from where the screen was called that specific time.

I wrote a mockup code of what I'm trying to do here.

Code: Select all

screen jumpback: 
    textbutton "Back to label" xalign 0.5 yalign 0.5 action # ... and here is where i am confused.


label start:

    "Alright..."
    "Let's go to a screen!" 
    
    $ renpy.call_screen("jumpback")
    
    # when the user clicks the textbutton in screen jumpback, ideally, they would come back here.
    
    "Now that you've clicked the text button, we're back to this point!"
    
    jump start2
    
label start2:
    
    "Let's do this one more time...."
    "To screen jumpback we go!"
    
    $ renpy.call_screen("jumpback")
    
    # Now here we are, in a DIFFERENT label, and I once the user clicks 'Back to label' textbutton, they come back to this spot, not the spot in label start.
    
    "Great job of clicking that textbutton! We're back to this label.."
    
    return
As you can see, I don't really know what action to use, or if this is really even possible. I feel like maybe Return() would work but it might not nor I am sure how to go about it. If there's no way to do it in the way I'm thinking, I'm of course open to any alternatives. :)
Thanks in advance.
Last edited by meiri on Fri Oct 24, 2014 5:11 pm, edited 1 time in total.
What's in a loop? A loop iterated in any other way would output as sweet.
--
Have a look at my GxG kinetic novel, Movement, if you have the chance?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Jumping back to a label from which a screen was called

#2 Post by xela »

What happens if you just hide the screen?
Like what we're doing? Support us at:
Image

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

Re: Jumping back to a label from which a screen was called

#3 Post by Alex »

When you call a screen, the game stops at this point, player will be forced to interact with the screen untill it will return anything, then the game will continue, so the action should be Return("some_value").
If you need this value, you can store it like

Code: Select all

$ renpy.call_screen("jumpback")
$ x = _return
or

Code: Select all

$ x = renpy.call_screen("jumpback")

User avatar
meiri
Regular
Posts: 177
Joined: Wed Jun 25, 2014 6:21 pm
Projects: Tutor Tabitha, Movement
Organization: Blue Bottlecap Games
Location: East Coast, US
Contact:

Re: Jumping back to a label from which a screen was called

#4 Post by meiri »

xela wrote:What happens if you just hide the screen?
Well, for what I am actually trying to do, I have several screens layered on top of each other, and when I tried to hide them all at once, it gave me an error saying it can only take 3 parameters, not 6.
Alex wrote:When you call a screen, the game stops at this point, player will be forced to interact with the screen untill it will return anything, then the game will continue, so the action should be Return("some_value").
If you need this value, you can store it like

Code: Select all

$ renpy.call_screen("jumpback")
$ x = _return
or

Code: Select all

$ x = renpy.call_screen("jumpback")
This worked perfectly! Thanks.
What's in a loop? A loop iterated in any other way would output as sweet.
--
Have a look at my GxG kinetic novel, Movement, if you have the chance?

Post Reply

Who is online

Users browsing this forum: bananamilk, Majestic-12 [Bot]