Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Twisted on Tue 26/10/2010 23:47:41

Title: How to display multiple strings.
Post by: Twisted on Tue 26/10/2010 23:47:41
Could someone explain to me how to post multiple strings?
example: string name1 = "Bob";
                string name2 = "Bill";

Display("Hello "  name1 " and" name2);

I'm not sure how to script it but I hope this gives you an idea of what I'm trying to accomplish.
Title: Re: How to display multiple strings.
Post by: Matti on Tue 26/10/2010 23:55:32
Display("Hello %s and %s", name1 , name2);
Title: Re: How to display multiple strings.
Post by: Twisted on Wed 27/10/2010 00:04:24
Thanks for the quick reply. It works perfect now.
Title: Re: How to display multiple strings.
Post by: Matti on Wed 27/10/2010 00:22:00
No problem  :)
Title: Re: How to display multiple strings.
Post by: cianty on Wed 27/10/2010 10:32:34
You may also need String.Format if you want to use variables in strings at some point.
Title: Re: How to display multiple strings.
Post by: monkey0506 on Wed 27/10/2010 14:26:29
On that note, if the manual shows "..." as the final parameter of a function, then it supports "String formatting" (look that up in the manual for further descriptions of what all you can do with it). Otherwise, it doesn't, but as was said you can use String.Format and pass the result as a parameter to any functions that don't.