Error: Restore_Game: Game has changed (views) - SOLVED

Started by EnterTheStory (aka tolworthy), Sat 18/04/2009 15:28:13

Previous topic - Next topic

EnterTheStory (aka tolworthy)

I'm writing code for moving back and forth between games, using 'RunAGSGame.' Before leaving a game I save it. When coming back I load the saved game. But on the way back I always get this error message:


Code: ags

---------------------------
Adventure Game Studio
---------------------------
An error has occured. Please contact the game author for support, as this
is likely to be a scripting error and not a bug in AGS.
(ACI version 2.72.920)

Error: Restore_Game: Game has changed (views), unable to restore position

---------------------------
OK   
---------------------------


Any idea what I should do? Any ideas would be greatly appreciated!

GarageGothic

Have you checked that you're restoring the right slot and that the savegame folders are set up correctly? Try deleting/moving any existing savegames to make sure that it's actually the savegame you just saved and not some old file that is being restored. Are the savegames from the two games in the same or in different folders?

Edit: Additional questions, is the restore code called from game_start? And is RunAGSGame called with the "mode" parameter set to 0 or 1?

Edit 2: Saw your comment on the blog about generating savegame names from variables. While troubleshooting, maybe you could try commenting out that line and substitute it with a static name? Just to rule out an error source.

EnterTheStory (aka tolworthy)

Each time I delete all savegames. Then:
1. Start game 1 normally.
2. jump to room 82 (my 'between games' room).
3. save 'between games' variables to a DAT file.
4. save game 1 as 'agssave.101' (so it won't show up in any load game list, which only looks for the first 50 games).
5. jump to game 2 using RunAGSHGame(gamename, 1,1).
6. game 2, before the game starts, reacts to the last '1' argument and jumps to room 82 instead of the normal intro
7. room 82, when player enters, detects that there is no 'previous room' and hence this is for entering the game and not leaving.
8. room 82 looks for a saved game (at this stage there is none)
9. room 82 reads the 'between game' variables and jumps to the desired room as specified in 'between games.dat'.
So far so good.
10. I then use a hotkey to reverse the process, going back to game 1. This time game 1 already has a saved game, and hence CRASH with the error message given above.

Quote from: GarageGothic on Sat 18/04/2009 22:36:04
Have you checked that you're restoring the right slot and that the savegame folders are set up correctly?

My current thinking is maybe I'm naming the saved games in some stupid way. Maybe I've somehow told the second game to read the first game file. I name the games based on the name of the current game, but when game 1 launches game 2, game 1's name still appears on the window bar (when running the game in a window). Maybe this is significant?

It's really the word "views" in the error message that throws me. Maybe it's distracting me from something more mundane.

Anyway, thanks for the response. Much appreciated. It's getting late here in Scotland and I'm even more stupid than normal when I'm tired, so in the morning I'll have a close look at the game naming code and get back to you.

GarageGothic

Hmm, do you have some kind of Wait(1) or similar between saving one game and running the other? Saves are only performed at the end of the function, so if you change games in-between perhaps this could cause problems.

Edit: No, actually Wait(1) still wouldn't work, I think, since the function is still running. Setting a variable to a certain value (e.g. "bool changegame = true") and checking for that in repeatedly_execute would work though. Of course you would have to set it to false again in on_event eEventRestoreGame.

EnterTheStory (aka tolworthy)

edit: Solved! Thanks to your suggestions.

Saves are queued until control returns to the user. This did not happen until the new game was loaded. I checked the saved game in Notepad, and it contained the name of the SECOND game (I wanted to save the FIRST game). I suspect it contained data from the first, which would explain why AGS crashed and complained about changed views. (Normally if you load a saved game from another game, the correct game is automatically launched)

Anyway, I used rep_ex to ensure a non-blocking gap between saving the game and changing games, and everything is behaving itself.

Now I can walk backward and forward between any room in game 1 and any room in game 2, with everything neatly saved or transferred in the background. Happy day!

SMF spam blocked by CleanTalk