Screen inside a screen

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
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

Screen inside a screen

#1 Post by Lezalith » Tue Jul 12, 2016 8:01 pm

Hey people,
let's say you had a screen. Any screen.

Code: Select all

screen main:
    tag main_screen
    add "image" xpos 0.5 ypos 0.5
    text "Hi everyone!"
    screen Complicated
My question is about that last line. This doesn't seem to work (Not surprisingly). What I'm trying to do, I have a very complicated conditional branch.
Let's say this whole conditional branch would be about which bar is supposed to be used.

Code: Select all

screen Complicated:
    showif condition == 1:
        bar:
    showif condition == 2:
        bar:
    showif condition == 3:
        bar:
Now, of course, what I could do is basically

Code: Select all

screen main:
    tag main_screen
    add "image" xpos 0.5 ypos 0.5
    text "Hi everyone!"
    showif condition == 1:
        bar:
    showif condition == 2:
        bar:
    showif condition == 3:
        bar:
This would work without any problem. And with simple conditional branch like this, it's still not messy. But what if this conditional branch was long (and we're speaking dozens of lines long)?
What if I have stuff before this conditional branch (like the "add" and "text" statements) and I will have more stuff after the conditional branch?
What I want to do, I want to take that conditional branch OUTSIDE of that screen, so it's more organized, but when it comes to running the game, it is still there (Call it back somehow? "call screen" doesn't work as call is not valid statement for screen)

Thanks in advance!

User avatar
sashaaero
Regular
Posts: 45
Joined: Mon Jul 13, 2015 6:08 pm
Projects: Everlasting Cold
Organization: OverDream Development
Github: sashaaero
Skype: sashaaero
Contact:

Re: Screen inside a screen

#2 Post by sashaaero » Wed Jul 13, 2016 6:06 pm

Code: Select all

screen Complicated:
    blah-blah

screen main:
    tag main_screen
    add "image" xpos 0.5 ypos 0.5
    text "Hi everyone!"
    use Complicated

User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

Re: Screen inside a screen

#3 Post by Lezalith » Wed Jul 13, 2016 6:14 pm

Thanks!

Post Reply

Who is online

Users browsing this forum: Google [Bot], _ticlock_