Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: Pax Animo on 14 Oct 2021, 11:54

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

I have this line,
Code: Adventure Game Studio
  1. 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 14 Oct 2021, 12:14
Wouldn’t this work?:
Code: Adventure Game Studio
  1. PlayerInfoHP.Text = String.Format("-Health: %d/%d", citizens[0].hp, secondInt);
  2.  
Title: Re: Multiple variables in string formatting.
Post by: Pax Animo on 14 Oct 2021, 12:26
Wouldn’t this work?:
Code: Adventure Game Studio
  1. PlayerInfoHP.Text = String.Format("-Health: %d/%d", citizens[0].hp, secondInt);
  2.  

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

Thank you.