[Solved] Chatroom Style NVL Setup With Character Avatars - Determining an image position relative to a character's name

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
renpyuseranon
Newbie
Posts: 11
Joined: Wed Dec 05, 2018 4:25 pm
Contact:

[Solved] Chatroom Style NVL Setup With Character Avatars - Determining an image position relative to a character's name

#1 Post by renpyuseranon »

I'm using NVL to make a chatroom-like interface. I've edited the gui.rpy to make the text take up most of the screen, like so.

Code: Select all

## The maximum number of NVL-mode entries Ren'Py will display. When more entries
## than this are to be show, the oldest entry will be removed.
define gui.nvl_list_length = 16

## The height of an NVL-mode entry. Set this to None to have the entries
## dynamically adjust height.
define gui.nvl_height = None

## The spacing between NVL-mode entries when gui.nvl_height is None, and between
## NVL-mode entries and an NVL-mode menu.
define gui.nvl_spacing = 4

## The position, width, and alignment of the label giving the name of the
## speaking character.
define gui.nvl_name_xpos = 345
define gui.nvl_name_ypos = 0
define gui.nvl_name_width = 425
define gui.nvl_name_xalign = 1.0

## The position, width, and alignment of the dialogue text.
define gui.nvl_text_xpos = 375
define gui.nvl_text_ypos = 12
define gui.nvl_text_width = 1500
define gui.nvl_text_xalign = 0.0

## The position, width, and alignment of nvl_thought text (the text said by the
## nvl_narrator character.)
define gui.nvl_thought_xpos = 360
define gui.nvl_thought_ypos = 0
define gui.nvl_thought_width = 1170
define gui.nvl_thought_xalign = 0.0
In addition, the characters I'm using all have their name and text size set to 30 to fit properly. This works pretty well, but I also wanted to have "avatars" for each of the characters that would appear beside their name. I looked around and found this thread that helped me implement them. viewtopic.php?t=46301

I followed what Divona posted in post #10 and added the lines to screen.rpy as well as the "icon=" bit to all of my relevant characters. I set the xalign to 0.062 so that the image I'm using for my first character's avatar appears just to the left of their name. After testing my second character I realized that the position of the image is completely independent from the name of the character it's assigned to, so despite all of my characters having names of various lengths, their avatars would all appear at the same x value.

My question is: is there a way to make it so that these icons/avatars will appear x amount of pixels to the left of wherever the first letter of their character's name is on the screen?

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]