#define scr_loadGame // Loads a game from the Save_games sub-directory. { var file; file = ""; // The entered by the user var fname; // The filename for the save game including .sav suffix and absolute pathname prefix var invalid; invalid = true; // Assume save game name initially invalid while (file == "" || invalid == true) { // Loop while name of game to load blank or invalid // Get name of save game to load file = get_string('Enter the name of the save game to load:#Cannot contain < > \ / ? " * : |##Type CANCEL to cancel load.', ''); if(file == "cancel" || file == "CANCEL") // If CANCEL input in any case immediately exit exit; if(string_pos("<", file) != 0 || string_pos(">", file) != 0 || string_pos("/", file) != 0 || string_pos("\", file) != 0 || string_pos("?", file) != 0 || string_pos('"', file) != 0 || string_pos("*", file) != 0 || string_pos("|", file) != 0 || string_pos(":", file) != 0) { // Name contains invalid characters show_message(file + " contains invalid characters. No game has been loaded.#Click OK and enter a new name."); } else { // Name valid invalid = false; } } // Make into filename fname = working_directory + "\Save_games\" + file + ".sav"; if(file_exists(fname)) { // A save game with that filename exists so load it game_load(fname); show_message(file + " loaded.#Click OK and then CONTINUE GAME to continue the loaded game."); } else { // A save game with that filename does not exist so display message and exit load show_message("The save game " + file + " does not exist. No game has been loaded.#Click OK to continue."); } }