Message Text Box moves to the right

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
initialzero
Regular
Posts: 27
Joined: Fri Jul 08, 2016 6:53 am
Contact:

Message Text Box moves to the right

#1 Post by initialzero »

Hello!

I have a big problem with my Renpy Text message box. Every time when the side image appears on the left side, the text message box will move more to the right. Could it be that there are two parameters for placing the box for
1. narrator text without side image
2. side image with text?

It would be great if you can help me.

Thanks!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Message Text Box moves to the right

#2 Post by kivik »

Can you show us the code to your say screen? (in the screens.rpy file) Have you modified it?

initialzero
Regular
Posts: 27
Joined: Fri Jul 08, 2016 6:53 am
Contact:

Re: Message Text Box moves to the right

#3 Post by initialzero »

Code: Select all

screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"


    ## If there's a side image, display it above the text. Do not display on the
    ## phone variant - there's no room.
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0


## Make the namebox available for styling through the Character object.
init python:
    config.character_id_prefixes.append('namebox')

style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label


style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/textbox.png", xalign=0.5, yalign=1.0)

style namebox:
    xpos gui.name_xpos
    xanchor gui.name_xalign
    xsize gui.namebox_width
    ypos gui.name_ypos
    ysize gui.namebox_height

    background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
    padding gui.namebox_borders.padding

style say_label:
    properties gui.text_properties("name", accent=True)
    xalign gui.name_xalign
    yalign 0.5

style say_dialogue:
    properties gui.text_properties("dialogue")

    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos
Never change anything in this part!

initialzero
Regular
Posts: 27
Joined: Fri Jul 08, 2016 6:53 am
Contact:

Re: Message Text Box moves to the right

#4 Post by initialzero »

I tried to change the parameters. But I cant have the exact size of the textfield when the side image appears and not.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Message Text Box moves to the right

#5 Post by kivik »

This is weird, if you haven't changed the screen code your text shouldn't shift at all. Can you show us your character and image declaration code?

initialzero
Regular
Posts: 27
Joined: Fri Jul 08, 2016 6:53 am
Contact:

Re: Message Text Box moves to the right

#6 Post by initialzero »

Hello!

I have used in image declaration code: windows_left_padding 180 or is there any better solution ?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Message Text Box moves to the right

#7 Post by kivik »

If you want to move the image to the right by 180px, you can just use xpos? What are you trying to achieve?

initialzero
Regular
Posts: 27
Joined: Fri Jul 08, 2016 6:53 am
Contact:

Re: Message Text Box moves to the right

#8 Post by initialzero »

I want to place the side image to the left side of the message box.

Is there a better code ? If it is possible could you please tell me how to code with xpos? :D I am not so great in coding. Thank you!!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Message Text Box moves to the right

#9 Post by kivik »

Side image defaults to the left side of the message box, so we need more specifics of what you're trying to achieve. What's wrong with the default location?

initialzero
Regular
Posts: 27
Joined: Fri Jul 08, 2016 6:53 am
Contact:

Re: Message Text Box moves to the right

#10 Post by initialzero »

Hello! I found the error! I deleted the windows_left_panning because this code shifted the message field box more to the right. Now it is correct!! Thank you!!!

Post Reply

Who is online

Users browsing this forum: GetOutOfMyLab, Google [Bot]