"return" to specific label?

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
Milkymalk
Miko-Class Veteran
Posts: 755
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

"return" to specific label?

#1 Post by Milkymalk »

Is there a way to use the "return" statement to return not to the point where the label was called, but to any other label? Alternatively, is there a way to remove the last call from the stack so I can just "jump" where I want to be?

Otherwise I need to use variables and do strange checks after the "call" statement, which I would like to avoid.

The reason why I don't use an ordinary "jump" in the first place is that the player can be sent from various places to various places and not all of them return to the exact point where the player came from.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2406
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: "return" to specific label?

#2 Post by Ocelot »

Code: Select all

label start:
    call second

label second
    $ renpy.pop_call()
    jump ending

label ending:
    return
https://www.renpy.org/doc/html/other.ht ... y.pop_call
< < insert Rick Cook quote here > >

User avatar
Milkymalk
Miko-Class Veteran
Posts: 755
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: "return" to specific label?

#3 Post by Milkymalk »

Oh, thank you, that's handy!
I've been absent for a while so I probably missed a lot of little additions.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: Milkymalk