Can I balance dialogue lines?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hey guys!

    So, I have some dialogues in my game, and every now and then I notice that some dialogue cuts very ugly to a new line:
    "Plalala pla lplp plapla plaplapla
    ."

    Little bit like that, so I could manually change the dialogue a little so it will always fit nicely, but I might add some translations in the end and that will surely cause some lining problems again.
    Is there a way to automatically balance the lines, so it won't display only one letter in new line etc.? I'm using string object to display text.

    Thanks!

    - Jesse

    Currently working on Please login to see this link.
    Released games: Please login to see this link. and Please login to see this link.

  • You ought to try using the text blitter object. It has a wrapping option, and multiline, the difference between which I do not understand. I use both those options and the dialogue will go to the next line to stop what you are describing. However, if the dialogue is being generated one letter a time like it does in one of my projects, it will not go to the next line until the current line is full (ie you see it move the word to the next line).

    Maybe you don't want to use any extensions? Text blitter is apparently only compatible with Windows, Java and Anaconda.

  • Hey Salamander!

    Thanks for reply! Actually I'm currently developing only for windows so I would not mind using extension. And I feed the text one letter at time, but I don't find it too distracting when it jumps to new line.
    Gotta take a closer look into that object, and if I can replace my string objects easily enough. :)

    Thanks!

    Currently working on Please login to see this link.
    Released games: Please login to see this link. and Please login to see this link.

  • You're welcome. I highly recommend that object.

    If for some reason you decide to stick with normal strings, if you are using a monospaced font, you may be able to check the width of the string you are writing to and determine when to start a new line when the string is a certain length. For example, if the font is 32 pixels wide and your string is 320 pixels wide, you would start a new line when 32 * current line characters have been written (you would have some value to keep track of current line). When you start a new line you would have to move the right$ text from the previous line into the new line, by testing when you get to a space, working backwards from the end of the line.

  • You can format your text lines manually, first calculate how many M fit into a line, this is the maximum chars per line, as M is the widest character. When you are over this number just insert a Newline$ so it jumps to a new line.

    Example:
    My text line max width is 30 M's.
    This is my text: "Hello, mi name is Joseph, I live in this island"
    This is what will be shown in 30 characters: "Hello, mi name is Joseph, I li"
    This is what I should do to split the text: "Hello, mi name is Joseph,"+Newline$+"I live in this island"

  • Thanks guys, some good tips there! :)

    I'm calling dialogue from .ini file now, so adding newline$ seems a bit clumsy because I would have to call it from two items then.
    But trick with counting M letters will come handy, ty! :)

    Currently working on Please login to see this link.
    Released games: Please login to see this link. and Please login to see this link.

  • I recently encountered the same problem in a little RPG project I'm working on. Sometimes special symbols would end up isolated on a new line :/

    So I solved this problem by making a fastloop that can be run at any time and which structures the text to be displayed in an alterable string object into the correct number of lines.
    The trick is to copy the string letter by letter into a rich edit object of which you can get the number of lines! So as soon as the copied text fills more than one line in the rich edit object, go back to latest space and add a "Newline$", etc. :)

    I use this fast loop for longer text strings (dialogue, skill and item descriptions) and since it's only run when new text gets loaded, the game didn't slow down for me in any way I noticed :)
    I would love to post this as an example .mfa file if anyone knows a good way how to upload such files (ideally so it can only be accessed from this forum)?

    Edit: I think I found out how to upload .mfa files as attachment :)
    (Oh, and, by the way, I found out this lining problem only happens in Direct3D display modes (took me a while to figure that out when I tried to reproduce the bug :)))

    Please login to see this attachment.

    Edited 3 times, last by Galdor (December 8, 2013 at 6:08 PM).

  • I've updated my example with comments that are (hopefully) a bit less confusing :)
    The example is a fastloop that basically turns this:

    [INDENT]"This string doesn't show up properly
    ."[/INDENT]

    into this:

    [INDENT]"This string doesn't show up properly."[/INDENT]

    And this:

    [INDENT]"Wherever#a number sign#appears#in this string#a new line#is started."[/INDENT]

    into this:

    [INDENT]"Wherever
    a number sign
    appears
    in this string
    a new line
    is started."[/INDENT]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!