Posted By: Ruben
game_load - 07/10/15 05:20
For some reason, my "LOAD GAME" button in the beginning of the game (to load a saved game) keeps giving me a pop-up error when I click on it, as shown:
My game_load() function (to load a saved game) is inside the buttonLoadGame() function as shown at the bottom of the code below (game_save code is also shown below):
If I press the NEW GAME button at the beginning of the game, the program will start a new game just fine.
When I try clicking the LOAD GAME button, I get the pop-up error shown above. Also, none of the beeps are sounding in the buttonLoadGame() function. I just get the pop-up error.
Am I doing something wrong in trying to load the saved game ("test7.SAV" to be more specific)? I thought it seemed pretty clear cut, but maybe not.
Code:
Error E1513 Script crash in buttonLoadGame: OK Cancel
My game_load() function (to load a saved game) is inside the buttonLoadGame() function as shown at the bottom of the code below (game_save code is also shown below):
Code:
... BMAP *bmpLoadButton_on = "loadGame_button_click.pcx"; BMAP *bmpLoadButton_off = "loadGame_button.pcx"; BMAP *bmpLoadButton_over = "loadGame_button_hover.pcx"; BMAP *bmpNewGameButton_on = "newGame_button_click.pcx"; BMAP *bmpNewGameButton_off = "newGame_button.pcx"; BMAP *bmpNewGameButton_over = "newGame_button_hover.pcx"; ... PANEL* beginGameButtons = { layer = 1; button(55, 215, bmpNewGameButton_on, bmpNewGameButton_off, bmpNewGameButton_over, buttonNewGame, NULL, NULL); // "NEW GAME" BUTTON button(675, 215, bmpLoadButton_on, bmpLoadButton_off, bmpLoadButton_over, buttonLoadGame, NULL, NULL); // "LOAD GAME" BUTTON } PANEL* endGameButtons = { layer = 1; button(540, 510, bmpQuitSaveYes_on, bmpQuitSaveYes_off, bmpQuitSaveYes_over, buttonSaveGameQuit, NULL, NULL); // "SAVE AND QUIT" BUTTON button(600, 510, bmpQuitSaveNo_on, bmpQuitSaveNo_off, bmpQuitSaveNo_over, buttonNoSaveGameQuit, NULL, NULL); // "NO SAVE AND QUIT" BUTTON } ... function endGame() { ... set(endGameButtons, SHOW); // SHOWS BUTTONS TO END GAME BY // SAVING OR NOT SAVING ... } function buttonSaveGameQuit() // "SAVE AND QUIT" BUTTON FUNCTION { result = game_save("test",7,SV_ALL-SV_LEVEL); // IF I HAVE "SV_ALL" ONLY, I GET ERROR UNLESS I SUBTRACT // SV_LEVEL FROM IT. if (result <= 0) { error("Save Error!"); } sys_exit("123"); } function buttonNoSaveGameQuit() // "NO SAVE AND QUIT" BUTTON { sys_exit("123"); // EXITS GAME WITHOUT SAVING } ... action player_code() { ... on_q = endGame; // CLICKING "q" KEY ENDS THE GAME BY GIVING // YOU THE OPTION TO "SAVE AND QUIT" OR // "NO SAVE AND QUIT". ... } ... function buttonLoadGame() // GIVING THE ERROR // BUTTON THAT LOADS SAVED GAME { if(game_load("test", 7) > 0) // GIVING POP-UP ERROR { beep(); } else { beep(); } } ...
If I press the NEW GAME button at the beginning of the game, the program will start a new game just fine.
When I try clicking the LOAD GAME button, I get the pop-up error shown above. Also, none of the beeps are sounding in the buttonLoadGame() function. I just get the pop-up error.
Am I doing something wrong in trying to load the saved game ("test7.SAV" to be more specific)? I thought it seemed pretty clear cut, but maybe not.