[Solved!] Line break in an instance variable string?

  • Is it possible to include a line break in an object's text instance variable? My game includes a text box with appearing "typewriter" text, but words don't wrap until they're long enough to breach the edge of the text box, which can be jarring. I attempted to solve this problem by manually putting in line breaks before these words, but I haven't found a good way to do so.

    I'm using instance variables to feed the text box from NPC objects - the NPC contains all of the text that the text box will use for the dialog, and each NPC can have different text, even though they're technically the same object.

    I tried adding " & newline & " to the strings themselves, but that proved fruitless.

    Does anyone have a solution to this problem?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Solved! By me!

    It turns out you can use the "replace" function to replace a character with a line break! So instead of calling the instance variable directly, like I was:

    Self.Line1

    I called this instead:

    replace(Self.Line1, "|", newline)

    Now any time I type a |, I get a line break! So easy!

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