Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: lacosaweb on June 16, 2007, 04:36:58 PM

Title: Open window menu
Post by: lacosaweb on June 16, 2007, 04:36:58 PM
Hi, I have a abutton in the screen interface. Well, I want when the button is pressed a window appear. When I press the button nothing happens. Help me please.

I type this code in the menu.script:

Quote
on "btnOpciones"
{
    var WinMainMenu = Game.LoadWindow("interface\SCUP\opciones.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);

}

This is the definition of button on opciones.button:
Quote
BUTTON
{
  IMAGE = "interface\SCUP\sprites\BOTON1-1.png"
  IMAGE_HOVER = "interface\SCUP\sprites\BOTON1-1.png"
  IMAGE_PRESS = "interface\SCUP\sprites\BOTON1-2.png"
  PARENT_NOTIFY = TRUE
  WIDTH = 121
  HEIGHT = 30
  NAME = "btnOpciones"
}

What is the problem? No errors appear.
Title: Re: Open window menu
Post by: metamorphium on June 16, 2007, 07:02:16 PM
oops. misread

Anything in wme.log? Are you sure the menu.script file is attached to your window?
Title: Re: Open window menu
Post by: lacosaweb on June 16, 2007, 08:52:02 PM
Nothing in wme.log. In the menu.window I have this code:

Quote
WINDOW
{
  IMAGE = "interface\SCUP\sprites\barraadalt.png"
  SCRIPT = "interface\SCUP\menu.script"
  MENU = FALSE
  X = 0
  Y = 0
 
  BUTTON
   {
   IMAGE = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_HOVER = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_PRESS = "interface\SCUP\sprites\BOTON1-2.png"
   WIDTH = 121
   HEIGHT = 30
   X = 757
        Y = 1
   NAME = "btnOpciones"
   TEXT=OPCIONES
   }

And the image when I press the button is Ok, I don't know the problem
Title: Re: Open window menu
Post by: metamorphium on June 16, 2007, 09:37:23 PM
try putting

Game.Msg("Pressed!");

in your btnOpciones event to see if it gets called.
Title: Re: Open window menu
Post by: Mnemonic on June 16, 2007, 09:41:26 PM
I don't see the "PARENT_NOTIFY = TRUE" line in the window definition...? (even though it's present in your original post). Also, there's one closing } missing, I suppose you just didn't paste everything.
Title: Re: Open window menu
Post by: metamorphium on June 16, 2007, 09:42:58 PM
just a minute! in your last paste there's

PARENT_NOTIFY = TRUE

missing in button definition
Title: Re: Open window menu
Post by: lacosaweb on June 17, 2007, 09:45:45 AM
I put the Game.Msg("Pressed!");  sentence but nothing happens. This is my actual code:

Menu.window:
Quote
WINDOW
{
  IMAGE = "interface\SCUP\sprites\barraadalt.png"
  SCRIPT = "interface\SCUP\menu.script"
  MENU = FALSE
  X = 0
  Y = 0
 
  BUTTON
   {
   IMAGE = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_HOVER = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_PRESS = "interface\SCUP\sprites\BOTON1-2.png"
   WIDTH = 121
   HEIGHT = 30
   X = 757
        Y = 1
   NAME = "btnOpciones"
   TEXT=OPCIONES
   }
}

menu.script:
Quote
on "btnOpciones"
{
    Game.Msg("Pressed!");
    var WinMainMenu = Game.LoadWindow("interface\SCUP\opciones.window");
    WinMainMenu.Center();
    WinMainMenu.Visible=true;
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);

}

Nothing in wme.log
Title: Re: Open window menu
Post by: Nihil on June 17, 2007, 10:09:49 AM
Did you try to put PARENT_NOTIFY = TRUE in the button-definition?

edit: Sorry, typo ;-)
Title: Re: Open window menu
Post by: lacosaweb on June 17, 2007, 11:43:12 AM
If I put ARENT_NOTIFIY = TRUE an error appears. My button definition is inside the menu.window file:

Quote
WINDOW
{
  IMAGE = "interface\SCUP\sprites\barraadalt.png"
  SCRIPT = "interface\SCUP\menu.script"
  MENU = FALSE
  X = 0
  Y = 0
 
  BUTTON
   {
   IMAGE = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_HOVER = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_PRESS = "interface\SCUP\sprites\BOTON1-2.png"
   WIDTH = 121
   HEIGHT = 30
   X = 757
        Y = 1
   NAME = "btnOpciones"
   TEXT=OPCIONES
   }
}
Title: Re: Open window menu
Post by: Mnemonic on June 17, 2007, 11:50:41 AM
Because you misspelled it. It's: PARENT_NOTIFY = TRUE as mentioned several times in this thread.
Title: Re: Open window menu
Post by: lacosaweb on June 18, 2007, 08:41:37 AM
If I insert PARENT_NOTIFY = TRUE in my window and buttons definition:

Quote
WINDOW
{
  IMAGE = "interface\SCUP\sprites\barraadalt.png"
  SCRIPT = "interface\SCUP\menu.script"
  MENU = FALSE
  X = 0
  Y = 0
 
  BUTTON
   {
   IMAGE = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_HOVER = "interface\SCUP\sprites\BOTON1-1.png"
   IMAGE_PRESS = "interface\SCUP\sprites\BOTON1-2.png"
   PARENT_NOTIFY = TRUE
   WIDTH = 121
   HEIGHT = 30
   X = 757
   Y = 1
   NAME = "btnOpciones"
   TEXT=OPCIONES
   }

The wme says that there's an error in menu.window. Now I'm not using a .BUTTON script, as you can see in the code I define my button inside my window definition. If this is the problem, how can I resolve it, can anyone show me an example to open a window when a button is pressed?
Title: Re: Open window menu
Post by: Nihil on June 18, 2007, 10:15:49 AM
The last bracket is missing, maybe that causes the error?

If not, can you perhaps upload the project somewhere so that we can have a look at the code?
Title: Re: Open window menu
Post by: lacosaweb on June 18, 2007, 07:50:42 PM
Here you can download my project. The button is on the up-right.

www.lacosaweb.com/WME/Scup1.rar (http://www.lacosaweb.com/WME/Scup1.rar)

I hope you can help me. Thanks.
Title: Re: Open window menu
Post by: Mnemonic on June 18, 2007, 08:16:18 PM
So... if I add the PARENT_NOTIFY line to menudalt.window, the button works ok (the second window pops up).
The error in the log says: Error opening file 'interface\SCUP\SCUP.script', which is true, because there's no such file in your project.

So I STILL fail to see what your problem actually is...
Title: Re: Open window menu
Post by: lacosaweb on June 18, 2007, 09:33:53 PM
Oh, true I do it now and this works. Sorry I don't know what happened but thanks a lot for your help and your time.

Thanks.