How to put quoation marks into a speech

Started by FM_Luder, Mon 28/05/2018 12:41:47

Previous topic - Next topic

FM_Luder

Hi everyone,
I'm new to AGS. Working on my first game right now. I already asked a question here in the Forum which really helped me!
So I've got another basically simple question for which I couldn't find any answers...

I want to put quoataion marks into a speech. But the script recognizes them as an error:

Code: ags

cCharacter.Say("He said:"Hello!"");


Is there a way to mark these "second" quotation marks not to be recognized as part of the scrpt's commands or something like that?

Thanks for your help!!!
Greets,
Luder

Crimson Wizard

#1
Hello.
You do this by putting "\" (backslash) sign before the quotation mark.

Code: ags

cCharacter.Say("He said:\"Hello!\"");


In programming and scripting this is called "escaping". In this case it means that program should treat next character as a part of a string rather than code syntax.

Another common use of escaping is with "[" character, which serves as a line-break in AGS. If you do cCharacter.Say("He said: [Hello]"), the speech will be split in two lines "He said:" and "Hello]", but if you do cCharacter.Say("He said:\[Hello]"), it will looke like "He said: [Hello]" on screen.

Hmm, since I am at this, if you want to print "\" character you will have to escape it, like "\\". :)

FM_Luder

Hi!
Thank you very much for your long answer! Really hlped me! Thanks!

Cassiebsg

oh, thanks :)
did not know this either... I usually just cheat and type '' or just '... (laugh)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk