Navigation screen, hiding overlays and moving namebox

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
Veniae
Veteran
Posts: 461
Joined: Sun Mar 06, 2011 9:01 am
Contact:

Navigation screen, hiding overlays and moving namebox

#1 Post by Veniae »

Hi guys! I realise I seek help far too often, but programming always manages to come up with a way to completely stun me. So, if anyone who actually knows what they're doing gives me a hand, I'll be very grateful.

Here are the issues I'm currently grappling with:

1. I have created an imagemap Navigation screen, but when I try to use it with "use navigation" in the Save/Load screen, nothing happens.

Here's my code:

Code: Select all

screen navigation:

    # The background of the game menu.
    window:
        style "gm_root"

    # The various buttons.
    imagemap:
        ground "menus/nav_ground1.png"
        idle "menus/navigation_idle1.png"
        hover "menus/navigation_hover1.png"
        
        hotspot (591, 355, 84, 28) action Return()
        hotspot (584, 406, 96, 26) action ShowMenu("save")
        hotspot (586, 433, 93, 22) action ShowMenu("load")
        hotspot (588, 385, 88, 22) action ShowMenu("preferences")
        hotspot (585, 456, 95, 26) action MainMenu()
        hotspot (599, 506, 64, 25) action Quit()

init -2 python:
    style.gm_nav_button.size_group = "gm_nav"
It works just fine in the Preferences screen, where my code doesn't look different than in the Save/Load:

Code: Select all

screen preferences:

    tag menu 
    use navigation
Could it be because the Prefs are an imagemap, while the Save/Load (still) isn't? How do I get the Navigation to appear there as well?

2. I created a bar with buttons that appears next to the textbox in-game using this code:

Code: Select all

    def button_game_menu():
                
        global show_button_game_menu
        if show_button_game_menu:
             ui.vbox(xpos=0.86, ypos=0.78, focus_mask=True)
             ui.imagebutton("menus/skip button idle1.png", "menus/skip button hover1.png", clicked=toggle_skipping, focus_mask=True)
             ui.imagebutton("menus/save button idle1.png", "menus/save button hover1.png", clicked=ccinc("_game_menu_save"), focus_mask=True)
             ui.imagebutton("menus/load button idle1.png", "menus/load button hover1.png", clicked=ccinc("_game_menu_load"), focus_mask=True)
             ui.imagebutton("menus/quit button idle1.png", "menus/quit button hover1.png", clicked=Quit(), focus_mask=True)
             ui.close()
                              
    config.window_overlay_functions.append(button_game_menu)
It works just fine, but the problem is that it won't disappear on the Yes/No prompt screen. When I press the "Quit" button from said bar, it takes me to the corresponding Yes/No prompt, but the whole bar stays. It only happens with this button, the other Yes/No prompts are fine.

I have the same problem with the overlay I'm using to display the date in-game.

Code: Select all

init:
    $ date = False

    python hide:
        def date_overlay():
            if date:
                ui.text(date,
                         xpos=0.785, xanchor="left",
                         ypos=0.015, yanchor="top")

        config.overlay_functions.append(date_overlay)
I tried hiding it using "$ date = None", but it won't budge. Again, that's only when I press the "Quit" button from the textbox bar.

3. How would you recommend that I move the namebox to the right only for a certain character? The MC has a side image and it comes on top of said namebox.

All right, I think that was everything I meant to ask. Apologies for the gigantic post, I really hope that will be the last time I'll have to bother you guys with GUI problems. Thanks in advance for your help!

User avatar
Chrizine
Regular
Posts: 178
Joined: Fri Nov 26, 2010 1:47 pm
Projects: Perios - Chained Sorceress (WIP), Sword vs. Staff (WIP)
Organization: Motdl Productions
Location: Currently Switzerland
Contact:

Re: Navigation screen, hiding overlays and moving namebox

#2 Post by Chrizine »

I fear I'm not much of help, but I might give you an idea what to look into for your third question:
You can add some style properties in the character definition. Since I don't use a namebox, I'm not sure which properties exactly you have to tweak, but I think there must be some doing it.
For example, I have some special characters where I don't use a side image and therefore I changed the padding and the textbox image in the character definition:

Code: Select all

n = Character(None, show_noMC = True, window_background = source.textbox_no_mc, window_yminimum = 155, window_left_padding = 30, window_top_padding = 25)
In options.rpy, you set the defaults for these properties like this:

Code: Select all

    ## Padding is space inside the window, where the background is
    ## drawn.

    style.window.left_padding = 245
    style.window.right_padding = 30
    style.window.top_padding = 120
    style.window.bottom_padding = 10
It seemed to me that to add specific values for these to a character you just have to leave the style. in the beginning out and put a _ instead of a . after the window - so far it has worked for me :D
So if you know how to generally move the namebox using the style properties in options.rpy, you can do it for certain characters as well :)
I hope this helps at least a bit...
Take a look at Perios - Chained Sorceress!
And also on Sword vs. Staff, my short new project...
And, of course, our blog!
Honest Critique

Veniae
Veteran
Posts: 461
Joined: Sun Mar 06, 2011 9:01 am
Contact:

Re: Navigation screen, hiding overlays and moving namebox

#3 Post by Veniae »

Hmm, yes, that's a good idea. I actually thought about that too, but I wasn't sure how exactly to handle it. With your tips, I should now be able to! Thanks a bunch!

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]