//somewhere in game code our sample variables
Flt someFloatVariable;
Int customIntVariable;
//somewhere in Player class, name example
Str name;
//our saving method
Bool CustomSave(Str name)
{
//just prepare data for saving
Str player_name;
if(Players.elms())
player_name = Players[0].name;
else
player_name = "anonymous";
ConfigSave(name); //standard Esenthel config-save method
FileText f; // FileText object
if(f.append(name)) // open at the end of file
{
f.endLine(); //make some space between default and custom data
f.put ("FltVar = ", someFloatVariable); //save float data
f.put ("SomeIntVar = ", customIntVariable); //save int data
f.putName("PlayerName = ", player_name ); //save player name to config
return true; // return success
}
return false; // return fail
}
//and loading
Bool CustomLoad(Str name)
{
//temporary variables
Str player_name = "anonymous"; //if player name can't be loaded, it will be 'anonymous'
ConfigLoad(name); //Standard Esenthel config loading
FileText f;
if(f.read(name)) // if file opened successfully
{
for(;f.level();) // process file within its level
{
if(f.cur("FltVar" ))someFloatVariable=f.getReal();
else if(f.cur("SomeIntVar" ))customIntVariable=f.getInt ();
else if(f.cur("PlayerName" ))player_name =f.getName();
}
//some post-operations
if(Players.elms())
Players[0].name = player_name; //set player name
return true; // return success
}
return false; // return failure
}