[Solved] CTC Is Reformatting My Text

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
Zalor
Newbie
Posts: 22
Joined: Wed Jan 18, 2017 3:02 pm
Contact:

[Solved] CTC Is Reformatting My Text

#1 Post by Zalor »

As the title says, when I try to use ctc it dynamically reformats my text. Whether on ADV or NVL mode it does the same thing. Here are some pictures.

ADV reformatting:
Image

Then when I hit enter to continue the line, it does this:

Image

"221." went from the second line, back to the first line. It's worth noting that without using a ctc, everything naturally displays as it does in the second image. Meaning I have no idea why it clipped after "N.O." and placed "221" on another line (only to then return it to the first line).

On NVL mode it's the same exact same phenomenon. Something I should note however, is that my ctc is this "_", but it only shows up next to the text as you can see above if I set it to: ctc_position="nestled-close". If I set ctc_position="nestled", it shows beneath the text for some reason (and still reformats the text as well). For example like this:

Image

and

Image

I have no idea what is causing these problems, and I can't find anything in the gui.rpy or screens.rpy that deals with ctc so I don't know even know what settings I should fiddle around with. Here are the relevant bits of code from my script.rpy:

Code: Select all

define narrator = Character(color="#c8ffc8", kind=nvl, ctc="ctc", ctc_pause="ctc", ctc_position="nestled", who_bold=True, who_italic=True)
define d = Character(color="#f00", kind=adv, ctc="ctc", ctc_pause="ctc", ctc_position="nestled-close", who_bold=True, who_italic=True)
and

Code: Select all

image ctc:
    contains:
        Text("_")
        alpha 1.0
        pause 0.4
        alpha 0
        pause 0.4
        alpha 1.0
        repeat
Last edited by Zalor on Wed Dec 08, 2021 10:44 am, edited 2 times in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: CTC Reformatting Text

#2 Post by Ocelot »

1) How is your text displayed (actual line which causes text to appear with all tags)
2) What is the value of layout text style property? Did you ever change it to subtitle[/io] for any reason.
3) Make sure that all containers containing text in hierarch do not try to shrink to fit, because it can cause text displayable to change its width depending on amount of text.
< < insert Rick Cook quote here > >

User avatar
Zalor
Newbie
Posts: 22
Joined: Wed Jan 18, 2017 3:02 pm
Contact:

Re: CTC Reformatting Text

#3 Post by Zalor »

Ocelot wrote: Wed Dec 08, 2021 5:49 am 1) How is your text displayed (actual line which causes text to appear with all tags)
2) What is the value of layout text style property? Did you ever change it to subtitle[/io] for any reason.
3) Make sure that all containers containing text in hierarch do not try to shrink to fit, because it can cause text displayable to change its width depending on amount of text.


1) I'm not entirely sure what you mean. Are you talking about the text from my script.rpy files? In that case this would be the excerpt that I used in my OP:

Code: Select all

label start:
    scene template1 with Dissolve (2.0)
    d "The current year is N.O. 221.{w} On February 13th at approximately 9:53 p.m. you passed away in a hospital bed."
    show datacenter with Dissolve (2.0)
    "Following the specifications of your Will, your consciousness was uploaded onto a server you reserved."
    nvl clear
    "For a period of 6 months your disembodied consciousness enjoyed idyllic uninterruption in a digital heaven.{w} A fantasy world selected by you."
    nvl clear
    "However, when your free 6 month trial of our afterlife Premium package expired you were automatically downgraded to our free service."
    nvl clear
    "Despite warnings to remain where you were until the downgrade completed.{w} You walked into a room that had not properly rendered in the midst of the transition."
    "You are now in an unknown location."
    nvl clear
2) I don't remember ever touching that stuff, but here is every instance of "layout" in my screens.rpy:

Code: Select all

style page_label_text:
    text_align 0.5
    layout "subtitle"
    hover_color gui.hover_color
    
style history_text:
    xpos gui.history_text_xpos
    ypos gui.history_text_ypos
    xanchor gui.history_text_xalign
    xsize gui.history_text_width
    min_width gui.history_text_width
    text_align gui.history_text_xalign
    layout ("subtitle" if gui.history_text_xalign else "tex")    
    
style confirm_prompt_text:
    text_align 0.5
    layout "subtitle"    

style nvl_dialogue:
    xpos gui.nvl_text_xpos
    xanchor gui.nvl_text_xalign
    ypos gui.nvl_text_ypos
    xsize gui.nvl_text_width
    min_width gui.nvl_text_width
    text_align gui.nvl_text_xalign
    layout ("subtitle" if gui.nvl_text_xalign else "tex")

style nvl_thought:
    xpos gui.nvl_thought_xpos
    xanchor gui.nvl_thought_xalign
    ypos gui.nvl_thought_ypos
    xsize gui.nvl_thought_width
    min_width gui.nvl_thought_width
    text_align gui.nvl_thought_xalign
    layout ("subtitle" if gui.nvl_text_xalign else "tex")
3) I'm sorry, what specifically should I check to confirm this part? I haven't changed very much in my screens.rpy, so I'll just list the sections that I did alter:

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption action i.action: #Original code didn't have a ":" after i.action, everything below is new to add a pause between choices
                if len(items) > 0:
                    if items[0].caption == i.caption and items[0].action == i.action:
                        at choice_button_alpha1
                if len(items) > 1:
                    if items[1].caption == i.caption and items[1].action == i.action:
                        at choice_button_alpha2
                if len(items) > 2:
                    if items[2].caption == i.caption and items[2].action == i.action:
                        at choice_button_alpha3
                if len(items) > 3:
                    if items[3].caption == i.caption and items[3].action == i.action:
                        at choice_button_alpha4
                if len(items) > 4:
                    if items[4].caption == i.caption and items[4].action == i.action:
                        at choice_button_alpha5
                if len(items) > 5:
                    if items[5].caption == i.caption and items[5].action == i.action:
                        at choice_button_alpha6

init -2:
    transform choice_button_alpha1:
        alpha 0.0
        pause 0.0
        ease 0.2 alpha 1.0
    transform choice_button_alpha2:
        alpha 0.0
        pause 0.2
        ease 0.2 alpha 1.0
    transform choice_button_alpha3:
        alpha 0.0
        pause 0.4
        ease 0.2 alpha 1.0
    transform choice_button_alpha4:
        alpha 0.0
        pause 0.6
        ease 0.2 alpha 1.0
    transform choice_button_alpha5:
        alpha 0.0
        pause 0.8
        ease 0.2 alpha 1.0
    transform choice_button_alpha6:
        alpha 0.0
        pause 1.0
        ease 0.2 alpha 1.0
        
style choice_vbox:
    #This effects where the choices are placed on screen
    xpos 250
    ypos 500
    ####Former Code####
    #xalign 0.5
    #ypos 270
    #yanchor 0.5

    spacing gui.choice_spacing
    
screen nvl(dialogue, items=None):

    window:
        style "nvl_window"

        has vbox:
            spacing gui.nvl_spacing
            null height 450

        ## Displays dialogue in either a vpgrid or the vbox.
        if gui.nvl_height:

            vpgrid:
                cols 1
                yinitial 1.0

                use nvl_dialogue(dialogue)

        else:

            use nvl_dialogue(dialogue)

        ## Displays the menu, if given. The menu may be displayed incorrectly if
        ## config.narrator_menu is set to True, as it is above.
        for i in items:

            textbutton i.caption:
                action i.action
                style "nvl_button"

    add SideImage() xalign 0.0 yalign 1.0      
    
#style nvl_window:
    #xfill True
    #yfill True

    #background "gui/nvl.png"
    #padding gui.nvl_borders.padding
    
#style window:
    #variant "small"
    #background "gui/phone/textbox.png"  
    
#style nvl_window:
    #variant "small"
    #background "gui/phone/nvl.png"                
        

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: CTC Reformatting Text

#4 Post by Ocelot »

What happens if you return xfill True to the nvl_window style?
< < insert Rick Cook quote here > >

User avatar
Zalor
Newbie
Posts: 22
Joined: Wed Jan 18, 2017 3:02 pm
Contact:

Re: CTC Reformatting Text

#5 Post by Zalor »

Ocelot wrote: Wed Dec 08, 2021 6:51 am What happens if you return xfill True to the nvl_window style?
So I went back and tried, and it didn't do anything. Specifically what I have now is:

Code: Select all

style nvl_window:
    xfill True
    yfill True
I also tried adding an xfill True statement in the screen nvl(dialogue, items=None) section:

Code: Select all

screen nvl(dialogue, items=None):

    window:
        style "nvl_window"
        xfill True
But that didn't do anything either.

The only thing I know, is that if I don't include any ctc everything behaves as normal and as intended. I only started having these problems when I tried implementing ctc.

User avatar
Zalor
Newbie
Posts: 22
Joined: Wed Jan 18, 2017 3:02 pm
Contact:

Re: CTC Is Reformatting My Text

#6 Post by Zalor »

Update: I'm using the latest version of Renpy and I'm starting to think this might be a glitch outside of my control.

I've kept experimenting with this current project of mine, but with no results. So I decided to try to implement CTC into a VN I already made and released: viewtopic.php?f=11&t=61379&p=539568#p539568

I didn't use any CTC in that original version, but I decided for the sake of experimenting to implement this:

Code: Select all

define narrator = Character(color="#c8ffc8", kind=nvl, ctc="ctc", ctc_position="nestled-close", who_bold=True, who_italic=True)

image ctc:
    contains:
        Text("_")
        alpha 1.0
        pause 0.4
        alpha 0.0
        pause 0.4
        alpha 1.0
        repeat
Despite having no formatting issues in that work, upon implementing the above code into the script.rpy I was immediately (from the first line) effected by the same exact reformatting glitch I detail in the OP. Tomorrow I'll try creating a completely blank slate file and testing on that, but I'm concerned that this problem might be rooted in a bug in the latest version of Renpy.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: CTC Is Reformatting My Text

#7 Post by Ocelot »

Try to remove contains: from the image definition. It screws with text placement for me for some reason.
< < insert Rick Cook quote here > >

User avatar
Zalor
Newbie
Posts: 22
Joined: Wed Jan 18, 2017 3:02 pm
Contact:

Re: CTC Is Reformatting My Text

#8 Post by Zalor »

Ocelot wrote: Wed Dec 08, 2021 10:28 am Try to remove contains: from the image definition. It screws with text placement for me for some reason.
Thank you so much! Yes, this was the exact source of the problem! Getting rid of "contains:" fixed everything.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]