Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Afflict on Tue 29/11/2005 20:28:12

Title: QFG - Engine
Post by: Afflict on Tue 29/11/2005 20:28:12
So heres the I tried too search this couldnt find anything appropriate,
I want to import and export character detials like the QFG games did?
Is this possible?

Please note I really suck at coding I am a graphic artist. 8)
Title: Re: QFG - Engine
Post by: on Tue 29/11/2005 20:45:50
It would be easy to save all the details in a file. Then load the file in the the new game and extract the data.

In your first game make a function in the global script like this


function saveDetails() {
Ã, File* output = File.Open("details.dat", eFileWrite);
Ã, if (output != null) {
Ã,  Ã, // write details Ã,  Ã, 
Ã,  Ã, output.WriteInt(HP); Ã,  Ã,  // where HP an int declared globally at start of Ã,  Ã, 
Ã,  Ã, //global script)
Ã,  Ã, output.WriteString(name); Ã, // where name of character a string declared
Ã,  Ã, // in global script at start
Ã,  Ã, // write more ...
Ã,  Ã, output.close();
Ã, }
}

Then in your second game have a similar function in your global script

function readDetails() {
Ã, File* input = File.Open("details.dat", eFileRead);
Ã, if (input != null) {
Ã, HP = Ã,  input.ReadInt(); Ã, // where HP an int declared globally
Ã, // etc...
Ã, }
}