Spritefont not displaying text

Get help using Construct 2

Post » Sun Mar 18, 2018 6:14 pm

Image

In the above image you can see 2 different scenarios

1. Typing name directly in the variable. Works and displays fine.

2. Getting the name from Array. The correct text gets all the way to Spritefont object, but then the text just doesn't display in game.

I managed to get some character names to show increasing the text area but not all. So my issue seems to be that the Spritefont object thinks there isn't enough space for the text, even though there clearly is because when I write it there normally it shows. Is this a bug or am I doing something wrong?
B
12
S
4
G
1
Posts: 69
Reputation: 987

Post » Sun Mar 18, 2018 6:39 pm

Just make it much larger, for the sake of testing. It's usually an issue with the size.
ImageImageImage
B
71
S
22
G
288
Posts: 3,858
Reputation: 158,422

Post » Sun Mar 18, 2018 7:34 pm

blackhornet wrote:Just make it much larger, for the sake of testing. It's usually an issue with the size.

Tried that and found out Spritefont is displacing/changing the alignment of the text (which is why it got cropped out of the smaller box). Very weird...
B
12
S
4
G
1
Posts: 69
Reputation: 987

Post » Mon Mar 19, 2018 2:10 am

You might have a line break in the text (at the beginning or at the end of the string. Line breaks are not shown in debug mode.
Add trim() expression, it will remove all linebreaks, spaces, tabs etc.

Set text to trim(tokenat(.....
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
155
Posts: 2,202
Reputation: 82,485

Post » Mon Mar 19, 2018 3:02 pm

dop2000 wrote:You might have a line break in the text (at the beginning or at the end of the string. Line breaks are not shown in debug mode.
Add trim() expression, it will remove all linebreaks, spaces, tabs etc.

Set text to trim(tokenat(.....

That was it, forgot to trim the original data. Thanks a lot! 🙏
B
12
S
4
G
1
Posts: 69
Reputation: 987


Return to How do I....?

Who is online

Users browsing this forum: inozz and 4 guests