Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Pax Animo on Thu 14/10/2021 11:54:17

Title: Multiple variables in string formatting. SOLVED
Post by: Pax Animo on Thu 14/10/2021 11:54:17
Greetings,

I have this line,
Code (ags) Select
lPlayerInfoHP.Text = String.Format("-Health: %d/20", citizens[0].hp);         

I'd like the "20" to be another variable (citizens[0].hpcore)

I'm looking at the manual and seeing that it's possible to have as many variables as you like in one line but after playing around for a bit I can't figure it out.

Thanks in advance for any help.
Title: Re: Multiple variables in string formatting.
Post by: Pogwizd on Thu 14/10/2021 12:14:47
Wouldn’t this work?:
Code (ags) Select

PlayerInfoHP.Text = String.Format("-Health: %d/%d", citizens[0].hp, secondInt);
Title: Re: Multiple variables in string formatting.
Post by: Pax Animo on Thu 14/10/2021 12:26:32
Quote from: Pogwizd on Thu 14/10/2021 12:14:47
Wouldn’t this work?:
Code (ags) Select

PlayerInfoHP.Text = String.Format("-Health: %d/%d", citizens[0].hp, secondInt);


That works fine now.
On my attempts I some how messed up where to place the (,'s).

Thank you.