Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FM_Luder on Mon 28/05/2018 12:41:47

Title: How to put quoation marks into a speech
Post by: FM_Luder on Mon 28/05/2018 12:41:47
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) Select

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
Title: Re: How to put quoation marks into a speech
Post by: Crimson Wizard on Mon 28/05/2018 13:21:49
Hello.
You do this by putting "\" (backslash) sign before the quotation mark.

Code (ags) Select

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 "\\". :)
Title: Re: How to put quoation marks into a speech
Post by: FM_Luder on Tue 29/05/2018 08:27:08
Hi!
Thank you very much for your long answer! Really hlped me! Thanks!
Title: Re: How to put quoation marks into a speech
Post by: Cassiebsg on Tue 29/05/2018 16:10:43
oh, thanks :)
did not know this either... I usually just cheat and type '' or just '... (laugh)