Anyone know how to put screens on top of each other?[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
Panda_nui
Regular
Posts: 44
Joined: Mon Jul 02, 2012 10:48 am
Projects: re:_night
Location: in your closet
Contact:

Anyone know how to put screens on top of each other?[SOLVED]

#1 Post by Panda_nui » Mon Jul 09, 2012 6:34 pm

I'm completely new to Renpy programming, but I've somehow managed to get most of my work done by using and searching the wiki forums haha///.
I've searched everywhere but I couldn't manage to find a solution for this problem ;v;
So my problem is that I want to have a custom yes/no prompt screen that looks something like a pop-up box, so the back of it is transparent.
when you click exit, you can still see the background image, which works in most cases

Like so:
Image

but then, whenever I try to exit from a screen like the main menu or the save/load, this is what I get
Image
The image just disappears...

And here's a copy of the code if it helps

Code: Select all

screen yesno_prompt:

    modal True

    imagemap:
        ground "gui/yesno_ground.png"
        hover "gui/yesno_hover.png"
        idle "gui/yesno_idle.png"
        
        hotspot (224,323,125,41) action yes_action
        hotspot (450,323,125,41) action no_action
        
        label _(message):
            text_style "yesno_prompt_text"
            xalign 0.5
            yalign 0.415
            
init -2 python:    
    style.yesno_button.size_group = "yesno"
    style.yesno_label_text.text_align = 0.5
    style.yesno_prompt_text.color = "#FF00BB"
    style.yesno_prompt_text.size = 22 
Does anybody know how to fix this? Any help will be greatly appreciated! >////<
Last edited by Panda_nui on Tue Jul 10, 2012 2:58 am, edited 1 time in total.

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Does anyone know how to put screens on top of each other

#2 Post by Levrex » Mon Jul 09, 2012 7:46 pm

There's two ways to solve this.

1) Set config.developer (found in options.rpy) to False.
Though the background will still change (to black, which is default color), but it's better than transparent square tiles.

2) Add

Code: Select all

window:
        style "gm_root"
to screen yesno_prompt. "gm_root" is found in options.rpy. You can also use "mm_root" or whatever, as long as you have it in your theme dictionary defined. Well, the yes/no image will be the same every time, but that's better than transparent square tiles. Please take note that the game will use a transition each time going to yesno_prompt screen without clicking a button, if you defined those transitions in options.rpy (config.enter_transition, for example).
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
Panda_nui
Regular
Posts: 44
Joined: Mon Jul 02, 2012 10:48 am
Projects: re:_night
Location: in your closet
Contact:

Re: Does anyone know how to put screens on top of each other

#3 Post by Panda_nui » Mon Jul 09, 2012 8:26 pm

Yes, I know how to do that, but that isn't what I want.
What I want to appear is the background of my main menu, which is an imagemap, or whichever screen it should be appearing on top of, to show instead of those transparent tiles.
thanks for replying though ;;


Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Does anyone know how to put screens on top of each other

#5 Post by Levrex » Tue Jul 10, 2012 12:08 am

Panda_nui wrote:Yes, I know how to do that, but that isn't what I want.
What I want to appear is the background of my main menu, which is an imagemap, or whichever screen it should be appearing on top of, to show instead of those transparent tiles.
Ah, ok then.
All thanks goes to Dai-Sukima-Dan, because this is the code i borrowed from Touhou Mecha 1.1.

First, make sure that your yes/no prompt screen does not have a background (i mean "window" part of the screen), otherwise it'll appear not as you want to.
Second, add this to yes/no prompt screen.

Code: Select all

# Block key actions associated with the dialogue box
    key "rollback" action NullAction()
    key "rollforward" action NullAction()
    key "hide_windows" action NullAction()
    key "toggle_skip" action NullAction()
Else you'll find troubles while trying to quit while in say screen.

And finally add this to options.rpy (slightly edited):

Code: Select all

    def custom_quit():
            Quit()()
    config.quit_action = custom_quit
That will keep everything on screen.
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
Panda_nui
Regular
Posts: 44
Joined: Mon Jul 02, 2012 10:48 am
Projects: re:_night
Location: in your closet
Contact:

Re: Does anyone know how to put screens on top of each other

#6 Post by Panda_nui » Tue Jul 10, 2012 2:54 am

@ Levrex
ahhh/// I finally got it working thanks to you!
Thank you so much!!
I really appreciate your help >//< <33

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: Anyone know how to put screens on top of each other?[SOL

#7 Post by SleepKirby » Thu Jul 12, 2012 6:41 pm

I was just looking at the other thread about quit prompts and was wondering how to solve it. I completely forgot about that code I wrote for Touhou Mecha, lol. >_> Nice.

A clarification on that code - config.quit_action allows you to customize what happens when you click that upper-right red X button (in Windows, it may look different on other OSes) to close the game window. I wasn't sure why the default config.quit_action made the other screens disappear, but I just over-rode that behavior by setting config.quit_action to the screen action Quit, which I know doesn't make the other screens disappear.

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: Anyone know how to put screens on top of each other?[SOL

#8 Post by Levrex » Fri Jul 13, 2012 11:16 am

SleepKirby wrote:I was just looking at the other thread about quit prompts and was wondering how to solve it. I completely forgot about that code I wrote for Touhou Mecha, lol. >_> Nice.
I appreciate your game for it having lots of unique code and solutions, which are helping me a lot in porting a game.
And it is quite enjoyable, well, if you don't pay attention to Orin's face. And, i guess, some transitions while switching characters' expressions would do.
The cave battle was really something. A movie, and a spectacular one.

When Chapter 2 will be out, if that's not a secret?

===

Oh, and by the way, Panda_nui, you need to define the NullAction() first, in "init python" block, if you're going to use "NullAction()".

Code: Select all

class NullAction(Action):
        def __call__(self):
            pass
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
Panda_nui
Regular
Posts: 44
Joined: Mon Jul 02, 2012 10:48 am
Projects: re:_night
Location: in your closet
Contact:

Re: Anyone know how to put screens on top of each other?[SOL

#9 Post by Panda_nui » Sun Jul 15, 2012 12:36 am

Levrex wrote: Oh, and by the way, Panda_nui, you need to define the NullAction() first, in "init python" block, if you're going to use "NullAction()".
ah yes, I already figured that out haha///
but seriously, thank you so much ;v; <333

Post Reply

Who is online

Users browsing this forum: Google [Bot]