Multiple variables in string formatting. SOLVED

Started by Pax Animo, Thu 14/10/2021 11:54:17

Previous topic - Next topic

Pax Animo

Greetings,

I have this line,
Code: ags
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.
Misunderstood

Pogwizd

Wouldn’t this work?:
Code: ags

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

Pax Animo

Quote from: Pogwizd on Thu 14/10/2021 12:14:47
Wouldn’t this work?:
Code: ags

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.
Misunderstood

SMF spam blocked by CleanTalk