Hello,
I'm new to AGS, and I've run into a small problem with two GUIs that I downloaded. I'm using LucasFan's KQV template (from Shimbleshanks' page) and Joe Carl's Save/Load and Overwrite GUI.
My problem is very simple: whenever I load a saved game, the Options menu (in the KQV template there's a separate GUI menu for the Save, Restore, Restart, and Quit buttons) always appears. I don't want it to appear, because it's too much of a hassle to click it out of the way every time a game is loaded. It's also visible whenever I click the button that brings up the Save/Restore GUI.
I've tried entering the InterfaceOff command at what I considered to be appropriate lines in the script, and this somehow ended up rendering not only the Options menu, but the icon bar permanently invisible when I restored a game. Otherwise, the two GUIs seem perfectly compatible with each other, and I'm sure I'm missing something fairly basic. Still, I think I need some advice on how to fix this problem before I do something incredibly stupid.
Here are the two relevant sections of the global script:
KQV Options GUI:
////////////////////////////////////////////////
// Options-GUI //
////////////////////////////////////////////////
if (interface == 2) {
if (button == 0) SetGameSpeed(GetSliderValue(2,0)); // slider for gamespeed
else if (button == 1) SetMusicMasterVolume(GetSliderValue(2,1)); // slider for musicvolume
else if (button == 2) game.text_speed = GetSliderValue(2,2); // slider for textspeed
else {
InterfaceOff(2);
InterfaceOn(0);
if (button == 3) SaveGameDialog(); //save game
if (button == 4) RestartGame(); // restart game
if (button == 5) { SetCursorMode(6); InterfaceOff(2); InterfaceOn(3); } // quit game
if (button == 6) Display("Eine King's Quest-Demo füare AGS. Weitere Informationen auf Adventure-Treff.de"); // about
SetDefaultCursor();
}
}
Overwrite and Save/Restore GUI:
#sectionstart overwriteSI_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
function overwriteSI_btn_Click(GUIControl *control, MouseButton button) {
int p = 0;
while(p<=partidas.ItemCount){
if((partidas.ItemCount>p)&&(partidas.Items[p]==guardar.Text)){
UnPauseGame();
gOverwrite.Visible=false;
gSaverestore.Visible=false;
cerrar.Enabled=true;
SaveGameSlot(savegameindex[p], guardar.Text);
partidas.FillSaveGameList();
guardar.Text="";
Display("Game overwritten");
return;
}
p++;
}
}
#sectionend overwriteSI_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart overwriteNO_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
function overwriteNO_btn_Click(GUIControl *control, MouseButton button) {
gOverwrite.Visible=false;
cerrar.Enabled=true;
}
#sectionend overwriteNO_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart partidas_SelectionChanged // DO NOT EDIT OR REMOVE THIS LINE
function partidas_SelectionChanged(GUIControl *control) {
guardar.Text=partidas.Items[partidas.SelectedIndex];
}
#sectionend partidas_SelectionChanged // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart guardar_Activate // DO NOT EDIT OR REMOVE THIS LINE
function guardar_Activate(GUIControl *control) {
if(guardar.Text==""){
Display("Please enter a name before saving");
return;
}
int p = 0;
while(p<=partidas.ItemCount){
if((partidas.ItemCount>p)&&(partidas.Items[p]==guardar.Text)){
Display("The game will be overwritten");
gOverwrite.Visible=true;
cerrar.Enabled=false;
return;
}
p++;
}
UnPauseGame();
gSaverestore.Visible=false;
SaveGameSlot(partidas.ItemCount+1, guardar.Text);
partidas.FillSaveGameList();
guardar.Text="";
Display("Game saved");
return;
}
#sectionend guardar_Activate // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart savegame_Click // DO NOT EDIT OR REMOVE THIS LINE
function savegame_Click(GUIControl *control, MouseButton button) {
if(guardar.Text==""){
Display("Please enter a name before saving");
return;
}
int p = 0;
while(p<=partidas.ItemCount){
if((partidas.ItemCount>p)&&(partidas.Items[p]==guardar.Text)){
Display("The game will be overwritten");
gOverwrite.Visible=true;
cerrar.Enabled=false;
return;
}
p++;
}
UnPauseGame();
gSaverestore.Visible=false;
SaveGameSlot(partidas.ItemCount+1, guardar.Text);
partidas.FillSaveGameList();
guardar.Text="";
Display("Game saved");
return;
}
#sectionend savegame_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart restoregame_Click // DO NOT EDIT OR REMOVE THIS LINE
function restoregame_Click(GUIControl *control, MouseButton button) {
if(partidas.ItemCount!=0){
int index = partidas.SelectedIndex;
RestoreGameSlot(savegameindex[index]);
partidas.FillSaveGameList();
savegame.Enabled=true;
guardar.Enabled=true;
cerrar.Enabled=true;
SetGameOption(OPT_WHENGUIDISABLED, 2);
}else Display("No game to load.");
}
#sectionend restoregame_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart borrar_Click // DO NOT EDIT OR REMOVE THIS LINE
function borrar_Click(GUIControl *control, MouseButton button) {
if(partidas.ItemCount>=1){
int index = partidas.SelectedIndex;
DeleteSaveSlot(savegameindex[index]);
partidas.FillSaveGameList();
}
}
#sectionend borrar_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart cerrar_Click // DO NOT EDIT OR REMOVE THIS LINE
function cerrar_Click(GUIControl *control, MouseButton button) {
UnPauseGame();
gSaverestore.Visible=false;
guardar.Text="";
}
#sectionend cerrar_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart FlechaPartidasUP_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
function FlechaPartidasUP_btn_Click(GUIControl *control, MouseButton button) {
partidas.ScrollUp();
}
#sectionend FlechaPartidasUP_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart FlechaPartidasDOWN_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
function FlechaPartidasDOWN_btn_Click(GUIControl *control, MouseButton button) {
partidas.ScrollDown();
}
#sectionend FlechaPartidasDOWN_btn_Click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart saverestore_Click // DO NOT EDIT OR REMOVE THIS LINE
function saverestore_Click(GUIControl *control, MouseButton button) {
partidas.FillSaveGameList();
gSaverestore.Visible=true;
mouse.UseModeGraphic(eModePointer);
}
#sectionend saverestore_Click // DO NOT EDIT OR REMOVE THIS LINE
Thanks in advance.
EDIT: fixed formatting problems.
In this part of the code, you need to make the options menu invisible. I wasn't able to find the name in the code, so I just called it gOptions here:
#sectionstart saverestore_Click // DO NOT EDIT OR REMOVE THIS LINE
function saverestore_Click(GUIControl *control, MouseButton button) {
partidas.FillSaveGameList();
gOptions.Visible=false; //LINE ADDED
gSaverestore.Visible=true;
mouse.UseModeGraphic(eModePointer);
}
#sectionend saverestore_Click // DO NOT EDIT OR REMOVE THIS LINE
In case you really are new gOptions should be translated to g and name of the gui,if using 2.72 otherwise just the name of the gui.
Okay -- I renamed the Options GUI (which was previously called GUI2) to "OPTIONS" and added the new line to the code, and at first I was getting the same problem I had before with the icon bar (GUI0) being invisible, but "gGUI0.Visible=true" easily fixed that problem.
I think this problem can be considered solved. Thank you for helping me so quickly, you two.
No trouble..