How do I insert a newline into database text objects?

Get help using Construct 2

Post » Thu Mar 26, 2015 4:50 pm

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.
B
7
S
1
Posts: 27
Reputation: 511

Post » Fri Mar 27, 2015 8:47 am

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.
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Fri Mar 27, 2015 9:14 am

Hmm thats a good idea. I'll test it now and let you know if it works. Many thanks for the tip.
B
7
S
1
Posts: 27
Reputation: 511

Post » Fri Mar 27, 2015 10:03 am

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.
B
7
S
1
Posts: 27
Reputation: 511


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests