Save and load problem

Started by Nex, Thu 22/07/2010 19:32:31

Previous topic - Next topic

Nex

all right I've made the basics of the room (a background and wlkable areas) and I play.ut hen I try to save it doesent work.WHY?
I name my save,I press the save button,it removes the gui,and when I go to restore tosee if it works the save isnt there.WHY ???

Nex

I also tried to built game at exe and to play it at onother computer

Nex

ok guys I ve searched the foroum and I dint find my answer can you post the script of the save and restore game from the defalt template or something like that would work with thedefaut gui or tell me to create a new one I dont care but help me with that

Khris

(If you create a default game to experiment, save/load functionality is implemented fully and should be working fine.)

Savegames are stored in ".../My Documents/My Saved Games/[NameOfGame]/".

During playing, there's should be a file called agssave.999 in there, and as soon as you save, a file called "agssave.001" (or .002, etc.) should be created.

So what's inside that directory?
Also, since the folder is inside one that's named like your account, AGS might have problems with special characters within the path.

(off topic: you can edit your posts, so you don't have to post multiple times.)

Nex

ok there is the save but in the game it doesont work.

It doesnt even show that I have a saved game.

Mayby my ags has a problem I dont know

Khris

Does restarting the game work? Try pressing F9. If the game does restart, at least AGS can load a save game in theory.
Did you change anything in the global script? Are you using any modules or templates?

Nex

I tryied and I also tried to make a new game with nothing inside just the bloack room but it will still not save

This hapend to me at kings quest 1 and 2 the remake version by AGD Interactive.

Does my computer have a problem?or what

Dualnames

Sorry to say this, but do you expect us to be magicians? It like going to the doctor hide behind a door and tell him

"Doctor i have a problem".

"Can I look at you?"

"No, figure it out biatchhh!"

I'm guessing you have 2 virus of the same nature on your computer. One is called w32 Worm and the other is w32 spynet and is a trojan. Try and remove those viruses. That will help.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Nex

#8
This is not posible.I formated my computer 2 weeks ago and he hasent connect to the internet by then.But at the same time I dont have an antivirus
I will look at it

And I never told to do something you cant do but if you dont know you just say "sorry I dont know the soluson to your problem"

Anyway even if it doesnt work thanks

Nex

I've cheacked evrything in my computer no virus I am really unhappy right now but I want to try this can I give you a new game that I will create and in my computer it will not save and I want to see wat happens in yours


Matti

What's up with other AGS games, does the problem appear every time?

And as Khris pointed out, there could be a problem with special characters in your file path, did you check that?

Nex

It appears on Kings Quest 1 and 2 that AGD Interactive made in their other games the save work fine exept in these two and the ones I make

Khris

Which AGS version are you using?
Operating system? Antivirus? Anything else worth mentioning about the machine?
Does the account you're using have admin rights?

Still, it sounds like some rare glitch.

Nex

I am using the latest version I downloaded it the previous week I have xp sp1 Notron antivirous and I have admin rights (I am the admin)

I will try to unistalling the program and install it again and I have the microsoft network

Khris

The latest stable version from the main page or the Final one in the thread: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37668.0 ?

Norton is generally a bad choice, regardless for what. I'd also upgrade to sp3. Not sure if any of this will fix your problem but it's a good thing to do anyway :)

Nex

can you post a link with a exe file because I only use internet from my laptop because my pc wont connect but I could use the AGS from my laptop.But nooooo my laptop closes radomly making it imposible to work.
Never mind

I cant download it from microsoft becaues it says the site is down and I am using 3.1.2.82

Dualnames

Nex, is it possible to show us the code? Are you sure that the game is actually being saved? It may be possible that you A)either don't find it on your disk
b) the command is wrong.

also, I can't for the life of me, realize what the problem really is. Do you have problems with AGS games in general? or Just the editor? or both?
Are you using the default template or the empty template?

Is there a chance you'll decide to describe your problem fully?
It is possible that you have a firewall open? Cause that has been the issue for me.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Nex

at the demo game it works but as I said Kings Quest 1 and 2 that AGD Interactive made it doesnt

but at quest for qlory 2 that AGD Interactive made it works

Do you want to show you my global script???

Nex

ok I installed it to my lptop I created a new game and I played it imidiaty so I cant change everything.It didnt work.

It like I didnt press save and I press cancel.I guess I am doing something wrong.

If someone has experienced that problem before tell me because I've tryied mane programs that make games but I think this is the best.
Anyway I will show you my global script and we will see

Nex

// main global script file

// A function that initializes a bunch of stuff.
function initialize_control_panel() {
  // Centre the control panel
  gPanel.Centre();
  // Centre the Restart dialog as well
  gRestartYN.Centre();
  if (!IsSpeechVoxAvailable()) {
    // If there is no speech-vox file, and therefore no speech,
    // disable all the controls related with speech.
    lblVoice.Visible = false; 
    btnVoice.Visible = false; 
    sldVoice.Visible = false;
  }
  else {
    // If there *is*, then set it to voice and text. It's best to use
    // both whenever possible, for the player's sake.
    SetVoiceMode(eSpeechVoiceAndText);
    // And reflect this in the control panel.
    btnVoice.Text = "Voice and Text";
  }
  if (!System.SupportsGammaControl) {
    // If we can't change the gamma settings, disable the relevant options.
    sldGamma.Visible = false;
    lblGamma.Visible = false;
  }
 
  //And now, set all the defaults
  SetMusicMasterVolume(100);
  sldMusic.Value = 200;
  sldSound.Value = 200;
  SetSoundVolume(200);
  SetGameSpeed(40);
  sldSpeed.Value = 40;
  if (IsSpeechVoxAvailable()) {
     SetVoiceMode(eSpeechVoiceAndText);
     btnVoice.Text = "Voice and Text";
     sldVoice.Value = 255;
     SetSpeechVolume(255);
  }
  if (System.SupportsGammaControl) {
    System.Gamma = 100;
    sldGamma.Value = 100;
  }
}

// Called when the game starts, before the first room is loaded
function game_start() {   
  // Put the code all in a function and then just call the function.
  // It saves cluttering up places like game_start.
  initialize_control_panel();
  // Use the KeyboardMovement module to, per default, replicate the standard
  // keyboard movement of most Sierra games. See KeyboardMovement.txt for more info
  KeyboardMovement.SetMode(eKeyboardMovement_Tapping);
}

function repeatedly_execute() {
 
  // put anything you want to happen every game cycle, even when
  // the game is paused, here
 
  if (IsGamePaused() == 1) return;

  // put anything you want to happen every game cycle, but not
  // when the game is paused, here
}

function show_inventory_window ()
{
  gInventory.Visible = true;
  // switch to the Use cursor (to select items with)
  mouse.Mode = eModeInteract;
  // But, override the appearance to look like the arrow
  mouse.UseModeGraphic(eModePointer);
}

function show_save_game_dialog()
{
  gSaveGame.Visible = true;
  // Get the list of save games
  lstSaveGamesList.FillSaveGameList();
  if (lstSaveGamesList.ItemCount > 0)
  {
    // If there is at least one, set the default text
    // to be the first game's name
    txtNewSaveName.Text = lstSaveGamesList.Items[0];
  }
  else
  {
    // No save games yet, default empty text.
    txtNewSaveName.Text = "";
  }
  mouse.UseModeGraphic(eModePointer);
  gIconbar.Visible = false;
}

function show_restore_game_dialog()
{
  gRestoreGame.Visible = true;
  lstRestoreGamesList.FillSaveGameList();
  mouse.UseModeGraphic(eModePointer);
  gIconbar.Visible = false;
}

function close_save_game_dialog()
{
  gSaveGame.Visible = false;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = true;
}

function close_restore_game_dialog()
{
  gRestoreGame.Visible = false;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = true;
}

// Called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode) {
  // The following is called before "if game is paused keycode=0", so
  // it'll happen even when the game is paused.
 
  if ((keycode == eKeyEscape) && gRestartYN.Visible) {
    //Use ESC to cancel restart.
    gRestartYN.Visible = false;
    gIconbar.Visible = true;
    // If the panel's not ON, then the player must have gotten here by tapping F9,
    // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
    // because it's already a pointer. Get used to thinking like this!!
    if (!gPanel.Visible) mouse.UseDefaultGraphic();
    return;
  }
  if ((keycode == eKeyEscape) && gPanel.Visible) {
    // Use ESC to turn the panel off.
    gPanel.Visible = false;
    mouse.UseDefaultGraphic();
    gIconbar.Visible = true;
    return;
  }
  if ((keycode == eKeyEscape) && (gSaveGame.Visible))
  {
    // Use ESC to close the save game dialog
    close_save_game_dialog();
    return;
  }
  if ((keycode == eKeyEscape) && (gRestoreGame.Visible))
  {
    // Use ESC to close the restore game dialog
    close_restore_game_dialog();
    return;
  }
 
  if (keycode == eKeyReturn) {
    // ENTER, in this case merely confirms restart
    if (gRestartYN.Visible) RestartGame();
  }

  if (IsGamePaused() || (IsInterfaceEnabled() == 0))
  {
    // If the game is paused with a modal GUI on the
    // screen, or the player interface is disabled in
    // a cut scene, ignore any keypresses.
    return;
  }

  // FUNCTION KEYS AND SYSTEM SHORTCUTS
  if (keycode == eKeyEscape) {
    // ESC
    gPanel.Visible = true;
    gIconbar.Visible = false;
    mouse.UseModeGraphic(eModePointer);
  }
  if (keycode == eKeyCtrlQ)  QuitGame(1);   // Ctrl-Q
  if (keycode == eKeyF5) show_save_game_dialog();   // F5
  if (keycode == eKeyF7) show_restore_game_dialog();  // F7
  if (keycode == eKeyF9) {
    // F9, asks the player to confirm restarting (so much better to always confirm first)
    gRestartYN.Visible = true; 
    gIconbar.Visible = false;
    mouse.UseModeGraphic(eModePointer);
  }
  if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp");  // F12
  if (keycode == eKeyTab)   show_inventory_window();  // Tab, show inventory

  // GAME COMMAND SHORTCUTS
  if (keycode == 'W') mouse.Mode=eModeWalkto; //Notice this alternate way to indicate keycodes.
  if (keycode == 'L') mouse.Mode=eModeLookat; //Note that all we do here is set modes.
  if (keycode == 'U') mouse.Mode=eModeInteract; //If you want something else to happen, such as GUI buttons highlighting,
  if (keycode == 'T') mouse.Mode=eModeTalkto; //you'll need some more scripting done.
  if (keycode == 'I') mouse.Mode=eModeUseinv; //But this will, as-is, give you some standard keyboard shortcuts your players will very much appreciate.

  // For extra cursor modes, such as pick up, feel free to add as you will.
  // Uncomment the line below if you use the "Pick Up" mode.
  //if (keycode == 'P' || keycode == 'G') mouse.Mode=eModePickup;

  // DEBUG FUNCTIONS
  if (keycode == eKeyCtrlS)  Debug(0,0);  // Ctrl-S, give all inventory
  if (keycode == eKeyCtrlV)  Debug(1,0);  // Ctrl-V, version
  if (keycode == eKeyCtrlA)  Debug(2,0);  // Ctrl-A, show walkable areas
  if (keycode == eKeyCtrlX)  Debug(3,0);  // Ctrl-X, teleport to room
  if (keycode == eKeyCtrlW && game.debug_mode)
    player.PlaceOnWalkableArea(); //Ctrl-W, move to walkable area
}


function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor
    mouse.SelectNextMode();
  }
  else if (button == eMouseMiddle) {
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
    // leave our options open - what if you have a special script triggered
    // on "walking" mode?
    ProcessClick(mouse.x, mouse.y, eModeWalkto);
  }
  else if (button == eMouseWheelNorth) {
    // Mouse-wheel up, cycle cursors
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
    // of eNums, when it suits us)...
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1;
    else
    {
      // ...but if it is WALK mode...
      if (player.ActiveInventory!=null)
      {
        //...and the player has a selected inventory item, set mouse mode to UseInv.
        mouse.Mode=eModeUseinv;
      }
      else
      {
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
        mouse.Mode=eModeTalkto;
      }
    }
  }
}

function interface_click(int interface, int button) {
  // This function is obsolete, from 2.62 and earlier versions.
}

function btnInvUp_Click(GUIControl *control, MouseButton button) {
  invCustomInv.ScrollUp();
}

function btnInvDown_Click(GUIControl *control, MouseButton button) {
  invCustomInv.ScrollDown();
}

function btnInvOK_Click(GUIControl *control, MouseButton button) {
   // They pressed the OK button, close the GUI
   gInventory.Visible = false;
   mouse.UseDefaultGraphic();
}

function btnInvSelect_Click(GUIControl *control, MouseButton button) {
 
   // They pressed SELECT, so switch to the Get cursor
   mouse.Mode = eModeInteract;
   // But, override the appearance to look like the arrow
   mouse.UseModeGraphic(eModePointer);
}

function btnIconInv_Click(GUIControl *control, MouseButton button) {
 
  show_inventory_window();
}

function btnIconCurInv_Click(GUIControl *control, MouseButton button) {
 
  if (player.ActiveInventory != null)
    mouse.Mode = eModeUseinv;
}

function btnIconSave_Click(GUIControl *control, MouseButton button)
{
  show_save_game_dialog();
}

function btnIconLoad_Click(GUIControl *control, MouseButton button)
{
  show_restore_game_dialog();
}

function btnIconExit_Click(GUIControl *control, MouseButton button) {
 
  QuitGame(1);
}

function btnIconAbout_Click(GUIControl *control, MouseButton button) {
 
  gPanel.Visible=true;
  gIconbar.Visible=false;
  mouse.UseModeGraphic(eModePointer);
}

function cEgo_Look()
{
  Display("Damn, I'm looking good!");
}

function cEgo_Interact()
{
  Display("You rub your hands up and down your clothes.");
}

function cEgo_Talk()
{
  Display("Talking to yourself is a sign of madness!");
}

//START OF CONTROL PANEL FUNCTIONS
function btnSave_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = true;
  Wait(1);
  btnIconSave_Click(btnIconSave, eMouseLeft);
}

function gControl_OnClick(GUI *theGui, MouseButton button)
{

}

function btnAbout_OnClick(GUIControl *control, MouseButton button)
{
Display("Adventure Game Studio run-time engine default game.");
}

function btnQuit_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  Wait(1);
  QuitGame(1);
  gPanel.Visible = true;
  gIconbar.Visible = false;
  mouse.UseModeGraphic(eModePointer);
}

function btnLoad_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = true;
  Wait(1);
  btnIconLoad_Click(btnIconLoad, eMouseLeft);
}

function btnResume_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = true;
}

function sldMusic_OnChange(GUIControl *control)
{
  SetMusicMasterVolume(sldMusic.Value); 
}

function sldSound_OnChange(GUIControl *control)
{
  // This sets the sound volume. Note it'll also affect MOD and XM music - read the manual
  SetSoundVolume(sldSound.Value);
}

function sldVoice_OnChange(GUIControl *control)
{
  // Sets voice volume. Note that we don't check for the existence of speech.vox -
  // we did that in game_start, so if it's not there the slider won't even be available.
  SetSpeechVolume(sldVoice.Value);
}

function btnVoice_OnClick(GUIControl *control, MouseButton button)
{
  // Note that we don't check for the existence of speech.vox - we did that in game_start,
  // so if it's not there the button won't even be available.
  if (btnVoice.Text == "Voice and Text") {
    SetVoiceMode(eSpeechVoiceOnly);
    btnVoice.Text = "Voice only";
  }
  else if (btnVoice.Text == "Voice only") {
    SetVoiceMode(eSpeechTextOnly);
    btnVoice.Text = "Text only";
  }
  else if (btnVoice.Text == "Text only") {
    SetVoiceMode(eSpeechVoiceAndText);
    btnVoice.Text = "Voice and Text";
  }
}

function sldGamma_OnChange(GUIControl *control)
{
  // Set the gamma. Note there's no need to check for anything else, as we ensured,
  // in game_start, that the slider won't even appear if it's not possible to do this.
  System.Gamma = sldGamma.Value;
}

function btnDefault_OnClick(GUIControl *control, MouseButton button)
{
  // Reset everything to default. You'll have to edit these as well as the sliders
  // if you'd rather have different default parameters.
  SetMusicMasterVolume(100);
  sldMusic.Value = 200;
  sldSound.Value = 200;
  SetSoundVolume(200);
  sldSpeed.Value = 40;
  SetGameSpeed(40);
  if (IsSpeechVoxAvailable()) {
     SetVoiceMode(eSpeechVoiceAndText);
     btnVoice.Text = "Voice and Text";
     sldVoice.Value = 255;
     SetSpeechVolume(255);
  }
  if (System.SupportsGammaControl) {
    System.Gamma = 100;
    sldGamma.Value = 100;
  }
}
//END OF CONTROL PANEL FUNCTIONS

function dialog_request(int param)
{
  // This is used by the dialog text parser if you need to process
  // text that the player types in to the parser.
  // It is not used by default.
}

function sldSpeed_OnChange(GUIControl *control)
{
  SetGameSpeed(sldSpeed.Value);
}

function btnRestart_OnClick(GUIControl *control, MouseButton button)
{
  gRestartYN.Visible=true;
  gIconbar.Visible=false;
}

function btnRestartYes_OnClick(GUIControl *control, MouseButton button)
{
  RestartGame();
}

function btnRestartNo_OnClick(GUIControl *control, MouseButton button)
{
  gRestartYN.Visible = false;
  gIconbar.Visible = true;
  // If the panel's not ON, then the player must have gotten here by tapping F9,
  // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
  // because it's already a pointer. Get used to thinking like this!!
  if (!gPanel.Visible) mouse.UseDefaultGraphic();
}

function btnCancelSave_OnClick(GUIControl *control, MouseButton button)
{
  close_save_game_dialog();
}

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSaveGamesList.Items == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots;
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();
}

function btnCancelRestore_OnClick(GUIControl *control, MouseButton button)
{
  close_restore_game_dialog();
}

function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
  if (lstRestoreGamesList.SelectedIndex >= 0)
  {
    RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]);
  }
  close_restore_game_dialog();
}

function lstSaveGamesList_OnSelectionCh(GUIControl *control)
{
  txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex];
}

function txtNewSaveName_OnActivate(GUIControl *control)
{
  // Pressing return in the text box simulates clicking the Save button
  btnSaveGame_OnClick(control, eMouseLeft);
}

function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
  if (lstSaveGamesList.SelectedIndex >= 0)
  {
    DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
    lstSaveGamesList.FillSaveGameList();
  }
}

SMF spam blocked by CleanTalk