Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started 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:
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:
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.
-
oops. misread
Anything in wme.log? Are you sure the menu.script file is attached to your window?
-
Nothing in wme.log. In the menu.window I have this code:
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
-
try putting
Game.Msg("Pressed!");
in your btnOpciones event to see if it gets called.
-
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.
-
just a minute! in your last paste there's
PARENT_NOTIFY = TRUE
missing in button definition
-
I put the Game.Msg("Pressed!"); sentence but nothing happens. This is my actual code:
Menu.window:
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:
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
-
Did you try to put PARENT_NOTIFY = TRUE in the button-definition?
edit: Sorry, typo ;-)
-
If I put ARENT_NOTIFIY = TRUE an error appears. My button definition is inside the menu.window file:
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
}
}
-
Because you misspelled it. It's: PARENT_NOTIFY = TRUE as mentioned several times in this thread.
-
If I insert PARENT_NOTIFY = TRUE in my window and buttons definition:
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?
-
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?
-
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.
-
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...
-
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.