screens and layers
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.
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.
-
- Regular
- Posts: 159
- Joined: Wed May 09, 2012 2:49 am
- Projects: The Diviner
- Organization: Two Crowns Entertainment
- Location: Now: Charlottesville, VA
- Contact:
screens and layers
I know you can show a screen on a predefined layer with renpy.show_screen, but is there a kosher, screen-language friendly way of setting a specific screen's default layer? I'd like to have some screen-based UI stuff appear behind the master layer. I know I can move the master layer forward, but then things like the normal menu screens show up behind all the show statements, too, and it's rather messy.
short version: how do I tell a screen to always show up on a specific (possibly custom) layer?
short version: how do I tell a screen to always show up on a specific (possibly custom) layer?
The more you know
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: screens and layers
The only way you can really do this is by creating a proxy screen to show the real screen on a different layer.
something like
You can't change the default layer target of show.
something like
Code: Select all
screen myscreen:
on "show" action Show("myscreen_real", _layer="special")
on "hide" action Hide("myscreen_real", _layer="special")
-
- Regular
- Posts: 159
- Joined: Wed May 09, 2012 2:49 am
- Projects: The Diviner
- Organization: Two Crowns Entertainment
- Location: Now: Charlottesville, VA
- Contact:
Re: screens and layers
Hm, that is tricky. The screen I'm wanting to re-assign is the nvl screen. I suppose the only way to make that work would be to move all of the logic in the nvl screen into a custom one and change the actual nvl screen to that bit, huh?
Code: Select all
on "show" action Show("nvl_proxy", _layer="special")
The more you know
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: screens and layers
Yeah, although you'll have to pass everything that screen needs across too.
-
- Regular
- Posts: 159
- Joined: Wed May 09, 2012 2:49 am
- Projects: The Diviner
- Organization: Two Crowns Entertainment
- Location: Now: Charlottesville, VA
- Contact:
Re: screens and layers
Okay. I've never quite done anything like that in RenPy before, so before I break everything for everyone else in the project to figure it out, I'll just ask. To do that I would have to do something like this, then:
Or, being one of the primary screens of RenPy, will it be more complicated than just that?
Code: Select all
screen nvl: ##this is what the nvl_screen RenPy function will call
on "show" action Show("nvl_proxy", dialog, items, _layer="special")
on "hide" action Hide("nvl_proxy", _layer="special")
screen nvl_proxy:
window:
style "nvl_window"
#text part
has vbox:
style "nvl_vbox"
# Display dialogue.
for who, what, who_id, what_id, window_id in dialogue:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
# Display a menu, if given.
if items:
vbox:
id "menu"
yalign 1.0
for caption, action, chosen in items:
if action:
button:
style "nvl_menu_choice_button"
action action
text caption style "nvl_menu_choice"
else:
text caption style "nvl_dialogue"
#image window
window:
style "nvl_image_window"
xalign 1.0
add SideImage() xalign 0.0 yalign 1.0
use quick_menu
use tab_menu_main
The more you know
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: screens and layers
dialogue=dialogue, items=items
Also renpy expects the screen it calls to produce the window, who and what elements, so I don't know if this trick will even be allowed. It's beyond me how you'd do this otherwise, though.
Also renpy expects the screen it calls to produce the window, who and what elements, so I don't know if this trick will even be allowed. It's beyond me how you'd do this otherwise, though.
-
- Regular
- Posts: 159
- Joined: Wed May 09, 2012 2:49 am
- Projects: The Diviner
- Organization: Two Crowns Entertainment
- Location: Now: Charlottesville, VA
- Contact:
Re: screens and layers
It's more than I knew 5 minutes ago, so thank you. I'll give it a try and we'll see what happens.
The more you know
-
- Regular
- Posts: 159
- Joined: Wed May 09, 2012 2:49 am
- Projects: The Diviner
- Organization: Two Crowns Entertainment
- Location: Now: Charlottesville, VA
- Contact:
Re: screens and layers
Result:
"Error: Say (or Show) statement must return text object," or something to that effect.
Though I figured out a partial solution using ui.layer('special'). I can't wrap the entire nvl screen in it, or the menu doesn't display, but if I wrap only the half I expect to use images in ui.layer()/ui.close(), it seems to work. If anyone knows how I can make the menu show up with the whole thing between ui.layer()/ui.close(), that would be awesome.
"Error: Say (or Show) statement must return text object," or something to that effect.
Though I figured out a partial solution using ui.layer('special'). I can't wrap the entire nvl screen in it, or the menu doesn't display, but if I wrap only the half I expect to use images in ui.layer()/ui.close(), it seems to work. If anyone knows how I can make the menu show up with the whole thing between ui.layer()/ui.close(), that would be awesome.
The more you know
Re: screens and layers
You probably already know this but you could try playing with zorder of all the screens
I think you can have a negative zorder value as well, but I'm not sure.
screens with higher zorder appear on top of screens with lower zorder, it may be easier and faster than playing with renpy layers.
But I assume that's not what you are looking for?
I think you can have a negative zorder value as well, but I'm not sure.
screens with higher zorder appear on top of screens with lower zorder, it may be easier and faster than playing with renpy layers.
But I assume that's not what you are looking for?
-
- Regular
- Posts: 159
- Joined: Wed May 09, 2012 2:49 am
- Projects: The Diviner
- Organization: Two Crowns Entertainment
- Location: Now: Charlottesville, VA
- Contact:
Re: screens and layers
It's certainly not a bad suggestion, but it's not quite what I was looking for. In particular I needed to keep certain elements on the master layer so as not to mess with the semantics of show statements too much. Everything outside of this particular issue, however, I can just use zorders, though.
The more you know
Who is online
Users browsing this forum: Google [Bot]