Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, SBGuy, TipmyPip, ozgur), 923 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
game_load #453168
07/10/15 05:20
07/10/15 05:20
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
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:

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.

Last edited by Ruben; 07/10/15 05:40.
Re: game_load [Re: Ruben] #453170
07/10/15 07:01
07/10/15 07:01
Joined: Nov 2009
Posts: 201
Logitek Offline
Member
Logitek  Offline
Member

Joined: Nov 2009
Posts: 201
Is savegame number 7 in the savegame folder available?
Do you have specified a savedir folder?
*)But both should make no problems. There would be a beep.

First I thought it is maybe only the savegame. The error message 1513: missing entity, try to use an empty pointer, or a DEP (data execution prevention) problem, or a damaged sound, model or image.

I think it is a missing entity or something like that, because you have saved the game without Levels. So all the entitys are not saved, but you load the savegame with the actions for that missing entity.

Re: game_load [Re: Logitek] #453171
07/10/15 08:08
07/10/15 08:08
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
What I find odd is that lets say I start a new game, and lose some health from 500 down to 320. I will then press the "q" key, and the game will ask me if I want to "save and quit" or "not save and quit". I click the button to "save and quit".

I then start the game over, and when the "NEW GAME" and "LOAD GAME" buttons show up, I click the "LOAD GAME" button, but I get the pop-up error mentioned above. However, I am still on the screen with the "NEW GAME" and "LOAD GAME" buttons, so I decide to click the "NEW GAME" button. The game starts up, and I now have 320 health like I had when I saved my game.

However, when I press the "i" key to bring up my inventory bag, the inventory bag does not display at all, like it normally does. For example:

Code:
player_code()
{
   ...

   on_i = toggleInventory; // WORKS ORIGINALLY, BUT NOT AFTER STARTING A "NEW 
                           //    GAME" BY CLICKING THE "NEW GAME" BUTTON, AFTER 
                           //    UNSUCCESSFULLY TRYING TO LOAD MY LAST SAVE 
                           //    USING THE "LOAD GAME" BUTTON.

   ...
}



In other words, when I start a new game by clicking the "NEW GAME" button, toggling my inventory bag by pressing "i" works. When I save my game, and try to renter the game by restarting it, and click the "LOAD GAME" button to load my last save, I get the pop-up error.

However, I am still on the original page with the "NEW GAME" and "LOAD GAME" buttons. I therefore click the "NEW GAME" button, and my game launches, and even shows the health I had when I last saved my game. However, I am now not able to toggle my inventory bag by pressing the "i" key. Strange...

Re: game_load [Re: Ruben] #453172
07/10/15 09:27
07/10/15 09:27
Joined: Nov 2009
Posts: 201
Logitek Offline
Member
Logitek  Offline
Member

Joined: Nov 2009
Posts: 201
Originally Posted By: Ruben


I then start the game over, and when the "NEW GAME" and "LOAD GAME" buttons show up, I click the "LOAD GAME" button, but I get the pop-up error mentioned above. However, I am still on the screen with the "NEW GAME" and "LOAD GAME" buttons, so I decide to click the "NEW GAME" button. The game starts up, and I now have 320 health like I had when I saved my game.


Because of the problem I have written in my first post.
The game is loaded, all the variables I think, BUT not the entity that is missing. So you got the error message.

And if you start then a new game, the health variable is already changed to the saved one, because you have loaded the savegame file. It is only not completely, because "levels" is missing in the save game file.

The health does not change to the original value of 500 because I am sure you have declared it with "500" before you start a new game. Not in the part after you have pressed "Start new game". So it keeps the value from the savegame you have loaded. Also if the savegame gives you an error.

Re: game_load [Re: Logitek] #453174
07/10/15 09:51
07/10/15 09:51
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
I am leaving out the SV_LEVEL flag of game_save() because it is the only flag that I get an error with using game_save(). I would like to keep the SV_LEVEL though if I could. Do you know of any way that I can use the SV_LEVEL flag in the game_save() function (use SV_ALL flag only) without it giving a pop-up error?

Re: game_load [Re: Ruben] #453175
07/10/15 10:21
07/10/15 10:21
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Save the string of the level and load it manually with level_load? ..

Re: game_load [Re: Ch40zzC0d3r] #453176
07/10/15 11:15
07/10/15 11:15
Joined: Nov 2009
Posts: 201
Logitek Offline
Member
Logitek  Offline
Member

Joined: Nov 2009
Posts: 201
I personally use SV_ALL-SV_INFO

What is the error message you get if you use it with LEVELS?
I have not seen it in your post. Only for loading.

Re: game_load [Re: Logitek] #453189
07/11/15 02:54
07/11/15 02:54
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Originally Posted By: Logitek
I personally use SV_ALL-SV_INFO

What is the error message you get if you use it with LEVELS?
I have not seen it in your post. Only for loading.

I get a pop-up error box stating:

Code:
Error E1513
Script crash in buttonSaveGameQuit:
OK                   Cancel


...when I press the "q" key, and press the "SAVE" button, with the code below.

Code:
...

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

   sys_exit("123"); 	
}

function buttonNoSaveGameQuit()
{
   sys_exit("123"); 
}

...


Last edited by Ruben; 07/11/15 03:20.
Re: game_load [Re: Ch40zzC0d3r] #453191
07/11/15 03:22
07/11/15 03:22
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Originally Posted By: Ch40zzC0d3r
Save the string of the level and load it manually with level_load? ..

I am sorry, but I am rather new to the whole level_save and level_load.

How would I save the string of a level?

Re: game_load [Re: Ruben] #453192
07/11/15 07:18
07/11/15 07:18
Joined: Nov 2009
Posts: 201
Logitek Offline
Member
Logitek  Offline
Member

Joined: Nov 2009
Posts: 201
I know, it is a stupid question, but is it possible that you kill the level before you save it?

I mean, do you unload the level? If yes, then he can not save the level.
There must be any kind of error in the script. Otherwise it makes no sense.

Have you checked if the savegame is in the folder? With and without levels-option.

Which OS do you use? And in which folder do you write? I mean, is it in the program folder? or anywhere else? Because of rights.

What kind of level has the game?
You can try to make a simple level with wed and start it instead of your level and try to save it with your script. I think it will work, because I don't see a problem with the lines you have posted.

Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1