Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,232 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Save Error #246099
01/13/09 16:22
01/13/09 16:22
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
I'm trying to create a good working save script in my game, but something just seems to go wrong. When I start the game, I check whether the save file exists. If it does, I show two buttons, Continue and New Game. If it doesn't, I only show the New Game button. So far, so good. If you click New Game, the game starts from the very beginning, just like I told it to. All events in the game world work as well. But when I click Continue... a certain event (and probably even more as soon as I insert them) doesn't work any more. Also, when I run it in Debug Run and then click on Continue, I get the message: Error E1513 - Crash in Event.

These are the pieces of code which should take care of the Saving and Loading:

Code:
continue_handle = file_open_read("my_save1.SAV");
if (continue_handle) {continue_pan.flags = VISIBLE;
file_close(continue_handle);}

Code:
PANEL* save_pan =
{
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	button(0, 0, save_bmp, save_bmp, save_bmp, save, null, null);
}

function save()
{
	game_save("my_save", 1, SV_ALL);
}

Code:
function continu()
{
	while(key_any) wait(1);
	game_load("my_save", 1);
	wait(-1);
}


This is the action() that's not working any more after loading the game.

Code:
action grass()
{
	my.emask |= ENABLE_IMPACT;
	my.event = battle;
}

function battle()
{
	if(event_type == EVENT_IMPACT)
	{
		battle_var = integer(random(101));
		if(battle_var == 100)
		{
			gevecht();
		}
	}
}


I tried asking in the liteC part of the forum, but there was no one there who could help me.

Re: Save Error [Re: Secret_V] #246101
01/13/09 16:34
01/13/09 16:34
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
There was mention of save / load problems (bugs) for some version(s) of the engine.
Are 'you' using the latest version of the engine?

*check return value of game_load?
--does the load fail outright?
*check format of button function?
*function not declared prior to use?
*superfluous while(key_any) wait(1); ?
*block inappropriate repeat calls for continu? (already mentioned)
*save / load incompatibility with modified scripts / level? (already mentioned)
*DYNAMIC flag?
Save Error (previous thread)


Re: Save Error [Re: testDummy] #246107
01/13/09 16:59
01/13/09 16:59
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
I'm using the latest version of the engine, version 7.60, I think it was.

*check return value of game_load? game_load equals 268467760 as soon as the engine starts, I don't even have to use game_load for it.
--does the load fail outright? What exactly do you mean?
*check format of button function? A button can be any size, right? So why would this matter?
*function not declared prior to use? Every function I used has been declared before using it.
*superfluous while(key_any) wait(1); ? It doesn't matter whether this wait(1) is there or not, tried it already.
*save / load incompatibility with modified scripts / level (already mentioned)? I am aware of this, but the action doesn't work no matter what. Even if I loaded the game without modifying the script.

My entity is just a plain model, without any flags set. But when I first start the game, the action works. But when I try the action after loading with game_load, it doesn't work any more.

Re: Save Error [Re: Secret_V] #246114
01/13/09 17:41
01/13/09 17:41
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Quoting a version of the manual:
Quote:

game_load(STRING* name,var num)
Loads a saved game in the savedir folder.
...
> 0 - successfully loaded, <= 0 - file couldn't be loaded.

Code:
var bSuccess = 0;
function continu() {
	bSuccess = game_load("my_save", 1);
	// if (bSuccess == 0) { // failed outright }
}


// different format of button function
function continu(PANEL* _p, var _buttonNum) {

}



Gamestudio 7.66 public beta
Quoting pegamode.
Quote:
Thanks for publishing version 7.66.3 ... I was wondering why my savegames don't work anymore ?!?

With 7.66.3 everything works fine again.

The issues might be unrelated.






(Bah, 'I' don't even really use Lite-C / A7...still using A6.)


Re: Save Error [Re: testDummy] #246124
01/13/09 18:32
01/13/09 18:32
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
Well, the game does load normally, but the action attached to my model doesn't work any more. So in this case, bSuccess equals 1 after loading the game, cause the load itself is successful.

This is the panel I used for the function:

Code:
PANEL* continue_pan =
{
	pos_x = 30;
	pos_y = 10;
	button(0, 0, continue_bmp, continue_bmp, continue_bmp, continu, null, null);
	flags = VISIBLE;
}


It has a size of 580x118, but I don't think there's a problem with the panel, cause the function works and all, but the action doesn't work any more.

I'm using the latest version, not a beta version. So it's the version I got from the download page.

Re: Save Error [Re: Secret_V] #246146
01/13/09 20:35
01/13/09 20:35
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
If I were to change var into var_nsave, it gives me an error message: 'var_nsave' undeclared identifier.

I think continue_handle is indeed saved in my_save1.SAV, but that simply can't be the problem. Cause when I start the engine, it's value is set to a positive value if the save file exists or to 0 if it doesn't exist. If the value is positive, I can press continue. And when I press continue, the value (which should be zero) is loaded from the save file, but that doesn't matter, cause continue_handle is of no use to me any more after I load the game.

I checked all the flags of my model in my WED, but there's not a single one called Dynamic...

Edit: For some reason, the previous post I was replying to, has been deleted...

Re: Save Error [Re: Secret_V] #246196
01/14/09 01:12
01/14/09 01:12
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
According to one version of the manual, var_nsave is replaced by a suffix of _n.
Code:
var continue_handle_n = 0;

That is, any var with a name ending in _n, might NOT be saved by an invocation of game_save.
Of course, as expected, that might be consistent with the current trend of absurdity (=correctness).

Feel free to do a search in some version of the manual for term "DYNAMIC", or don't, that's OK too.

On a more or less relevant note: Perhaps, it was suggested that jcl would be 'out' for a week, but maybe not.

'I' am not one of the developers from the aptly named forum category "Ask the Developers".



Re: Save Error [Re: testDummy] #246372
01/14/09 20:46
01/14/09 20:46
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
Well, my model has an action attached to it, so it should be DYNAMIC, right? And when I use game_save, any DYNAMIC entity should be saved. So when the level loads with game_load, the DYNAMIC status of the entity should be loaded as well, am I not correct?

I tried setting the DYNAMIC flag for the entity after loading using:

Code:
grass_ent.emask |= DYNAMIC;


But then when I touch the entity, it gives me an error message: Crash in Continu().

Re: Save Error [Re: Secret_V] #246410
01/15/09 02:30
01/15/09 02:30
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Quoting Secret_V.
Quote:
Well, my model has an action attached to it, so it should be DYNAMIC, right? And when I use game_save, any DYNAMIC entity should be saved. So when the level loads with game_load, the DYNAMIC status of the entity should be loaded as well, am I not correct?

OK.
(continu -> remove waits)


Re: Save Error [Re: testDummy] #246736
01/16/09 21:31
01/16/09 21:31
Joined: Nov 2008
Posts: 50
S
Secret_V Offline OP
Junior Member
Secret_V  Offline OP
Junior Member
S

Joined: Nov 2008
Posts: 50
Isn't there even a single developer who knows what the problem is?

Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | 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