Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Questions for AGK developers

Author
Message
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 1st Mar 2020 15:50
1) While I was working on my project I noticed .fromJSON syntax is not highlighted. If this a native syntax in tier 1, shouldn't it be highlighted so at least we know it's the correct syntax?

2) is there a way to start new line or return carriage within a long strong? For example, I want to add rules to a game and would like to break each bulletin points up.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Mar 2020 19:23
2) print("abc"+chr(0x0a)+"def")
Ron2019
4
Years of Service
User Offline
Joined: 27th Jul 2019
Location:
Posted: 1st Mar 2020 21:50
I recently asked the same question. I was advised to use Chr(10).

Code examples have been submitted for both the SetTextString and Print commands.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Mar 2020 22:03 Edited at: 1st Mar 2020 22:03
For convenience you could substitute a character for end of line. something like this maybe;

text = "this is a line~this is another line~this is the last line"

then use replace string to insert the line feed

display_text = ReplaceString( text, "~", chr(0x0a), -1)
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 2nd Mar 2020 07:43
You could also use SetTextMaxWidth(). If your text string exceeds the width it will wrap to the next line.
This is potentially the best option if developing for unknown device sizes because you don't have to cut the text at the same point regardless of device but instead it will wrap if it extends beyond a certain value (percent) of the display.

Login to post a reply

Server time is: 2024-04-25 21:55:12
Your offset time is: 2024-04-25 21:55:12