Jibble

Author Topic: [SOLVED] General: Line Continuation Character?  (Read 265 times)

Skeevy Wonder

  • Gus, cats, games, and love for all.
    • I can help with backgrounds
    • I can help with characters
    • I can help with play testing
    • I can help with proof reading
    • I can help with story design
    • I can help with voice acting
    • I can help with PR
    • Skeevy Wonder worked on one or more games that was nominated for an AGS Award!
[SOLVED] General: Line Continuation Character?
« on: 18 Oct 2021, 22:33 »
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
« Last Edit: 21 Oct 2021, 05:12 by Skeevy Wonder »

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Re: General: Line Continuation Character?
« Reply #1 on: 18 Oct 2021, 23:22 »
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...

Re: General: Line Continuation Character?
« Reply #2 on: 18 Oct 2021, 23:30 »
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: Adventure Game Studio
  1. Game.Camera.SetAt(100, 100);
  2.  

may be written as

Code: Adventure Game Studio
  1. Game.
  2. Camera.
  3. SetAt
  4. (
  5. 100
  6. ,
  7. 100
  8. )
  9. ;
  10.  

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: Adventure Game Studio
  1. String s = String.Format("%s%s%s",
  2.           "First part of a very long string",
  3.           "Second part of a very long string",
  4.           "Third part of a very long string");
  5.  
« Last Edit: 18 Oct 2021, 23:33 by Crimson Wizard »

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Re: General: Line Continuation Character?
« Reply #3 on: 20 Oct 2021, 22:47 »
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...

Skeevy Wonder

  • Gus, cats, games, and love for all.
    • I can help with backgrounds
    • I can help with characters
    • I can help with play testing
    • I can help with proof reading
    • I can help with story design
    • I can help with voice acting
    • I can help with PR
    • Skeevy Wonder worked on one or more games that was nominated for an AGS Award!
Re: General: Line Continuation Character?
« Reply #4 on: 21 Oct 2021, 05:11 »
Awesome! That will work for my purposes. Thanks a million, everyone!  :-D