Crazy GUI

Started by Edwin Xie, Thu 26/08/2004 07:08:03

Previous topic - Next topic

Edwin Xie

In the gui script for game there was a script for a button that closes the gui:

if (button == 11) InterfaceOff (3);

Makes the player to to room 100 (the screen where it says load/play/quit). What is wrong with that (button 11 is the button where it closes the window and Interface (or gui) 3 is the controls gui window)?
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Gilbert

Probably you didn't setup the if-else clauses properly (like misplacements of braces, etc.), you may post the whole interface_click() content here for investment.

Edwin Xie

THanks the pormt reply and here is the script for the GUI

CentreGUI(3);
  if (interface == 3){
    if (button == 8) SetGameSpeed(GetSliderValue(3,8));
    else if (button == 9) SetMusicMasterVolume(GetSliderValue(3,9));
    else if (button == 10) game.text_speed = GetSliderValue(3,10);
    else {
    if (button == 0) SaveGameDialog();
    if (button == 1) RestoreGameDialog();
    if (button == 2) QuitGame(1);
    if (button == 3) SetCursorMode(6);
    RestartGame();
    if (button == 4)
    Display("The Adventures of Bob I [[Made with Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2004 Chris Jones");
    }
  if (button == 11){
    GUIOff (3);
    SetDefaultCursor();
    }
  }
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Jay

#3
Did you mean for button 3 to restart the game? You need brackets after it, like this:

Code: ags

CentreGUI(3);
  if (interface == 3){
    if (button == Cool SetGameSpeed(GetSliderValue(3,8));
    else if (button == 9) SetMusicMasterVolume(GetSliderValue(3,9));
    else if (button == 10) game.text_speed = GetSliderValue(3,10);
    else {
    if (button == 0) SaveGameDialog();
    if (button == 1) RestoreGameDialog();
    if (button == 2) QuitGame(1);
    if (button == 3) {
       SetCursorMode(6);
       RestartGame();
       }
    if (button == 4)
    Display("The Adventures of Bob I [[Made with Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2004 Chris Jones");
    }
  if (button == 11){
    GUIOff (3);
    SetDefaultCursor();
    }
  }


But I'm not sure why you would change the cursor mode before restarting the game, so I'm probably wrong. Hopefully this leads you in the right direction.

Gilbert

Yeah jayssite got it, as that RestartGame() line wasn't inside any of the conditions, it would be executed when you click any button on that GUI, just follow his fix.

One thing I didn't understand was whay did you put a "CentreGUI(3);" within interface_click();

Seeing that interface_click() would only be executed when you click on a GUI button, that means you want to centre the GUI when you click on it?
I think that is redundant.
You should probably place that line in the codes for enabling that GUI instead.

Edwin Xie

#5
:O I think that may be the main problem why! Then the buttons after will restart the game.... Just wait a second so I can try it
....
....
....
....
....
Oh, wait I need to put in interface on for the icon bar and make the cursor regular....

Yep, works.

EDIT:
While I was posting this you replied so I didn't reply to your message but, if I place CentreGUI (); in the interface code it would center only if I click on the window.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Gilbert

Quote from: Edwinxie on Thu 26/08/2004 07:31:25
... if I place CentreGUI (); in the interface code it would center only if I click on the window.
That's what you're really doing with your codes, unless you really wanted it to behave like that.

SMF spam blocked by CleanTalk