Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shayavr on Sat 22/10/2011 19:32:46

Title: GUI button with veriable value as text
Post by: shayavr on Sat 22/10/2011 19:32:46
hello

This must be an easy one. But I couldn't find solution on the forum and couldn't figure out how to do this myself:

I want to create a GUI for the player to set a 4 digit code to open a suitcase.
So I create a button for + and a botton for -

now I want to create a button that shows the value of the digit but don't know how..

many many thanks!
Title: Re: GUI button with veriable value as text
Post by: geork on Sun 23/10/2011 00:02:03
 Buttons can display a string, so just format that string using String.Format

  int Value = 0 //or whatever value, this'll change i presume...

  ButtonName.Text = String.Format("%d", Value)


If your unsure about String formatting, that's something handy to look up in the manual