Edit of Renpy gui German

Blackthunder_vn

Active Member
Game Developer
Jan 31, 2020
626
1,681
Hi @ all,
I need help with the Renpy Gui but I need someone who speeks german very well. My english is not the best one.

In the Attachment i have a image how it should look.

The Patreon button must be on the left downside. It is in the Navigation but it dont move.
The Flags for Language change on the right upperside.
The name and version of the game in an spezial font withe with black border.


I failed at this so much times. I hope someone can help me.

Greetings Balckthunder_vn Troubled Legacy wunsch.png
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,978
16,235
I need help with the Renpy Gui but I need someone who speeks german very well. My english is not the best one.
Not sure that someone speaking German while soon read your question and have the answer. But in the same time the said answer is really simple and don't need much English knowledge to be understood:

Just tell Ren'py in what place you want the button
Python:
screen navigation():

    vbox:
        style_prefix "navigation"

        xpos gui.navigation_xpos
        [...]
        if renpy.variant("pc"):
        [...]
            ## The quit button is banned on iOS and unnecessary on Android.
            textbutton _("Quit") action Quit(confirm=not main_menu)

    imagebutton:
        idle "PATREON IMAGE"
        xpos 60  # Adapt the value to your case
        ypos 1000   # Adapt the value to your case
        action WHATEVER YOU WANT HERE
 
  • Like
Reactions: Blackthunder_vn

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,978
16,235
anne O'nymous

sorry dosn`t work
Hmm ok...

So, the "[...]" parts where here to reduce the size of the code. They mean "I'll not copy/paste the part between the lines I gave, but you have to keep them".
Also, as the error message say, when you edited the screen, you reduced the indentation/tabulation level for the first xpos what is the problem ; but Ren'py would have complained about the "[...]"
 

Blackthunder_vn

Active Member
Game Developer
Jan 31, 2020
626
1,681
OK. But what should I do to solve this problem, this is why I need a german speaking person I need to understand, where to do, what i must do, why I must do it and how I must do it.

edit: the patreonbutton is there but it is nailed to the navigation.
How can i switch to a free positoning at the main_menu?

I have defined the Images (myimagedefines.rpy)

#----------------------------Patreon Link---------------------------------------

image patreon_link = "/patreon_link/patreon_link.png"
image patreon_link_hover = "/patreon_link/patreon_link_hover.png"

I have defined the imagebutton (myscreens.rpy)

screen patreon():
imagebutton:
idle "patreon_link"
hover "patreon_link_hover"
action OpenURL(" ")
xalign 0.99
yalign 0.0

The section in the main and game screens is:

################################################################################
## Main and Game Menu Screens
################################################################################

## Navigation screen ###########################################################
##
## This screen is included in the main and game menus, and provides navigation
## to other menus, and to start the game.

screen navigation():

vbox:
style_prefix "navigation"

xpos gui.navigation_xpos
yalign 0.5

spacing gui.navigation_spacing

if main_menu:

textbutton _("Start") action Start()

else:

textbutton _("History") action ShowMenu("history")

textbutton _("Save") action ShowMenu("save")

textbutton _("Load") action ShowMenu("load")

textbutton _("Preferences") action ShowMenu("preferences")

if _in_replay:

textbutton _("End Replay") action EndReplay(confirm=True)

elif not main_menu:

textbutton _("Main Menu") action MainMenu()

textbutton _("About") action ShowMenu("about")

if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):

## Help isn't necessary or relevant to mobile devices.
textbutton _("Help") action ShowMenu("help")

if renpy.variant("pc"):

## The quit button is banned on iOS and unnecessary on Android and
## Web.
textbutton _("Quit") action Quit(confirm=not main_menu)


imagebutton:
idle "patreon_link"
hover "patreon_link_hover"
action OpenURL(" ")
xalign 0.3
yalign 0.99





style navigation_button is gui_button
style navigation_button_text is gui_button_text

style navigation_button:
size_group "navigation"
properties gui.button_properties("navigation_button")

style navigation_button_text:
properties gui.button_text_properties("navigation_button")

can I define position of the button with Xalign and yalign or must/can I switch to xpos and y pos
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
This reply is based on the standard game menus.

There are three screens you need to think about.
screens.rpy
  • screen main_menu - The main game menu. Used before the player starts a game.
  • screen game_menu - A shared in-game menu. Used after the player starts playing.
  • screen navigation - A shared menu used by both main_menu and game_menu

The game_menu is not used directly, but is instead used by all the other menu screens like Load, Save, Preferences, About, Help, etc.

I think your "Patreon button" should be part of navigation and your language selection should be part of main_menu.


The Patreon Button:

Find the line textbutton _("Quit") action Quit(confirm=not main_menu) within screens.rpy. Then add...

Python:
    imagebutton:
        idle "gui/patreon_support.png"
        hover im.MatrixColor("gui/patreon_support.png", im.matrix.brightness(0.15)) # use same image for hover, but increase brightness by 15%
        xpos 70
        ypos 980
        action OpenURL("https://www.patreon.com/yourpatreonid")

Find the line style return_button:. Change it to be...

Python:
style return_button:
    xpos gui.navigation_xpos
    yalign 0.93     # move it slightly upward
    yoffset -45

The language selection:

Find the line screen main_menu(): within screens.rpy. Then add this code just before the style lines begin...
(After the section that includes if gui.show_name:)

Python:
    hbox:
        xpos 1430
        ypos 40
        spacing 30

        if _preferences.language == "deutsch":  # the buttons change depending on the current language.
            imagebutton:
                idle im.MatrixColor("gui/language_english.png", im.matrix.contrast(0.4))
                hover "gui/language_english.png"
                action Language(None)

            imagebutton:
                idle "gui/language_deutsch.png"

        else:
            imagebutton:
                idle "gui/language_english.png"

            imagebutton:
                idle im.MatrixColor("gui/language_deutsch.png", im.matrix.contrast(0.4))
                hover "gui/language_deutsch.png"
                action Language("deutsch")

The example above uses im.MatrixColor to alter the images shown in order to make it easier to see which language is currently selected.

This code uses these three images, stored in the /game/gui/ folder.

language_english.png language_deutsch.png patreon_support.png
 
  • Wow
Reactions: Blackthunder_vn

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
5,380
8,652
I've made my own menu entirely as I found it easier to tinker with than the default Ren'py menu, especially with adding hover effects, etc. Might or might not be more advanced for you.

Starting with code, you want to disable what's there. 'screen.rpy' > 'Main Menu Screen > Backup + Disable/Delete what's there. Then add this:

buttons.png

Where it says "Start_%.png", you want to make sure you have two different versions of a button in PNG format (with no background.). So, basically, you'll want a "start_hover.png" and a "start_idle.png" and do the same for the rest of the buttons. Load, save, help, quit, or any other button you want to add. Make sure they are in the images folder, not the gui folder. It won't work otherwise. You'll have to experiment with the xpos and ypos for each button, depending on where you want it.

Your buttons images should look something like this. Save as a .png with no background. Windows is showing it as black here, but they indeed have no background. Create your own buttons, GIMP or Photoshop should be more than enough, nor do they have to be this different. Just make one darker and one lighter, or perhaps experiment.

imagbuttons.png

That code and my buttons came up with what you see below with and without the hover, the Patreon icon in the bottom right corner.

example.png example2.png
 
  • Like
Reactions: recreation

Blackthunder_vn

Active Member
Game Developer
Jan 31, 2020
626
1,681
I made it, it' now all in the main_menu. Look's great. I used 78Flavors help and it worked.

MissFortune i neet an phone chat script is there anywere a ready to start script.

Thanks