How do I insert a newline into database text objects?

0 favourites
  • 4 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • I'm using aspx to populate array's with JSON text strings.

    However some of the strings require formatting once they've been entered. Just simple stuff like carriage returns etc, I'm aware that when I'm manually setting text I can use the &newline function but this obviously only works within Construct2 itself.

    Are there any compatible shortcodes I can enter into my DB text fields that will produce a newline in Construct2 itself?

    Failing that, does anyone know of a plugin that would add the functionality? If not I'll have a bash at writing my own when I get time.

  • Once you've populated the arrays with JSON, why not loop through each array element and set it to something like replace(Array.At(loopindex),NEWLINE_SHORTCODE,newline), where NEWLINE_SHORTCODE is the custom shortcode you created to designate a newline? And add all such arrays to a family to do it with one event.

    NOTE: I haven't tested this, just throwing ideas out there.

  • Hmm thats a good idea. I'll test it now and let you know if it works. Many thanks for the tip.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah works perfectly, I just created a couple of local variables as idx and idy to store the array key values and then:

    -- For each XY element

    ----Set idx to array.CurX

    ----Set idy to array.CurY

    -- array,Set value at (idx,idy) to replace(array.At(idx,idy), "SHORTCODE", newline&newline))

    Not done the family thing yet but will do when the need arises. Again, many thanks for your help.

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