QFG - Engine

Started by Afflict, Tue 29/11/2005 20:28:12

Previous topic - Next topic

Afflict

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)

scourge

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

Code: ags

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
Code: ags

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

SMF spam blocked by CleanTalk