Issues with a custom main menu

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.
Message
Author
Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Issues with a custom main menu

#1 Post by Adabelitoo » Wed Jan 08, 2020 10:25 pm

I'm trying to make a new main menu, using imagebuttons/imagemaps instead of the classic textbuttons but I'm having some issues with the usual options.

The most problematic thing so far is when I try to start the game. The first image the game shows me (once I start the game) is the one used for the splash screen instead of a black screen like it used to be (I never coded hat black screen, it just happened before and now it doesn't). Another problem is that the right click doesn't works, or at least it doesn't show the game/pause menu like before, so I can't save, load, go to the preferences, etc. Lastly the textbuttons from the quick bar never shows up.

Another problem with this new main menu is that Load, Preference, About and other screens never show up once I press their respective button, the only thing that shows is the name of it but nothing else, and those screen are pretty much untouched (maybe I changed something in the Load/Save screen but I don't remember, but the Preference screen is 100% untouched for sure)

Also I would like to know how the "if main_menu" condition works, because if I put those imagemaps/imagebuttons inside a "if main menu:" then those buttons won't show up either.

This is my code so far

Code: Select all

screen main_menu():
    ## This ensures that any other menu screen is replaced.
    tag menu
    add "gui/main_menu2.png"
    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation2 screen.
    use navigation

    if gui.show_name:

        vbox:
            text "[config.name!t]":
                style "main_menu_title"

            text "[config.version]":
                style "main_menu_version"
                
screen navigation():

    imagemap:
        idle "menu5 idle"
        hover "menu5 hover"

        #Start
        hotspot (190, 65, 242, 210):
             action Start()
             tooltip "Start"
        #Load
        hotspot (519, 65, 242, 210):
            action Show("load")
            tooltip "Load"
        #Config
        hotspot (850, 65, 242, 210):
            action Show("preferences")
            tooltip "Settings"
        #Information
        hotspot (354 ,310, 242, 210):
            action Show("about")
            tooltip "About the game"
        #Exit
        hotspot (683 ,310, 242, 210):
            action Show("quitconfirmscreen")
            tooltip "Exit the game"

    imagebutton:
        style "imagamap_buttons"
        idle "menu_blog idle"
        hover "menu_blog hover"
        action OpenURL("https://my.blogspot.com/")
        tooltip "Developer blog"
    imagebutton:
        style "imagamap_buttons"
        idle "menu_support idle"
        hover "menu_support hover"
        action ShowMenu("support")
        tooltip "Support the game"

    $ tooltip = GetTooltip()

    if GetTooltip() is not None:
        text GetTooltip() at pos_menu:
            style "menu_tooltip"
                
Thanks for reading.

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#2 Post by rayminator » Thu Jan 09, 2020 12:18 am

okay have tried it this way I believe that hotspot not suppose to have : with it

Code: Select all

hotspot (190, 65, 242, 210) action Start()     
    tooltip "Start"

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#3 Post by Adabelitoo » Thu Jan 09, 2020 12:28 am

I had to put both thing in the same line to avoid using the : or the game will show me a gray screen error, but it didn't work. I have the same problems.

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#4 Post by rayminator » Thu Jan 09, 2020 12:25 pm

ok I am using imagemap with my game that I am working

this part here think is wrong

Code: Select all

 idle "menu5 idle"
 hover "menu5 hover"
this is what I have in mine maybe this will help

Code: Select all

screen main_menu:
    tag menu
    imagemap:
            ground 'gui/main_menu.png'
            hover 'gui/main_menu_hover.png'

            hotspot (200, 350, 215, 30) action Start()
            hotspot (200, 405, 215, 30) action ShowMenu('load')
            hotspot (200, 460, 215, 40) action ShowMenu('gallery')
            hotspot (200, 523, 215, 40) action ShowMenu('preferences')
            hotspot (200, 580, 200, 190) action Quit(confirm=False)

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#5 Post by Adabelitoo » Thu Jan 09, 2020 1:09 pm

Nope, nothing changed.

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#6 Post by rayminator » Thu Jan 09, 2020 1:35 pm

can you make a small demo of it just create a new game and just copy the menu and upload the game folder so we can see what's happening

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#7 Post by Adabelitoo » Thu Jan 09, 2020 3:20 pm

Sure, here: https://mega.nz/#!K3hWSayB!d2voTwhP-WA7 ... 6JHRtvFYuU

I do have to warn you that this is a NSFW game, the game is pretty limited but it has the necessary things to showcase all the main_menu problems and you will found a few NSFW pics.

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#8 Post by rayminator » Thu Jan 09, 2020 3:59 pm

you will have to edit every page to work with your menu and make sure you change Show to ShowMenu and you will have a lot of adjustment you will need to do

find this and put # in front or remove it and then fix the indention from vbox back one space

Code: Select all

use game_menu(_("Configs"), scroll="viewport"):
here what it should look like

Code: Select all

screen preferences():

    tag menu
    add "gui/pref_menu.png"
    #use game_menu(_("Configs"), scroll="viewport"):

    vbox:

        hbox:
            box_wrap True

            if renpy.variant("pc"):

                vbox:
                    style_prefix "radio"
                    label _("Display")
                    textbutton _("Window") action Preference("display", "window")
                    textbutton _("Fullscreen") action Preference("display", "fullscreen")

                vbox:
                    style_prefix "radio"
                    label _("Rollback Side")
                    textbutton _("Disable") action Preference("rollback side", "disable")
                    textbutton _("Left") action Preference("rollback side", "left")
                    textbutton _("Right") action Preference("rollback side", "right")

                vbox:
                    style_prefix "check"
                    label _("Skip")
                    textbutton _("Unseen Text") action Preference("skip", "toggle")
                    textbutton _("After Choices") action Preference("after choices", "toggle")
                    textbutton _("Transitions") action InvertSelected(Preference("transitions", "toggle"))

                ## Additional vboxes of type "radio_pref" or "check_pref" can be
                ## added here, to add additional creator-defined preferences.

            null height (4 * gui.pref_spacing)

            hbox:
                style_prefix "slider"
                box_wrap True

                vbox:

                    label _("Text Speed")

                    bar value Preference("text speed")

                    label _("Auto-Forward Time")

                    bar value Preference("auto-forward time")

                vbox:

                    if config.has_music:
                        label _("Music Volume")

                        hbox:
                            bar value Preference("music volume")

                    if config.has_sound:

                        label _("Sound Volume")

                        hbox:
                            bar value Preference("sound volume")

                            if config.sample_sound:
                                textbutton _("Test") action Play("sound", config.sample_sound)


                    if config.has_voice:
                        label _("Voice Volume")

                        hbox:
                            bar value Preference("voice volume")

                            if config.sample_voice:
                                textbutton _("Test") action Play("voice", config.sample_voice)

                    if config.has_music or config.has_sound or config.has_voice:
                        null height gui.pref_spacing

                        textbutton _("Mute All"):
                            action Preference("all mute", "toggle")
                            style "mute_all_button"

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#9 Post by Adabelitoo » Thu Jan 09, 2020 4:24 pm

Thanks, it looks kinda weird but that managed to make the Load, Preferences and About screens to show up, I think I can fix it from there. The only problem now is starting the game.

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#10 Post by rayminator » Thu Jan 09, 2020 4:29 pm

the game starts fine for me only thing I notice that I can't press the esc or left click to bring up save screen

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#11 Post by Adabelitoo » Thu Jan 09, 2020 4:47 pm

Exactly, that's the problem, also it should show the quickbar once the game starts but it doesn't.

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#12 Post by rayminator » Thu Jan 09, 2020 6:10 pm

I can say that it's not the screen that's causing that I have replace with the default screens so it has be something in the other files you might have to back track from you previous build I have played you game in the past so it has to be something that you have added or changed

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#13 Post by Adabelitoo » Thu Jan 09, 2020 6:50 pm

Maybe it's because technically I'm not in the main menu anymore when I try to start the game? I remeber that using the box with the textbuttons used to work before.

I added that screen when you have to click before the main menu shows up, before it was the classic main menu after a classic splashscreen. Maybe I messed up something there? This is my code

This is on script.rpy

Code: Select all

label splashscreen:
    scene bg splash
    call screen age_confirmation

screen age_confirmation:
    vbox:
        text "{font=fonts/RobotoCondensed-Regular.ttf}{b}{u}{size=40}Warning:{/size}{/u}{/b}{/font}":
            xpos 550
            ypos 150
        text "This game contains sex scenes and should only be played by adults.":
            xpos 280
            ypos 230
       ###
       #
       # - bla, bla, bla, more text
       #
       ###
        textbutton "{font=fonts/RobotoCondensed-Regular.ttf}{u}{color=#000000}Click here if you are over the legal age of your country.{/color}{/u}{/font}" action Jump("start_game"):
            xpos 400
            ypos 350

label start_game:
    call screen click_to_start
This is in screens.rpy

Code: Select all

screen click_to_start():
    tag menu
    add "gui/main_menu2.png"
    #add "gui/click_to_start.png" xalign 0.X yalign 0.X
    button:
        xysize (config.screen_width, config.screen_height)
        action ShowMenu("main_menu")

screen main_menu():
    ## This ensures that any other menu screen is replaced.
    tag menu
    add "presentation"
    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation2 screen.
    use navigation

    if gui.show_name:

        vbox:
            text "[config.name!t]":
                style "main_menu_title"

            text "[config.version]":
                style "main_menu_version"
                

User avatar
rayminator
Veteran
Posts: 343
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

Re: Issues with a custom main menu

#14 Post by rayminator » Thu Jan 09, 2020 8:07 pm

Well I can confirm it's your splashscreen that's causing it by removing it. it's all good I can't really help on that I'm not that experience on splashscreens

Adabelitoo
Regular
Posts: 37
Joined: Sat Apr 13, 2019 2:32 pm
Contact:

Re: Issues with a custom main menu

#15 Post by Adabelitoo » Thu Jan 09, 2020 8:36 pm

Thanks, with that I did some changes and I managed to make the game work start "correctly" but now the rest of the screens (Load, Preference and About) doesn't bring me back to the custom main_menu with right click and so it only changed the problem, but I did noticed that now it does recognize the main menu as the main menu. This is what I did

Code: Select all

label splashscreen:
    scene bg splash
    call screen age_confirmation

screen age_confirmation:
    vbox:
        text "{font=fonts/RobotoCondensed-Regular.ttf}{b}{u}{size=40}Warning:{/size}{/u}{/b}{/font}":
            xpos 550
            ypos 150
        text "Here comes a bunch of text":
            xpos 150
            ypos 200
        textbutton "{font=fonts/RobotoCondensed-Regular.ttf}{u}{color=#000000}Click here if you are over the legal age of your country.{/color}{/u}{/font}" action Show("click_to_start"):
            xpos 400
            ypos 350

screen click_to_start():
    tag menu
    add "gui/main_menu2.png"
    #add "gui/click_to_start.png" xalign 0.X yalign 0.X
    button:
        xysize (config.screen_width, config.screen_height)
        action Jump("start_game")

label start_game:
    return

Post Reply

Who is online

Users browsing this forum: Google [Bot]