[SOLVED] - When do you actually use a call or show for 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
johnstag123
Newbie
Posts: 14
Joined: Mon Dec 02, 2013 7:27 am
Contact:

[SOLVED] - When do you actually use a call or show for screen

#1 Post by johnstag123 » Mon Apr 02, 2018 1:10 pm

I've been reading through the renpy documentation and I'm trying to learn screen language. I've encountered in the Screen Actions, Values, and Functions documentation the call and show control actions.

Call(label, *args, **kwargs)
- Ends the current statement, and calls label. Arguments and keyword arguments are passed to renpy.call().


Show(screen, transition=None, *args, **kwargs)
- This causes another screen to be shown. screen is a string giving the name of the screen. The arguments are passed to the screen being shown.If not None, transition is use to show the new screen.
Likewise, the pythonic way would be by using the renpy.call_screen() or renpy.show_screen

So here is a basic question when do you use the (screen) call and show. I'm at a loss as to which to use since sometimes I would show a screen and sometimes I would call a screen but I can't really deferentiate the two. I've read somewhere that call is used if something is returned but I don't even understand what should be returned and how that return would function? If possible can you provide a simple screen code snippet with some explanation since I can better understand it in that manner :lol: Thanks in advance.
Last edited by johnstag123 on Tue Apr 03, 2018 4:11 pm, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 752
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: NOOB HELP - When do you actually use a call or show for screen

#2 Post by Milkymalk » Mon Apr 02, 2018 2:26 pm

When you show a screen:
- it appears
- it stays there until you hide it
- the game carries on while the screen is visible

When you call a screen:
- it appears
- it stays there until you use the Return() action or an equivalent way of returning a value
- the game script waits until the above happens

When you use the Return action, for example Return(5), the value 5 is returned and saved in the variable _return, which you can then use.

For example:

Code: Select all

label start:
    call screen selection
    eileen "You selected [_return]."
    return
    
screen selection:
    textbutton "Yes" xpos 100 ypos 100 action Return('Yes')
    textbutton "No" xpos 100 ypos 150 action Return('No')
    textbutton "Maybe" xpos 100 ypos 200 action Return('Maybe')    
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
johnstag123
Newbie
Posts: 14
Joined: Mon Dec 02, 2013 7:27 am
Contact:

Re: NOOB HELP - When do you actually use a call or show for screen

#3 Post by johnstag123 » Tue Apr 03, 2018 10:41 am

Milkymalk wrote:
Mon Apr 02, 2018 2:26 pm
When you call a screen:
- it appears
- it stays there until you use the Return() action or an equivalent way of returning a value
- the game script waits until the above happens
Oh that makes a lot of sense :lol: Thank you I understand it better than what was written in the documentation. So I take it that if you call a screen it is expected that at least a return is eventually called but what happens if you didn't return? Would that raise any error? Also what happens if I call multiple screens, not show, without returning any of them? Thanks in advance. I don't have my laptop at the moment so I can't test it out.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 752
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: NOOB HELP - When do you actually use a call or show for screen

#4 Post by Milkymalk » Tue Apr 03, 2018 12:54 pm

A screen call starts an interaction during which you can't start another interaction. If you call a screen and from that screen call another screen, you will get an error.

If you need another screen while in a call screen, you can show it and set it to "modal True" (preventing any interaction with screens below), but you can't get a return value from it. If you "return" from the second screen, the interaction will end and the called screen will close.

I'm not sure how you can transfer a value from the second screen to the original called screen. You probably have to take a detour by using global variables.

If you don't return from the called screen, that screen will stay and the script won't advance.
Last edited by Milkymalk on Tue Apr 03, 2018 4:18 pm, edited 1 time in total.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
johnstag123
Newbie
Posts: 14
Joined: Mon Dec 02, 2013 7:27 am
Contact:

Re: NOOB HELP - When do you actually use a call or show for screen

#5 Post by johnstag123 » Tue Apr 03, 2018 4:10 pm

I see so since a call would begin an interaction calling another screen would be trying to call an interaction while in the middle of an interaction and based on what you said that would cause some kind of error. So the way to go is by show instead of call for a screen whilst inside another screen but you wont be able to return anything from the second screen. Thanks I get it now :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]