Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Matti on Thu 29/01/2009 12:19:10

Title: [SOLVED] Writing variables into a textfile
Post by: Matti on Thu 29/01/2009 12:19:10
I know how to save text to an extern .txt file and I know how to save ints but is it possible to save ints as a written text? I want to know how the NPCs in my RPG develop throughout the game and it would be very handy if I could just look at a saved textfile after playing to see the character values written down.

WriteRawLine(string text) doesn't let you include variables and WriteInt can't be used with a textfile, so is there any other way?
Title: Re: Writing variables into a textfile
Post by: Khris on Thu 29/01/2009 15:10:23
Use:
  f.WriteRawLine(String.Format("The int has a value of %d.", a));

Title: Re: Writing variables into a textfile
Post by: monkey0506 on Thu 29/01/2009 18:02:37
Khris is 100% correct. Just for reference, any function that doesn't directly support string formatting can always accept String.Format as a parameter instead.
Title: Re: Writing variables into a textfile
Post by: Matti on Thu 29/01/2009 19:46:01
Cool, thank you both.