Problems with GUI script...SOLVED

Started by JudasFm, Mon 19/07/2004 14:26:57

Previous topic - Next topic

JudasFm

Okay, so I'm a little embarrassed posting again for help on this so soon, but I'm completely and utterly flummoxed.Ã,  My GUI is set to appear whenever the user right clicks, to allow them to select the action they want.Ã,  The Smell button just turns the GUI off again and the Interact button quits the game for some weird reason.Ã,  The buttons for Save and Restore seem to work, but Quit and Restart are playing up.Ã,  I had it set so that there would be one prompt after another; the first one being along the lines of "Are you sure you want to quit/restart?" followed by another saying "Do you want to save first?"Ã,  Even if I click No or Cancel on this second one, I'm still taken to the savegame dialogue and sometimes kicked out the game.Ã,  I don't get any error messages; the line at the bottom says "Game ran successfully" so can anyone out there please tell me where I'm going wrong?Ã,  For what it's worth, the code is as follows (again with problems highlighted in red)

if (interface == INTERACTION) {
Ã,  Ã,  if (button == 0) {Ã,  // LOOK
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(1);
Ã,  Ã,  Ã,  }
else if (button == 1) {Ã,  Ã, // interact
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(2);
Ã,  Ã,  Ã,  }
else if (button == 2) {Ã,  Ã, // smell
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(8);
Ã,  Ã,  Ã,  }

else if (button == 3) {Ã,  Ã, // sense
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(10);
Ã,  Ã,  Ã,  }
else if (button == 4) {Ã,  Ã, // listen
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(9);
Ã,  Ã,  Ã,  }
else if (button == 5) {Ã,  Ã, // inventory
Ã,  Ã,  Ã,  GUIOn(2);
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  }
else if (button == 6) {Ã,  Ã, // talk to
Ã,  Ã,  Ã,  Ã, SetCursorMode(3);Ã,  Ã,  Ã, 
GUIOff(3);
Ã,  Ã,  Ã,  }
else if (button == 7) {Ã,  Ã, // walk
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(0);
Ã,  Ã,  Ã,  }
else if (button == 4) {Ã,  Ã, // listen
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã,  Ã, SetCursorMode(9);
Ã,  Ã,  }
else if (button == 8) {Ã,  Ã, // save game
Ã,  Ã,  Ã,  Ã, GUIOff(3);
Ã,  Ã,  Ã,  SaveGameDialog();
Ã,  Ã,  Ã,  }
Ã,  Ã,  else if (button == 11) {Ã,  // load game
Ã,  Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã, RestoreGameDialog();
Ã,  Ã,  Ã,  }
Ã,  Ã, else if (button == 10) { // quit game
Ã,  Ã,  GUIOff(3);
Ã,  Ã,  Ã, GUIOn(6);
Ã,  Ã,  Ã, CentreGUI(6);
Ã,  Ã,  Ã, }
Ã,  Ã, else if (button == 9) { // restart game
Ã,  Ã,  GUIOff(3);
Ã,  Ã,  GUIOn(5);
Ã,  Ã,  CentreGUI(5);
Ã,  Ã,  }
Ã,  }
if (interface == SAVEPROMPT) { // save game
Ã,  if (button == 0)
Ã,  Ã, SaveGameDialog();
Ã,  Ã, GUIOff(4);
Ã,  Ã, RestartGame();
Ã,  Ã, }
else if (button == 1) { // don't save
Ã,  Ã, GUIOff(4);
Ã,  Ã, RestartGame();
Ã,  Ã, }
else if (button == 2) { // cancel
Ã,  Ã, GUIOff(4);
Ã,  Ã, }
if (interface == RESTARTPROMPT) { //yes restart
Ã,  if (button == 0)
Ã,  GUIOff(5);
Ã,  GUIOn(4);
Ã,  CentreGUI(4);
Ã,  }
else if (button == 1) { //no don't restart
GUIOff(5);
}
if (interface == QUITPROMPT) { //yes quit
Ã,  if (button == 0)
Ã,  Ã, GUIOff(6);
Ã,  Ã, GUIOn(7);
Ã,  Ã, CentreGUI(7);
Ã,  Ã, }
Ã,  else if (button == 1) { //no don't quit
Ã,  Ã, GUIOff(6);
}
if (interface == SAVEPROMPTA) { //yes save
Ã,  if (button == 0)
Ã,  GUIOff(7);
Ã,  SaveGameDialog();
Ã,  QuitGame(0);
Ã,  }
else if (button == 1) { //no don't save
Ã,  QuitGame(0);
Ã,  }
else if (button == 2) { //forget it
Ã,  GUIOff(7);
Ã,  }
}


I've checked numbers of buttons, cursor modes etc; in fact, done everything I can think of.Ã,  What's really bugging me is that I had it working six months ago, before the virus hit and I lost most of my files and programs, including the AGS ones and backups.Ã,  I know it's probably something pretty simple that I'll kick myself over, but for the life of me I can't see what I'm doing wrong.Ã,  Any help? :)

Pumaman

if (interface == SAVEPROMPT) { // save game
  if (button == 0) {
   SaveGameDialog();
   GUIOff(4);
   RestartGame();
   }
else if (button == 1) { // don't save
   GUIOff(4);
   RestartGame();
   }
else if (button == 2) { // cancel
   GUIOff(4);
   }
}

To get help with braces, try out the Match Brace feature in the editor. Put your cursor over a { and choose the option, and it will highlight the corresponding closing brace.

JudasFm

ACK!  *thwaps self up head* Guess that's what happens when you do this too late at night ::) Thanks for your help; it all works perfectly (and I'll remember to use the Match Brace in future ;))

SMF spam blocked by CleanTalk