Help With Menu GUI

Started by , Sun 26/09/2004 00:16:30

Previous topic - Next topic

Plog

Ok i've got a game with 2 identical looking menu GUIs one that is just there at the start and as you enter room 2 before fade in it turns it off.

if (interface == SMENU) {
  if (button == 0) {
    NewRoom(2);
    }
  else if (button == 1) {
    QuitGame(1);
    }
  else if (button == 2)
  RestoreGameDialog();
  else if (button == 3)
  SaveGameDialog();
}

Button 0 being New Game.
1 = Quit
2 = Load
3 = Save

Then the other GUI appears when you press the Menu button on my ICONBAR GUI and the script for it is slightly different...

if (interface == MENU) {
  if (button == 0) {
    RestartGame();
    }
  else if (button == 1) {
    QuitGame(1);
    }
  else if (button == 2)
  RestoreGameDialog();
  else if (button == 3)
  SaveGameDialog();
}

My problem is that when I select 'New Game' on the second GUI it goes to the first GUI meanng I have to press it twice to get it to work. And this is annoying so anyone know how I can stop the first GUI from showing after I press 'New Game' on the second and then go to room 2.

Thanks in advance.

BorisZ

Why don't you use:
GUIoff(firstGUI);

Plog

Dosn't seem to want to work.

Or i'm putting it in the wrong place.

Edwin Xie

The problem is that when you use RestartGame() you go to the room or GUI you started the game with. Instead you can manually script it without using RestartGame().
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

BorisZ

Oh, the second GUI appears AFTER new game is started? Is that so?

Plog

Quote from: Edwin Xie on Sun 26/09/2004 00:23:12
The problem is that when you use RestartGame() you go to the room or GUI you started the game with. Instead you can manually script it without using RestartGame().

Err... how exactly do I go about doing that.

Ashen

I take it room 2 is where the actualy game starts? (Like room 1 is just intro)
If so, use SetRestartPoint (); in room 2's script - I think 'First time player enters screen' would be best. This'll change the point RestartGame(); sends you back to, so you avoid the SMENU GUI, and the second button press.
I know what you're thinking ... Don't think that.

Edwin Xie

 :o Wow, you explain it better than I would.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Plog

Quote from: Ashen on Sun 26/09/2004 00:28:39
I take it room 2 is where the actualy game starts? (Like room 1 is just intro)
If so, use SetRestartPoint (); in room 2's script - I think 'First time player enters screen' would be best. This'll change the point RestartGame(); sends you back to, so you avoid the SMENU GUI, and the second button press.

Ok I did it and it didnt work.

In room 2 I have just a black background and then after fade in it shows a few messages and goes to room 3. But when I do 'New Game' now it just has the black background and it does nothing. :\

Edwin Xie

Ok.....you have to create a new room showing the intro without the GUI. Use SetRestartPoint().........Hey, Ashen, how do you use this global function? I'm not familiar with these. They are more used like "if (something=int) SetBlahBlah" hard to do if you wanted to change it.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

BorisZ

Quote from: Edwin Xie on Sun 26/09/2004 01:30:37
Ok.....you have to create a new room showing the intro without the GUI. Use SetRestartPoint().........Hey, Ashen, how do you use this global function? I'm not familiar with these. They are more used like "if (something=int) SetBlahBlah" hard to do if you wanted to change it.

You don't need if,  the begining of the game is always on the same place.

Edwin Xie

Good point, but then you would have to script global variables on whether to show the first GUI or not.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Ashen

#12
If you haven't already, you could try moving SetRestartPoint(); to where ever the messages run from, e,g,
Code: ags

SetRestartPoint();
Display ("blahblahblah");
NewRoom (3);

I only suggested putting it in 'First time player enters screen' thinking room 2 was playable, and you wouldn't want the restart point reseting every time they walked in.
I don't really know how SetRestartPoint(); works, other than what it says in the manual, as I've never had to use it. I don't think using global variables or ints would work though, as they'd presumably be reset when you restarted the game.

Another suggestion would be to use SaveGameSlot (int slot, string description) in room 2, save a game in a slot higher than 20 (the save/restore list box only allows 20 save slots by default), then use RestoreGameSlot (int slot); instead of RestartGame(); on the MENU GUI, so:
Code: ags

In Room 2:
SaveGameSlot (30, "restart game"); // 
Display ("blahblahblah");
NewRoom (3);

In interface_click:
if (interface == MENU) {
Ã,  if (button == 0) {
Ã,  Ã,  RestoreGameSlot (30);
Ã,  }



EDITTED to correct italics, and add:
Another idea might be to use RunAGSGame (string filename, int mode, int data);
to restart the game. int data can be passed into the 'new' game as the game.previous_game_data variable, which you could use to 'skip' the room with the SMENU GUI. Just a thought.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk