PDA

View Full Version : Button Edit Menu



duzyjohny
31st August 2016, 01:50
Hello!

After 3 years I returned to CoD2 and to create Zombie Mod, I forgot a lot of things ... and I hope you will help me .

I created the Edit button in menu_weapon_american , which is the choice of weapons, but I can't open it any menu , maybe I am doing something wrong ...

Precache:



precacheMenu(game["menu_editmenu"]);
game["menu_editmenu"] = "editmenu";


Edit Button:



itemDef
{
name "button_Edit"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE5
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "^2E^7dit^1*"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
scriptMenuResponse "editmenu";
closemenu weapon_american;

}
onFocus
{
play "mouse_over";
}
}


Response:



if(response == "editmenu")
{
self openmenu(game["menu_editmenu"]);
}


And Editmenu:



{
menuDef
{
name "editmenu"
rect 0 0 640 480
focuscolor GLOBAL_FOCUSED_COLOR
style WINDOW_STYLE_EMPTY
blurWorld 5.0
onEsc
{
close editmenu;
}
onOpen
{

show ed1;
}

// Gradient
itemDef
{
style WINDOW_STYLE_SHADER
//rect -107 0 554 480
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
background "gradient"
visible 1
decoration
}

itemDef
{
name "window_background2"
visible 1
rect 0 0 10000 1000
origin ORIGIN_CHOICE99
style WINDOW_STYLE_FILLED
forecolor 1 1 1 1
backcolor 0 0 0 0.798
decoration
}

itemDef
{
name "info"
style WINDOW_STYLE_FILLED
rect 340 70 300 300
backcolor 0 0 0 .8
border 1
bordercolor 1 1 1 1
visible 1
decoration
}

//#include "ui/bars.menu"

itemDef
{
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_TITLE
forecolor 1 1 1 1
text "^2E^7dit^1*"
textfont UI_FONT_NORMAL
textscale GLOBAL_HEADER_SIZE
decoration
}
itemDef
{
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_TITLE2
forecolor 1 1 1 1
text ""
textfont UI_FONT_NORMAL
textscale .38
decoration
}
itemDef
{
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_TITLE3
forecolor 1 1 1 1
text ""
textfont UI_FONT_NORMAL
textscale .20
decoration
}
/////////////////////////////////////////////////////////////////////////////////////////////////
itemDef
{
name "ed1"
visible 1
rect 0 0 128 24
origin ORIGIN_CHOICE1
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_BUTTON
text "1234"
textfont UI_FONT_NORMAL
textscale .30
textstyle ITEM_TEXTSTYLE_SHADOWED
textaligny 20
action
{
play "mouse_click";
scriptMenuResponse "ed1";
}
onFocus
{
play "mouse_over";
//close ed1;
}
}

////////////////////////////////////////////////////
itemDef
{
name "ed1"
type ITEM_TYPE_TEXT
visible 1
origin ORIGIN_INFO_TEXT
forecolor 1 1 1 1
text "PickUp"
textfont UI_FONT_NORMAL
textscale .35
decoration
}
}
}


what is wrong :(

IzNoGoD
31st August 2016, 07:22
you dont have an open editmenu in the onclick action on your button

duzyjohny
31st August 2016, 11:40
This same... Not worked ;x

voron00
31st August 2016, 11:51
precacheMenu(game["menu_editmenu"]);
game["menu_editmenu"] = "editmenu";

Should be


game["menu_editmenu"] = "editmenu";
precacheMenu(game["menu_editmenu"]);

duzyjohny
31st August 2016, 12:25
eh...
The same thing , I no longer know what is wrong ;x

voron00
31st August 2016, 12:47
Open console and see what's wrong maybe? If its a menu load error it will be there and will point you to your error.

duzyjohny
31st August 2016, 12:52
All in console is good, 0 error's ...

Ni3ls
31st August 2016, 13:02
+developer 1 + set logfile 2

duzyjohny
31st August 2016, 15:34
Script tried to precache the menu 'editmenu' more than once
I have 1 Precache ;-;

IzNoGoD
31st August 2016, 15:51
Where's your script that handles


scriptMenuResponse "editmenu";

Back to my original post: why doesnt this say open editmenu instead?

duzyjohny
4th September 2016, 17:47
1204

It works , but I have another problem when I go to the game I push Autoassign not choose weapons and enter the Edit menu works , but when I choose weapons and wants to once again enter the edit menu, then its not work ...

Here's a script:


init()
{
game["menu_editmenu"] = "editmenu";
precacheMenu(game["menu_editmenu"]);


thread main();
}

main()
{


thread onPlayerConnect();
}

onPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onMenuResponse();

}
}

onMenuResponse()
{

for(;;)
{
self waittill("menuresponse", menu, response);


///////////////////////////////////////////////////////////////////////////////////////////
if(response == "editmenu")
{
self openMenu(game["menu_editmenu"]);
}


}
}

IzNoGoD
4th September 2016, 18:34
have you tried debugging ANYTHING at all?

duzyjohny
4th September 2016, 18:55
Yes man.. I tried

IzNoGoD
4th September 2016, 19:09
Im not seeing any hints of debugging. No iprintlns anywhere, no results from said iprintlns etc.

duzyjohny
4th September 2016, 19:15
I no have any errors on console with developer 1/2 and set logfile 2 no error's ...

IzNoGoD
5th September 2016, 06:34
Still no iprintlns.

Paho
5th September 2016, 16:55
forecolor GLOBAL_DISABLED_COLOR
forecolor GLOBAL_UNFOCUSED_COLOR

duzyjohny
8th September 2016, 18:22
What does this have to, Paho ?
No matter , im trying to do something else...