I made custom GUIs for the save and load functions and everything seems to work fine up to a point when the game kicks out with this error message:
Quote
Illegal exception
--
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x004615AC ;
program pointer is +2051, ACI version 2.72.920, gtags(1,5)
Did I assign a conflicting GUI name that gets mixed up with something that is already hardcoded?
GUIs I have at the moment:
gSave
gLoadGames
gYesNo
Thanks
Edit by strazer: Please post error messages in clear text so they show up in the forum search!
Can you post the portion of codes around the saving/loading part?
Is it one particular save game that has the problem, or can you not load any saved games?
Quote from: Gilbot V7000a on Sat 14/04/2007 14:24:11
Can you post the portion of codes around the saving/loading part?
The save part works just fine
function SaveGame(){
int index = lstSaved.ItemCount;
if(index < 10){
String GameReference = txtboxSaved.Text;
SaveGameSlot(index+1, GameReference);
mouse.Mode = eModeWalkto;
gSave.Visible = false;
#sectionstart btnSaveGame_Click // DO NOT EDIT OR REMOVE THIS LINE
function btnSaveGame_Click(GUIControl *control, MouseButton button) {
SaveGame();
}
#sectionend btnSaveGame_Click // DO NOT EDIT OR REMOVE THIS LINE
The load part just kicks out of the game
#sectionstart btnLoadGame_Click // DO NOT EDIT OR REMOVE THIS LINE
function btnLoadGame_Click(GUIControl *control, MouseButton button) {
int loadgame = lstLoadGame.SelectedIndex;
Wait(5);
RestoreGameSlot(loadgame);
}
As for CJ's question,
It doesn't work for anything that I tried.
Note that the indices in a listbox starts from 0, while the same game slots starts from 1. Moreover, if no item is selected the SelectedIndex is -1.
These can cause problems if not handled properly.
So I think (not tested) the load game part could use some tweaking:
function btnLoadGame_Click(GUIControl *control, MouseButton button) {
int loadgame = lstLoadGame.SelectedIndex;
if (loadgame != -1) {
Wait(5);
RestoreGameSlot(loadgame+1);
}
}
I'm too lazy to check, but probably there is a similar problem with saving at incorrect slot index for the sabe game part as well.
Actually, savegames aren't stored the same way they're displayed in listboxes, so you have to use the SaveGameSlots property:
RestoreGameSlot(lstLoadGame.SaveGameSlots[loadgame]);
You still need the "nothing selected" check though, as Gilbot pointed out.
Even so, it shouldn't cause the engine to crash. Any chance you could upload the game for us to investigate, or is it too large to reasonably do that?
Zipped the game is about 1meg. Just tell me where I can upload it to. I'm still battling with a some of the logic issues on the saveGUI so I'll just comment it out to send the file.
Try here: http://americangirlscouts.org/agsuploads/index.php
CJ,
Tried it but couldn't get in with my username and password for AGS as mentioned. I don't think it will do much good now because I changed a lot of the code before I checked the forum again.
One possible issue is that my script was a mix of old and new (no boxes checked in general setting under the script option). Anyway I solved the problem with the advice from Gilbot and SupSuper.
Thanks