Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Menu problem again!  (Read 3624 times)

0 Members and 1 Guest are viewing this topic.

wanted123

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Menu problem again!
« on: March 07, 2011, 07:43:38 PM »

It's me again.. I have problems with the main menu when the game loads the menu is there (I have 2 menus - one when you start the game and 1 in game when you press ESC the other menu load) and when I press ESC the game starts. I want when I press the ESC key to show the quit window. I try with this:

Code: [Select]
on "keypress"
{
if(Keyboard.KeyCode==VK_ESCAPE){

var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  if(WinQuit.xResult)
  {
    Game.QuitGame();
  }
  else Game.UnloadObject(WinQuit);
   
  }
}

Logged

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: Menu problem again!
« Reply #1 on: March 09, 2011, 04:55:47 PM »

Where have you placed this piece of code? It seems to me that it should work. Try to place it inside the menu window's script.
Logged

wanted123

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Menu problem again!
« Reply #2 on: March 09, 2011, 11:39:41 PM »

in the mymainmenu script (in the script for the room where is the window with new game, extras and etc.
Logged

wanted123

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Menu problem again!
« Reply #3 on: March 09, 2011, 11:54:07 PM »

I've place the code inside the menu window's script but nothing changes
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Menu problem again!
« Reply #4 on: March 10, 2011, 08:32:22 AM »

The script looks like it should work. Other buttons in your main menu work ok? No erros in the debug console?
Make sure you're displaying the menu with GoExclusive(), so that the window receives keyboard events.

Again, you should take a look at wme_demo_3d. It has a main menu scene and it uses ESC to quit the game from the main menu.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.032 seconds with 24 queries.