Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: vjamesv on Sat 27/01/2007 01:10:16

Title: Simple SaveLoad Question (SOLVED)
Post by: vjamesv on Sat 27/01/2007 01:10:16
I am trying to use the

Simple Save & Load 1.0 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=29566.0). 

I imported the gui, and tried saving the game and got the following message:

---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was:

In: 'Global script'



Error (line 470): Undefined token 'SaveLoad'



Do you want to fix the script now? (Your game has not been saved).
---------------------------
Yes   No   
---------------------------

How do i define SaveLoad, and where do I define it?  I don't know if it should be an int or a string...  I really just want a simple load and save gui where i can define the colors, and i think i will be asking a lot fewer questions if i can just get this script to work as opposed to making one from scratch...  thanks

Title: Re: Simple SaveLoad Question
Post by: Ashen on Sat 27/01/2007 01:27:28
It'd help if you posted what line 470 is.

SaveLoad doesn't have to be an int or String, it could be a GUI or GUI Control*. That module comes with a couple of GUIs, you need to have all of them imported for it to work - have you?

*Or a Character, Object, Inventory Item, Overlay ... Any Pointer or variable type in fact, but GUI or GUI Control is more likely here.

EDIT: OK, I've had a look at the module. SaveLoad looks to be a struct declared in the module header - if you've imported the module as well as the GUIs you shouldn't get this error. Can you just check what line 470 is?
Title: Re: Simple SaveLoad Question
Post by: vjamesv on Sat 27/01/2007 01:41:10
Okay, yes I have imported all three GUIs.  When i import the save and load ones i get this warning:

---------------------------
AGS Editor Warning
---------------------------
The imported GUI's script name clashed with an existing item in the game, so the GUI's name has been removed.
---------------------------
OK   
---------------------------

Here is what i put in the on_key_press of my global script:

#sectionstart on_key_press  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {

  if (keycode==363) gNewsave.Visible = true;   // F5

  if (keycode==365) gNewload.Visible = true;  // F7
 



Now when I save I get this message:

---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was:

In: 'Global script'



Error (line 466): undefined symbol 'deletedSave'



Do you want to fix the script now? (Your game has not been saved).
---------------------------
Yes   No   
---------------------------


So here is line 466(and the surrounding ones as well...):

#sectionstart btnDeleteconfirmYes_Click  // DO NOT EDIT OR REMOVE THIS LINE
function btnDeleteconfirmYes_Click(GUIControl *control, MouseButton button) {
  DeleteSaveSlot(deletedSave);
  lstRestoreList.FillSaveGameList();
  lstSaveList.FillSaveGameList();
  if (lstSaveList.ItemCount > 0) txtSaveInput.Text = lstSaveList.Items[lstSaveList.SelectedIndex];
  else txtSaveInput.Text = "";
  gDeleteconfirm.Visible = false;
  txtSaveInput.Enabled = true;
 
}
#sectionend btnDeleteconfirmYes_Click  // DO NOT EDIT OR REMOVE THIS LINE


Thanks for being on now Ashen.  The weekend has finally arrived and I am hoping to get the games scripts all working so i can get a beta version of the game out.  Thank you.
Title: Re: Simple SaveLoad Question
Post by: Ashen on Sat 27/01/2007 01:43:55
Again, deletedSave is declared in the module ... Obvious question here, but you HAVE imported the module as well as the GUIs, right? I can't think why else you'd be getting errors with its declarations.
Title: Re: Simple SaveLoad Question
Post by: vjamesv on Sat 27/01/2007 02:01:57
yeah that was the problem.  sorry.  it did not save, and i reloaded the game.  thanks ashen!