Need help with custom load button (SOLVED)

Started by ShrillMegaTonsec, Thu 18/04/2024 18:41:17

Previous topic - Next topic

ShrillMegaTonsec

hello, im working on my own project using the sierra template and while creating the main enu i've run into a problem
I can't get the second "load" button i made to reload the saves

Code: ags
function btnLoad2_OnClick(GUIControl *control, MouseButton button)
{
  RestoreGameSlot(0);
}

how can I get it to load the first slot? I tried putting int 1 but that didn't anything

Crimson Wizard

First of all, check if this function is run at all. The easiest way to do so is to add "Display("i am here!");" command there.

If it is not run, double check that you have connected this function to the button's event, on its events page.

Finally, does the save in question actually exist?

ShrillMegaTonsec

Quote from: Crimson Wizard on Thu 18/04/2024 19:30:24First of all, check if this function is run at all. The easiest way to do so is to add "Display("i am here!");" command there.

If it is not run, double check that you have connected this function to the button's event, on its events page.

Finally, does the save in question actually exist?

hey

so i tried to check if the function is working by doing what you said and nothing happened unfortunately

i tried to set the event from the gui's command too and nothing happened

and i did save in game using the default settings

Code: ags
 function btnLoad2_OnClick(GUIControl *control, MouseButton button)
{
  Display("im here");
  {
  RestoreGameSlot(0);
}
}


function gTest2_OnClick(GUI *theGui, MouseButton button)
{
  Display("im here");
  if (lstRestoreGamesList.SelectedIndex >=0)
  {
   
    RestoreGameSlot(0);
  }
  
}

Crimson Wizard

Do you actually connect these functions to gui events, or just copy/paste them into the script?

The gui functions should be connected to events, similar to how shown on this screenshot:
https://adventuregamestudio.github.io/ags-manual/images/acintro3_03.png

ShrillMegaTonsec

Quote from: Crimson Wizard on Thu 18/04/2024 20:32:32Do you actually connect these functions to gui events, or just copy/paste them into the script?

The gui functions should be connected to events, similar to how shown on this screenshot:
https://adventuregamestudio.github.io/ags-manual/images/acintro3_03.png

I didn't copy and paste anything I actually went to the button and gui's event and picked onClick on both

Now what?

ShrillMegaTonsec

#5
Quote from: Crimson Wizard on Thu 18/04/2024 20:32:32Do you actually connect these functions to gui events, or just copy/paste them into the script?

The gui functions should be connected to events, similar to how shown on this screenshot:
https://adventuregamestudio.github.io/ags-manual/images/acintro3_03.png

nvm! i fixed it by basically re-routing the save slot from the save button found in gSaveGame

i did this for the save button script:
Code: ags
{
Display("Game Saved!");
SaveGameSlot(1, "SaveGame1");
}

and for the load function i did the following:
Code: ags
{
if(Game.GetSaveSlotDescription(1) !=Null)}
Display("Save file loaded");
RestoreGameSlot(1);
{

thanks for reaching out though i appreciate that

SMF spam blocked by CleanTalk