Here is the final Savegame() / LoadGame() function, if anyone wants to use it. It saves your (x,y) position, the map you were on, and the value of all flags. *NOTE* The number of flags you have is represented by number in the declaration of the while loop.
void SaveGame()
{
int savefile = FileOpen("save.pcx", FILE_WRITE);
string x = str(entity.x[player]);
string y = str(entity.y[player]);
FileWriteLn(savefile, curmap.path);
FileWriteLn(savefile, x);
FileWriteLn(savefile, y);
int i = 0;
while(i <= 14)
{
FileWriteLn(savefile, str(flag));
i++;
}
FileClose(savefile);
}
void LoadGame()
{
int savefile = FileOpen("save.pcx", FILE_READ);
FileSeekPos(savefile, 0, SEEK_CUR);
savemap = FileReadLn(savefile);
int posx = val(FileReadLn(savefile));
int posy = val(FileReadLn(savefile));
int i = 0;
while(i <= 14)
{
flag= val(FileReadLn(savefile));
i++;
}
FileClose(savefile);
mapswitch(savemap, abs((posx/16)), abs((posy/16)), "D", TRANS_FADE);
}