Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: cipberbloom on Mon 18/10/2021 22:33:59

Title: [SOLVED] General: Line Continuation Character?
Post by: cipberbloom on Mon 18/10/2021 22:33:59
Hullo! Is there a character to break up long lines of code or a hidden 'soft-wrap' feature in AGS?

I've not seen anything in the manual, and this thread...

https://www.adventuregamestudio.co.uk/forums/index.php?topic=40992.0 (https://www.adventuregamestudio.co.uk/forums/index.php?topic=40992.0)

...is from 2010 and is just referring to strings. Thanks in advance!

All the best to you, everyone.  ;-D
Title: Re: General: Line Continuation Character?
Post by: Cassiebsg on Mon 18/10/2021 23:22:34
If you taking about really long lines of code, I believe there is not.
Title: Re: General: Line Continuation Character?
Post by: Crimson Wizard on Mon 18/10/2021 23:30:26
Quote from: Skeevy Wonder on Mon 18/10/2021 22:33:59
Hullo! Is there a character to break up long lines of code or a hidden 'soft-wrap' feature in AGS?

Regular statements may be broken between any two operators or punctuation marks. I don't have 100% certainty when it comes to AGS, as its compiler contains obscure bugs, but I believe it suppose to work in most times.

For example:
Code (ags) Select

Game.Camera.SetAt(100, 100);


may be written as

Code (ags) Select

Game.
Camera.
SetAt
(
100
,
100
)
;


and will work just as the first one above.

Unfortunately, AGS compiler does not support wrapping the strings in code, so with them you'd have to combine longer string from smaller parts using String.Append or String.Format:
Code (ags) Select

String s = String.Format("%s%s%s",
          "First part of a very long string",
          "Second part of a very long string",
          "Third part of a very long string");
Title: Re: General: Line Continuation Character?
Post by: Cassiebsg on Wed 20/10/2021 22:47:37
Oh, had no idea it could break a line at the punctuations.  (roll) Thanks for the info!  :-D
Title: Re: General: Line Continuation Character?
Post by: cipberbloom on Thu 21/10/2021 05:11:00
Awesome! That will work for my purposes. Thanks a million, everyone!  :-D