Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: WHAM on Wed 10/08/2011 19:39:05

Title: Int to string (Please ignore me, self solved)
Post by: WHAM on Wed 10/08/2011 19:39:05
I was hoping to record certain information into the save game header.
I wanted to see if I could create a customized save/load GUI again, and thought I'd do the following:

Create a string, then append the data, such as current date, time, and some gameplay values, which are stored as "int" -values.

Then I realized: there are several ways in the manual to convert string into almost anything, but an int value can only be converted into a float as far as I can tell.

Is there even a way to do something like this (this obviously does not work):

string taa = "Month %d:%d Day - Clock: %d:%d", dt.Month, dt.DayOfMonth, globalhours, globalminutes;

or maybe something like:

string poo = convertinttostring(dt.Month);
string taa = append.taa(poo);


EDIT: Never, bloody, mind! It happened again: I ask, and two minutes later I stumble on the answer by accident and realize I had used the wrong search parameters in the manual.

The answer: String.Format
Title: Re: Int to string (Please ignore me, self solved)
Post by: Wyz on Wed 10/08/2011 19:59:20
(for the record)
Yes, and for the other way around use:

String str = "128";
int i = str.AsInt;
float f = str.AsFloat;