Hi again! I have been using NVL mode on my game and I'm trying to do something like this:
Is it possible to place two columns on NVL mode?
And the second question is about the galleries.
http://www.renpy.org/doc/html/rooms.html Here, I can learn to create an image gallery, but... What happens if I want to create an information gallery?
Thanks in advance
Questions about galleries and In-game menus.
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.
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.
- qirien
- Miko-Class Veteran
- Posts: 541
- Joined: Thu Jul 31, 2003 10:06 pm
- Organization: Metasepia Games
- Deviantart: qirien
- Github: qirien
- itch: qirien
- Location: New Mexico, USA
- Discord: qirien
- Contact:
Re: Questions about galleries and In-game menus.
Yes, this is possible! First, make sure your menus are using NVL mode. In one of your init blocks, put
Then you need to open up screens.rpy. Find the NVL screen (it says "screen nvl"). This is where you tell Ren'Py how to display your NVL text. Down lower in this function, where it says:
we are going to change the code. Right now it puts all the choices in a vbox, which means they will just be listed one on top of the other. We want to change it into a grid. Here is some code that will do that (this can replace the entire NVL screen in your screens.rpy, or just take the parts you need):
I hope this helps you figure out how to do that!
Code: Select all
$ menu = nvl_menu
Code: Select all
# Display a menu
if items:
Code: Select all
#############################################################
# Nvl
#
# Screen used for nvl-mode dialogue and menus.
# http://www.renpy.org/doc/html/screen_special.html#nvl
screen nvl(dialogue, items=None):
window:
style "nvl_window"
has vbox:
style "nvl_vbox"
# Display dialogue.
for who, what, who_id, what_id, window_id in dialogue:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
# Display a menu, if given.
if items:
vbox:
id "menu"
# How many choices are in this menu?
$ num_choices = len(items)
# How many rows do we need?
$ choice_rows = ((num_choices-1) // 2) + 1
# Make a grid with two columns and however many rows we need
grid 2 choice_rows:
for caption, action, chosen in items:
if action:
# Display the choice
button:
style "nvl_menu_choice_button"
action action
text caption style "nvl_menu_choice"
else:
text caption style "nvl_dialogue"
# If there is an odd number of choices, add an extra bit of text to fill up the grid
if ((2 * choice_rows) != num_choices):
text ""
add SideImage() xalign 0.0 yalign 1.0
use quick_menu
Re: Questions about galleries and In-game menus.
Thanks for your help! But when I tried to implement the code on the game, something like this happen:
- qirien
- Miko-Class Veteran
- Posts: 541
- Joined: Thu Jul 31, 2003 10:06 pm
- Organization: Metasepia Games
- Deviantart: qirien
- Github: qirien
- itch: qirien
- Location: New Mexico, USA
- Discord: qirien
- Contact:
Re: Questions about galleries and In-game menus.
Yes, you'll probably need to change the style of the nvl buttons.
You can do this with some code like this:
If this doesn't look the way you want, take a look at Style Properties for additional things you can customize.
You can do this with some code like this:
Code: Select all
# Make each button the size of its text, and center it
style nvl_menu_choice_button:
xfill False
xalign 0.5
# Put the choices in the middle of the screen horizontally
style nvl_vbox:
xalign 0.5
Who is online
Users browsing this forum: Semrush [Bot]