Modified text box output from a text box input's word count

0 favourites
  • 2 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • Here's the situation:

    I have two text box objects. One called "Input", and one called "Output". I want the "Output" text to be the "Input" text, except I want it to insert "&newline&" after a variable amount of characters. Let's say 44 for example.

    So while the input box would read: "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.", the Output box would read: "The quick brown fox jumps over the lazy dog."&newline&" The quick brown fox jumps over the lazy dog."

    This is ideally to be a tool to assist a dialogue system that I am working on. I feel like it can be done, but I'm just not familiar with that level of functionality. If you have any ideas, please let me know. Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can insert newline after 44 characters using left() and right() expressions, but what if next line of dialog needs to have newline at a different position, or two newlines?

    Here is much easier solution - mark line breaks with some unused symbol, for example "^":

    Input set Text to "The quick brown fox jumps over the lazy dog.^The quick brown fox jumps over the lazy dog.^The end."

    Then use this code to replace ^ with newlines:

    Output set Text to replace(Input.text, "^", newline)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)