Change the buttons position in the main screen and preferences menu individually

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
scarletthinks
Newbie
Posts: 6
Joined: Mon Aug 27, 2018 11:23 am
Contact:

Change the buttons position in the main screen and preferences menu individually

#1 Post by scarletthinks » Mon Aug 27, 2018 12:16 pm

Now, I know this is probably simple and I'm the one who really can't figure it out — please bare with me, I'm a newbie on the subject <__<
I've tried to change the position of the menu buttons so they are centered when on the main menu and on the left side of the screen when opening the menu while playing (see pictures below).

Image

Image

I've done this adding an if variable like so (the code is the default one, I haven't changed anything):

Code: Select all

screen navigation():

    vbox:
        style_prefix "navigation"

        if main_menu:

            xalign 0.5
            ypos 400

        else:

            xpos 90
            ypos 240
The problem now is, the buttons remain centered when I enter the preferences menu:

Image

I think it does so because we are on the main menu, so it leaves the buttons there (exept for the "return" which has different properties), but I don't know how to fix the issue — the whole navigation and menu thing seems complicated and I don't know where to start. Could somebody please help?

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#2 Post by thirstyoctopus » Mon Aug 27, 2018 1:10 pm

Hey

Could you not adjust the position of the menu in the Preferences screen under this code:

Code: Select all

screen preferences():
in the screens.rpy file?

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#3 Post by thirstyoctopus » Mon Aug 27, 2018 1:21 pm

Hi again

So, I found a Ren'Py theme which may help you customise your menus.

If you go to https://www.deviantart.com/potouto/art/ ... -612371785 this theme has a main menu screen in the middle but when you click 'Prefs' it displays a menu underneath instead. You'll need to structure the pages yourself but if you download this theme and check the configurations in the screens file you should be able to get a grasp of how to do what you want to do.

Hope this helps?

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#4 Post by MaydohMaydoh » Mon Aug 27, 2018 1:51 pm

The main_menu variable will return true until you start the game.
Instead you'll want to use

Code: Select all

if renpy.get_screen['main_menu']:
    xalign 0.5
    ypos 400
else:
    xpos 90
    ypos 240
to ask if the main menu screen is currently showing.

User avatar
scarletthinks
Newbie
Posts: 6
Joined: Mon Aug 27, 2018 11:23 am
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#5 Post by scarletthinks » Mon Aug 27, 2018 2:15 pm

thirstyoctopus wrote:
Mon Aug 27, 2018 1:10 pm
Hey

Could you not adjust the position of the menu in the Preferences screen under this code:

Code: Select all

screen preferences():
in the screens.rpy file?
I've tried almost everything but really, I am clueless ç__ç
thirstyoctopus wrote:
Mon Aug 27, 2018 1:21 pm
Hi again

So, I found a Ren'Py theme which may help you customise your menus.

If you go to https://www.deviantart.com/potouto/art/ ... -612371785 this theme has a main menu screen in the middle but when you click 'Prefs' it displays a menu underneath instead. You'll need to structure the pages yourself but if you download this theme and check the configurations in the screens file you should be able to get a grasp of how to do what you want to do.

Hope this helps?
Unfortunately, it doesn't let me download it to see the code. That was a good idea though, thank you anyway!
MaydohMaydoh wrote:
Mon Aug 27, 2018 1:51 pm
The main_menu variable will return true until you start the game.
Instead you'll want to use

Code: Select all

if renpy.get_screen['main_menu']:
    xalign 0.5
    ypos 400
else:
    xpos 90
    ypos 240
to ask if the main menu screen is currently showing.
I tried doing it, but it gave me an error.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 356, in execute
    ##
  File "game/screens.rpy", line 356, in execute
    ##
  File "game/screens.rpy", line 367, in execute
    
  File "game/screens.rpy", line 292, in execute
    screen navigation():
  File "game/screens.rpy", line 292, in execute
    screen navigation():
  File "game/screens.rpy", line 294, in execute
    vbox:
  File "game/screens.rpy", line 294, in keywords
    vbox:
  File "game/screens.rpy", line 297, in keywords
    if renpy.get_screen['main_menu']:
TypeError: 'function' object has no attribute '__getitem__'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\ast.py", line 862, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\python.py", line 1888, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\core.py", line 2635, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\core.py", line 3019, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\screen.py", line 420, in visit_all
    callback(self)
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\core.py", line 3019, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\screen.py", line 430, in per_interact
    self.update()
  File "C:\Users\ASUS\Downloads\renpy-6.99.14.3-sdk\renpy\display\screen.py", line 611, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 356, in execute
    ##
  File "game/screens.rpy", line 356, in execute
    ##
  File "game/screens.rpy", line 367, in execute
    
  File "game/screens.rpy", line 292, in execute
    screen navigation():
  File "game/screens.rpy", line 292, in execute
    screen navigation():
  File "game/screens.rpy", line 294, in execute
    vbox:
  File "game/screens.rpy", line 294, in keywords
    vbox:
  File "game/screens.rpy", line 297, in keywords
    if renpy.get_screen['main_menu']:
  File "<screen language>", line 297, in <module>
TypeError: 'function' object has no attribute '__getitem__'

Windows-8-6.2.9200
Ren'Py 6.99.14.3.3347
Trial 1.0
Mon Aug 27 20:15:24 2018

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#6 Post by MaydohMaydoh » Mon Aug 27, 2018 2:29 pm

My mistake, should be renpy.get_screen('main_menu').
Parenthesis not square brackets.

User avatar
scarletthinks
Newbie
Posts: 6
Joined: Mon Aug 27, 2018 11:23 am
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#7 Post by scarletthinks » Mon Aug 27, 2018 2:39 pm

MaydohMaydoh wrote:
Mon Aug 27, 2018 2:29 pm
My mistake, should be renpy.get_screen('main_menu').
Parenthesis not square brackets.
Now it works flawlessly, thank you a lot! ♥

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#8 Post by thirstyoctopus » Mon Aug 27, 2018 3:32 pm

Sorry scarletthinks, I gave you the wrong link! I thought it was strange as I downloaded the GUI myself:

https://drive.google.com/file/d/0Bwg8RS ... lXWUU/view

Glad that you got it sorted though but that theme is a good example of a way of chopping up menus for each page.

User avatar
scarletthinks
Newbie
Posts: 6
Joined: Mon Aug 27, 2018 11:23 am
Contact:

Re: Change the buttons position in the main screen and preferences menu individually

#9 Post by scarletthinks » Mon Aug 27, 2018 4:40 pm

thirstyoctopus wrote:
Mon Aug 27, 2018 3:32 pm
Sorry scarletthinks, I gave you the wrong link! I thought it was strange as I downloaded the GUI myself:

https://drive.google.com/file/d/0Bwg8RS ... lXWUU/view

Glad that you got it sorted though but that theme is a good example of a way of chopping up menus for each page.
Thank you, I'll definitely check it out to learn something!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]