How To Make Menus become Horizontal

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
User avatar
EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: How To Make Menus become Horizontal

#16 Post by EvilDragon » Fri Jul 04, 2008 11:59 am

Post the code that is likely causing that error, too.
Angels of paradise, angels of sacrifice
Please let me be under your wings...

User avatar
mozillauser
Newbie
Posts: 16
Joined: Mon Jun 30, 2008 4:00 pm
Contact:

Re: How To Make Menus become Horizontal

#17 Post by mozillauser » Fri Jul 04, 2008 12:47 pm

EvilDragon wrote:
mozillauser wrote: And while we're at it: Maybe there is a possibility to arrange certain menus, and not all menus, because sometimes it would be better to present horizontal menus and sometimes I want to show vertical ones. Therefore I'm looking for a solution, that is outside the options.rpy
It can probably be done with some style variables, and they are all meant to go to options.rpy.

Style variables that affect in-game menus are ... copied from 00style.rpy. It tells you all the components of the in-game menu. I reckon if you want to arrange the buttons horizontally, the solution is to use a hbox instead of vbox in style.menu function.

EDIT: I did it, I got horizontal in-game menus when I put this in options.rpy:

Code: Select all

style.menu = Style(style.hbox)
style.menu_window.xfill = False
style.menu_choice_button.xminimum = 0
style.menu_choice_button.xpadding = 6
Great! I will try it as soon as possible!

the_omicron
Newbie
Posts: 10
Joined: Tue Jul 01, 2008 5:13 pm
Projects: Progress....... A Call From Heaven
Contact:

Re: How To Make Menus become Horizontal

#18 Post by the_omicron » Sat Jul 05, 2008 5:05 am

I finally made my main menu into the imagemap layout menu, this is a lot easier (at least for me) :D

Code: Select all

init:
        layout.imagemap_main_menu("mainmenu.jpg", "mainmenu.jpg", [
        (313, 216, 502, 371, "The Afterlife Story"),
        (44, 369, 135, 383, "Continue"),
        (643, 378, 723, 394, "Options"),
        (26, 21, 68, 48, "Quit"),
        ])
        theme.roundrect(

Image

:D hope that helped

User avatar
mozillauser
Newbie
Posts: 16
Joined: Mon Jun 30, 2008 4:00 pm
Contact:

Re: How To Make Menus become Horizontal

#19 Post by mozillauser » Sat Jul 05, 2008 9:55 am

The image 'The afterlife story' ist very artistic.

User avatar
BCS
Eileen-Class Veteran
Posts: 1303
Joined: Mon Sep 19, 2005 2:15 am
Location: Florida
Contact:

Re: How To Make Menus become Horizontal

#20 Post by BCS » Sat Jul 05, 2008 10:10 am

I thought the exact same thing ... could I do that with the logo in my titlescreen too?

the_omicron
Newbie
Posts: 10
Joined: Tue Jul 01, 2008 5:13 pm
Projects: Progress....... A Call From Heaven
Contact:

Re: How To Make Menus become Horizontal

#21 Post by the_omicron » Sun Jul 06, 2008 5:17 pm

Ty Guys :D



----------

Now I Have another question

-Is There Any Way to change the text window color and transparency?


TY for the answers , i would greatly appreciate it :D

User avatar
EvilDragon
Veteran
Posts: 284
Joined: Fri Dec 28, 2007 5:47 am
Location: Where the Dragons rule!
Contact:

Re: How To Make Menus become Horizontal

#22 Post by EvilDragon » Sun Jul 06, 2008 5:30 pm

Text window in-game or on main menu? Either way, you have style variables for everything.
Angels of paradise, angels of sacrifice
Please let me be under your wings...

Guest

Re: How To Make Menus become Horizontal

#23 Post by Guest » Sat Jul 12, 2008 2:31 am

EvilDragon wrote:Text window in-game or on main menu? Either way, you have style variables for everything.

srry, i forgot that style variables can change it :D

anyway, ty :D

User avatar
Stelluna
Newbie
Posts: 6
Joined: Wed Sep 19, 2018 11:15 am
Deviantart: stelluna7
Contact:

Re: How To Make Menus become Horizontal

#24 Post by Stelluna » Wed Sep 19, 2018 11:47 am

Hi, I tried putting

Code: Select all

layout.grouped_main_menu(4)
in my options.rpy, but upon launching the game, I get an error.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/options.rpy", line 154, in script
    init python:
  File "game/options.rpy", line 211, in <module>
    layout.grouped_main_menu(4)
  File "renpy/common/00layout.rpy", line 351, in grouped_main_menu
    renpy.load_module("_layout/grouped_main_menu")
ScriptError: Name u'main_menu_screen' is defined twice, at renpy/common/_layout/screen_main_menu.rpym:26 and renpy/common/_layout/grouped_main_menu.rpym:40.

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

Full traceback:
  File "game/options.rpy", line 154, in script
    init python:
  File "C:\Users\stelluna\Desktop\Programs\renpy-6.99.11-sdk\renpy\ast.py", line 805, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\stelluna\Desktop\Programs\renpy-6.99.11-sdk\renpy\python.py", line 1641, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/options.rpy", line 211, in <module>
    layout.grouped_main_menu(4)
  File "renpy/common/00layout.rpy", line 351, in grouped_main_menu
    renpy.load_module("_layout/grouped_main_menu")
  File "C:\Users\stelluna\Desktop\Programs\renpy-6.99.11-sdk\renpy\exports.py", line 2173, in load_module
    initcode = renpy.game.script.load_module(name)
  File "C:\Users\stelluna\Desktop\Programs\renpy-6.99.11-sdk\renpy\script.py", line 283, in load_module
    self.load_appropriate_file(".rpymc", ".rpym", dir, fn, initcode)
  File "C:\Users\stelluna\Desktop\Programs\renpy-6.99.11-sdk\renpy\script.py", line 738, in load_appropriate_file
    self.finish_load(stmts, initcode, filename=fn + source)
  File "C:\Users\stelluna\Desktop\Programs\renpy-6.99.11-sdk\renpy\script.py", line 414, in finish_load
    bad_node.filename, bad_node.linenumber))
ScriptError: Name u'main_menu_screen' is defined twice, at renpy/common/_layout/screen_main_menu.rpym:26 and renpy/common/_layout/grouped_main_menu.rpym:40.

Windows-8-6.2.9200
Ren'Py 6.99.11.1749
My Game 1.0
Does anyone know how to fix this?

User avatar
Imperf3kt
Eileen-Class Veteran
Posts: 1948
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: How To Make Menus become Horizontal

#25 Post by Imperf3kt » Wed Sep 19, 2018 5:25 pm

You're trying to use ancient renpy code in a new renpy version, it is incompatible.
You'll need to use something from 2017 or later.

What are you trying to do, get your menu horizontal?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

User avatar
Stelluna
Newbie
Posts: 6
Joined: Wed Sep 19, 2018 11:15 am
Deviantart: stelluna7
Contact:

Re: How To Make Menus become Horizontal

#26 Post by Stelluna » Thu Sep 20, 2018 9:39 am

Yes, but this is the only thing I've been able to find about making menus horizontal.

User avatar
Imperf3kt
Eileen-Class Veteran
Posts: 1948
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: How To Make Menus become Horizontal

#27 Post by Imperf3kt » Thu Sep 20, 2018 8:19 pm

Alright... I'm going to save this as a text document somewhere, one day...


Assuming you are using a version of Ren'Py newer than ~November 2016, open screens.rpy, find the navigation menu, copy the vbox and contents.
Go to the main menu screen (just a bit lower)
Paste the content in the main menu, checking indentation matches.
Change the vbox to a hbox.
Remove the line 'use navigation'

Done.
Now work on styling it.

Tell you what, I'm in the middle of helping two other people with similarly common requests, so when I am finished, I might as well prepare a stock boilerplate for horizontal menus that others can just copy/paste.

I'll post it in the cookbook when done. Should be a quick job.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Post Reply

Who is online

Users browsing this forum: No registered users