Hi everybody!
First of all, I think it is not possible to change the description of a savegame slot after the safegame has been created. Right?
So I'm playing with writing to files for the first time.
Here is question one:
If I write a string into a file using this code:
String buffer = "TestDescription";
File *output = File.Open("SaveDescription.dat", eFileWrite);
output.WriteString("%s", buffer);
I get the error "Invalid number of parameters in WriteString". So, how can I write a buffer into the file?
And one more question: if I write multiple strings into a file (always using the "WriteString" function) how do I know which one I get if I later use the "ReadStringBack" function?
Many thanks in advance!
Stefan
1st - CHange the description of a savegame? Sort of - if you overwrite the slot with a new saved game with a new description... but I think that's all you can do.
2nd - I don't have access to the manual right now, but check out whatever has replaced the StrFormat() function and use it to create the string you need for "output.WriteString".
3 - From what I understand, it goes like this: open a file and call five WrtiteStrings and 5 will be created -. let's call them 1 to 5. Then close it and call ReadStrings 5 times - the five will be called, in the same order. Andf if you wanted to, say, read the fourth string, you'd call ReadString 4 times, always overwriting the previous one. I THINK this is how it works... bit of a hassle IMHO but not a major one, and it works.
Thanks for your answer, Rui!
The Manual says that StrFormat() was replaced by
static String.Format(string fmt, ...)
I tried to implement it this way:
String buffer = "test";
File *output = File.Open("SaveDescription.dat", eFileWrite);
output.WriteString( String.Format("%s",buffer) );
output.Close;
However, I get an error in the last line of the above script: Expected '('
Any ideas?
output.Close();, perhaps?
:-X ... ups ::)
Well, now it works.
Thanks for your help!
Also, there's no need to do this:
output.WriteString( String.Format("%s",buffer) );
since you can just do this:
output.WriteString(buffer);
And yes, as Rui says, if you use multiple WriteStrings, then ReadString will read them back one by one in the same order as you wrote them.