save & load game bug (?)

billchelonis
Create an object, call it "door" and set the property IsOpen=0. Now make an action script to open the door by the player when they type "open door." Okay.. the door's open. Now save game, then load game. Guess what? The door's closed. [edited] had thought it made IsOpen=0 again, not 1, but it's the newly created room exit itself not being saved.

Another thing it's not saving is when that door object creats a new room exit. The save game loaded back up again loads the game's default state for all room exits (i.e. if the game starts with a door closed and the player opens it and that creates an exit north that wasn't there before, doing save, then load doesn't seem to save that new northward exit. So what winds up happening is the player has to close the door and re-open it again to re-create the exit).

[edited]
My bad... it IS saving the object property of IsOpen=1... it's not, however, saving the new room exit(s) state.

By the way, what does the save game feature actually save? The global variables? If so I might rework my code so it stores object properties as a global variable instead.

Also, some who have been testing my beta game are finding the game crash on saves and loads, but say this is common with other quest games as well. If you don't save or load the crash doesn't happen. Only on save or load. (I'm using global arrays to some degree... maybe that is causing the crash because of the brackets?)

What might be a nice feature is to have the option of running an additional script after the player loads a game. Just an idea. Sort of like have an "on load saved game" script. That way (like in my door object bug) I could write a work-around script once (i.e. a for loop to go through all the rooms and make sure doors are open or closed and the exits are created or erased). Could also use this type of script area to keep track of how many times the player is restoring a game, or have some narration remind the player where the game left off.

Alex
The "save game" function should save everything that has changed since the ASL file was loaded. If anything isn't being saved, then it's a bug.

I'm away from my usual development machine for the next week, but I seem to recall some issue with saving room exits which I had either fixed or was going to look into... I presume you're using the latest version (3.52)?

What do you mean by "crash" - does Quest lock up, or do you get an error message? If you get an error message then please tell me what the error is, and send me the QSG file and the ASL file and I can take a look into the problem.

You can run script when the player loads a game - in the regular startscript (in QDK, in the Game Properties window, "run this script when the game starts" or words to that effect), just check the $loadmethod$ function. If this is "loaded" then the game was loaded from a QSG file, so put any script necessary here. More information at http://www.axeuk.com/quest/developer/as ... ctions.htm .

billchelonis
Thanks. I'll have my beta-testers let me know what crash error(s) they get when it happens and pass it along here when/if it happens again and then if it does I'll send you the .ASL file too. I'm unable to replicate it myself though so I have no idea how the game is crashing on them or what error they're getting.

I have the registered version 3.52.

I'll try cleaing up my code a bit more and see if that helps. I'm sure it's not crashing because of the game engine. It must be something in my code somewhere (usually a percent sign where a dollar sign should be is what I notice will crash the game, but that stuff I've cleaned out already... hopefully).

Wondering if this type of reference would crash it:
%My_Array[100]%
OR
%My_Array[%tempNumber%]%

Alex
The first type of array is fine, but the second type should be:

%My_Array[tempNumber]%

without "%" around the variable array index in the brackets.

This shouldn't crash Quest though - it should just come up with an error, because it will be trying to access two non-existent variables

%My_Array[%

and

%]%

so you would just see an error in the ASL log file and the game would continue.

billchelonis
Thanks on the array clarification. I was getting some errors on that but it's nice to know the correct way to refer to a variable within an array bracket like that.

I'll email you the .ASL file for the direction change bug on save/load.

Run the game. Do an "open door" command at the start room. It creates an exit north. "Save".... then "Load".... north direction is gone, however if you type "open door" it'll say (correctly) that the door is already open. "Close Door"... "Open Door"... and north exit is there again.


[edited]... well, that file I sent seems to have some bugs in my code. I cut out alot of the functions to save you from too huge of a file (the full thing is about half a megabyte already) and it's generating errors in the log for variables not in the game. So if you do too much exploring of the game world it'll eventually do bad things (wipe out the room desc. text for one). I could sent the "error free" version but it's a pretty big file. I just wanted you to see this directional bug/problem (?).

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums