I found a rule in the manual for game_save that "levels, scripts, and objects must not change between game_save and game_load, with exception of level entities. All .._create and .._remove functions, except for creating and removing level entities, must be executed before the first game_save or game_load call. Thus, the number of engine objects like panels or texts must be the same at save and load time. When the script was changed in any way, or when the number of objects is different, game_load will fail."

I am trying to have everything execute before the game_save and game_load commands. Basically, when I play a game and save, and then quit and reload the game, and click the LOAD GAME button, I get this pop-up error:

Code:
E1513
Script crash in buttonLoadGame:
OK              Cancel



My buttonLoadGame() function code looks like this:

Code:
...

function buttonLoadGame()
{
        reset(introBackgroundImage, SHOW); // SHOWS JPEG AS SCREENSHOT
	reset(Arulia_Title, SHOW); // SHOWS TITLE OF GAME
	reset(beginGameButtons, SHOW); // SHOWS "NEW GAME" AND "LOAD GAME"
                                       //    BUTTONS
	snd_stop ( songHandle); // STOPS THE INTRO SONG

        beep();  // THIS BEEP DOES SOUND OFF.

	if (game_load("test",7) > 0) // TRIES TO LOAD THE GAME
 	{ 
		beep(); // THIS BEEP DOES NOT SOUND OFF.
	}
	else
	{
		//beep(); // THIS BEEP DOES NOT SOUND OFF.
	} 
	
        beep(); // THIS BEEP DOES NOT SOUND OFF.

	change_mouse_mode();
}

...



So, the last beep that sounds off is just before the game_load instruction. This seems to tell me that there is something wrong going on with game_load.

Once I click OK on the pop-up error mentioned before, the screen will look black, except the player's health (at the time of the last save) shows up on the screen.

I thought I minimized, transferred, or eliminated all the code from taking place between the game_save and game_load instructions or after them, as shown here:

Code:
// START OF MAIN SCRIPT FILE

...

#include "end_game.c"				 
		 
#include "gameStart_buttons.c" 

#include "mainProgram.c" 

// END OF MAIN SCRIPT FILE

...

// LAST FUNCTION IN endGame.c

function buttonSaveGameQuit()
{
	result = game_save("test",7,SV_ALL-SV_LEVEL); // SV_LEVEL GIVES ERROR
	if (result <= 0) { error("Save Error!"); }
	
	sys_exit("123"); 	
}

...

// LAST FUNCTION IN gameStart_buttons.c

function buttonLoadGame()
{
	reset(introBackgroundImage, SHOW);
	reset(Arulia_Title, SHOW);
	reset(beginGameButtons, SHOW);
	snd_stop ( songHandle);

	beep(); // THIS IS BEEPING

        if (game_load("test",7) > 0) 
	{ 
		beep(); // THIS IS NOT BEEPING
	}
	else
	{
		beep(); // THIS IS NOT BEEPING
	} 
     
        beep(); // THIS IS NOT BEEPING

	change_mouse_mode();
}

...

function main()
{
   ...

   set(introBackgroundImage, SHOW);
   set(Arulia_Title, SHOW);
   set(beginGameButtons, SHOW); // DISPLAYS "NEW GAME" AND "LOAD GAME" BUTTONS.

   while(1)
   {
   	if ( active_weapon != NULL )
   		active_weapon->pan += 5*time_step;
   		
   	mouse_pos.x = mouse_cursor.x;
        mouse_pos.y = mouse_cursor.y;
      
        // if we've enabled the mouse:
        if(mouse_mode > 0)
        {
      	  // move it's position with a cursor:
      	  vec_set(mouse_pos.x, mouse_cursor.x);
      	
        }
   		
   	wait(1);
     }
	
     sys_exit ( NULL );

     // END OF ALL MY GAME PROGRAMS AND FILES.
}



Even though I pushed the game_save and game_load functions as far down as I could in the main script file, I am still bugs mentioned above.

Anybody have a clue why?