Writing a string in multiple lines in editor

Started by HandsFree, Fri 04/07/2014 11:09:45

Previous topic - Next topic

HandsFree

Hi,

Can't find this anywhere.
Is it possible to continue a statement on a next line somehow? I have some long texts and I would like it to remain readable in the editor without scrolling.
In VB you would use &_ I think:
Code: ags

sLongText = "the long text" &_
" continues here.";

Does AGS have something like this?

Adeel

#1
E: Nvm. I read your post too fast. I thought you were asking for breaking line in "Display()" command.

Monsieur OUXX

#2
As far as I know, it's not possible.
AGS can handle instructions being split over several lines, but not when it's inside quotes (inside of a string)

The best workaround I can think of is :

Code: ags

  String s =    "Line #1";
  s = s.Append( "Line #2");
  s = s.Append( "Line #3");
  s = s.Append( "Line #4");
  s = s.Append( "Line #5");
 

HandsFree

Yes, so far I've done the thing with the appends but that feels like a strange workaround. And I read that the translation file doesn't recognize appends so another way of doing this would be welcome.

Just so I know, how does it work when not inside quotes?

Gurok

#4
When it's not inside quotes, a statement only ends in AGS when you place a semicolon after it. Something like this is valid AGS script:

Code: ags
int
x
;
x
=
0
;
while
(
x
<
10
)
x++
;


Moreover, new lines are treated just like they're spaces. If you need to space things out, any whitespace will do :D
[img]http://7d4iqnx.gif;rWRLUuw.gi

Billbis

For translations :
Code: ags
if (Game.TranslationFilename =="") {
    lText = "My text 1";
    lText = lText.Append("and my text 2.");
} else if (Game.TranslationFilename == "French") {
    lText = "Mon texte 1";
    lText = lText.Append("et mon texte 2");
} else if (Game.TranslationFilename == "Spanish") {
    ...
}
labCreditText.Text = lText;


Crimson Wizard

Quote from: Billbis on Sat 05/07/2014 07:47:18
For translations :
Code: ags
if (Game.TranslationFilename =="") {
    lText = "My text 1";
    lText = lText.Append("and my text 2.");
} else if (Game.TranslationFilename == "French") {
    lText = "Mon texte 1";
    lText = lText.Append("et mon texte 2");
} else if (Game.TranslationFilename == "Spanish") {
    ...
}
labCreditText.Text = lText;


What??
Code: ags

lText = GetTranslation("My text 1");
lText = lText.Append(GetTranslation("and my text 2."));

Billbis

#8
:-[
Why I haven't thank about that method earlier? Sorry about that.

SMF spam blocked by CleanTalk