Make something appear above dialogue window (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
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Make something appear above dialogue window (SOLVED)

#1 Post by bimb2212 »

I use a slightly-complicated Digital Calendar, but when the calendar show, it appear behind the dialogue window. Anyone know how to make it move to the top first?
Last edited by bimb2212 on Thu Oct 30, 2014 11:18 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Make something appear above dialogue window.

#2 Post by Alex »

It would be better if you'd show your code to let people check what should be changed.

nintendotoad
Regular
Posts: 42
Joined: Sat Mar 31, 2012 2:56 pm
Location: projectexist.net
Contact:

Re: Make something appear above dialogue window.

#3 Post by nintendotoad »

I think OP may be using the Cookbook recipe.

http://www.renpy.org/wiki/renpy/doc/coo ... l_Calendar

def Calendar(): and def Clocks(): require a yalign change in their ui.frame statements.

ui.frame(xfill=False, xminimum = 110, yminimum=None, xalign=1.0, yalign = 0.76)

0.76 is worth changing.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
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: Make something appear above dialogue window.

#4 Post by Milkymalk »

That will change the position, but not the z-order.

The calender has to either get moved to a layer at least as high as the text box, or if it's on the same layer, be given a higher z-order.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Re: Make something appear above dialogue window.

#5 Post by bimb2212 »

Yeah, I don't know how to change the z-order when use def statement in init python. But I use a quick fix: remove the def Calendar(), def Clock(), ui, copy and change these codes that fit screen statement, and it appear in-front. For now, I only know that the dialogue box appears behind screen statement, but before define statement.

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Make something appear above dialogue window.

#6 Post by Alex »

The zorder is used when you show separate screens or displayables, but in this recipe calendar and clock are added into the say screen. The elements of a screen appears onscreen in the order you added them in your code. So if you added

Code: Select all

if(clock):
        $ Calendar()
        $ Clocks()
part right at the beginning of the say screen, then your calendar appeared first and then the whole textbox over it.

Just move this lines of code to the end of say screen code (right after "use quick_menu" line) to make calendar and clock appear on top of your textbox.

User avatar
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Re: Make something appear above dialogue window.

#7 Post by bimb2212 »

Alex wrote:The zorder is used when you show separate screens or displayables, but in this recipe calendar and clock are added into the say screen. The elements of a screen appears onscreen in the order you added them in your code. So if you added

Code: Select all

if(clock):
        $ Calendar()
        $ Clocks()
part right at the beginning of the say screen, then your calendar appeared first and then the whole textbox over it.

Just move this lines of code to the end of say screen code (right after "use quick_menu" line) to make calendar and clock appear on top of your textbox.
I moved them to end of say screen, and even move to quick menu screen, still the same problem. I think, for default, every def statement that called in screen, will appear behind the say box. :(

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Make something appear above dialogue window.

#8 Post by Alex »

Hm, it worked for me...
Show your code for say screen then (or upload the project to let people test it).

User avatar
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Re: Make something appear above dialogue window.

#9 Post by bimb2212 »

Alex wrote:Hm, it worked for me...
Show your code for say screen then (or upload the project to let people test it).
Sorry for slow reply, this is my say screen:

Code: Select all

screen say:
    default side_image = None
    window:
        id "window"
        has vbox:
            style "say_vbox"
        if who:
            text who id "who"
        text what id "what"     
    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0
    
    key "K_F1" action ShowMenu('help')
    key "K_F5" action QuickSave()
    key "K_F9" action QuickLoad()
    key "K_a" action [Preference("auto-forward", "toggle"), Play("sound", "sound/sfx/click.wav")]

    if show_game_hud0:
        use game_hud0
    if show_game_hud1:
        use game_hud1
    if show_game_hud2:
        use game_hud2
    if show_game_hud3:
        use game_hud3
    if show_game_hud4:
        use game_hud4

init -2 python:
    show_game_hud0=False
    show_game_hud1=True
    show_game_hud2=False
    show_game_hud3=False
    show_game_hud4=False

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Make something appear above dialogue window.

#10 Post by Alex »

So, how do you show the calendar and clock then?
I was expecting to see something like:

Code: Select all

screen say:
    default side_image = None
    window:
        id "window"
        has vbox:
            style "say_vbox"
        if who:
            text who id "who"
        text what id "what"     
    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0
    
    key "K_F1" action ShowMenu('help')
    key "K_F5" action QuickSave()
    key "K_F9" action QuickLoad()
    key "K_a" action [Preference("auto-forward", "toggle"), Play("sound", "sound/sfx/click.wav")]

    if show_game_hud0:
        use game_hud0
    if show_game_hud1:
        use game_hud1
    if show_game_hud2:
        use game_hud2
    if show_game_hud3:
        use game_hud3
    if show_game_hud4:
        use game_hud4

    if(clock):
        $ Calendar()
        $ Clocks()

User avatar
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Re: Make something appear above dialogue window.

#11 Post by bimb2212 »

Alex wrote:So, how do you show the calendar and clock then?
I was expecting to see something like:
Ya, I place it at there, still appears behind the say box. Even I created fresh new renpy game, copy and paste code, the same result :(

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Make something appear above dialogue window.

#12 Post by Alex »

Well, interesting...
Could you attach the rpy-files of that fresh project to let me see this behaviour?

User avatar
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Re: Make something appear above dialogue window.

#13 Post by bimb2212 »

I mean that I press "create new project" in Ren'py, without touch anything about Eileen's welcome, then I paste the digital calendar code... I use lastest version of ren'py.
Testing.rar
(143.47 KiB) Downloaded 53 times

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Make something appear above dialogue window.

#14 Post by Alex »

Well, ok - this code worked in Ren'Py 6.16, but in 6.18 something has changed about using the layers. So for now you ought to specify the 'screens' layer as the layer to show your calendar and clock:

Code: Select all

    def Calendar():
        ui.layer('screens')     # <======= add this
        ui.frame(xfill=False, xminimum = 400, yminimum=None, xalign=1.0, yalign = 0.805)
        ui.vbox()
        ui.text("(%s) - %s %d %d" % (stringweekday, stringmonth, theday, theyear), xalign=1.0, size=20)
        ui.close()
        ui.close()     # <======= and this
        
    def Clocks():
        ui.layer('screens')     # <======= add this
        ui.frame(xfill=False, xminimum = 110, yminimum=None, xalign=1.0, yalign = 0.76)
        ui.vbox()
        if (minutes > 719):
            if ((minutes - (int(minutes/60))*60) < 10):
                if((int(minutes/60)) == 12):
                    ui.text("12:0%d PM" % ((minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
                else:
                    ui.text("%d:0%d PM" % ((int(minutes/60)-12), (minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
            else:
                if((int(minutes/60)) == 12):
                    ui.text("12:%d PM" % ((minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
                else:
                    ui.text("%d:%d PM" % ((int(minutes/60)-12), (minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
        else:
            if ((minutes - (int(minutes/60))*60) < 10):
                if((int(minutes/60)) == 0):
                    ui.text("12:0%d AM" % ((minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
                else:
                    ui.text("%d:0%d AM" % ((int(minutes/60)), (minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
            else:
                if((int(minutes/60)) == 0):
                    ui.text("12:%d AM" % ((minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
                else:
                    ui.text("%d:%d AM" % ((int(minutes/60)), (minutes - (int(minutes/60))*60)), xalign=1.0, size=20)
        ui.close()
        ui.close()     # <======= and this
This will make it work again.

User avatar
bimb2212
Newbie
Posts: 19
Joined: Wed Jul 30, 2014 10:15 am
Contact:

Re: Make something appear above dialogue window.

#15 Post by bimb2212 »

Woa, so if every def statement that I call with a frame in it, I need to specify the 'screens' layer to make it appear in front of the say screen. Thanks for your help!

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]