[SOLVED] General: Line Continuation Character?

Started by cipberbloom, Mon 18/10/2021 22:33:59

Previous topic - Next topic

cipberbloom

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

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

All the best to you, everyone.  ;-D

Cassiebsg

If you taking about really long lines of code, I believe there is not.
There are those who believe that life here began out there...

Crimson Wizard

#2
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

Game.Camera.SetAt(100, 100);


may be written as

Code: ags

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

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");

Cassiebsg

Oh, had no idea it could break a line at the punctuations.  (roll) Thanks for the info!  :-D
There are those who believe that life here began out there...

cipberbloom

Awesome! That will work for my purposes. Thanks a million, everyone!  :-D

SMF spam blocked by CleanTalk