PDA

View Full Version : .menu issues



serthy
30th April 2013, 17:35
Hey

i got 2 problems with my menu, and i dont know how to fix this, since it looks pretty ok to me

the menu contains 7 buttons on the top to choose between different weapon classes
if you click on the button, all weapons with tha same class should appear, and other classes disappear
the first problem i got is the scriptMenuResponse there: it always gives me this ingame: menu = "" response = "bad"
the second problem is, that the different weapons dont hide/show themselves
i gave them the same names like the class-buttons, but they are shown all at the same time!
heres the menu:

#include "ui_mp/menudef.h"


#define POS_GUN_BORDEROFFSET 20
#define POS_GUN_1 POS_GUN_BORDEROFFSET -100
#define POS_GUN_2 POS_GUN_BORDEROFFSET -80
#define POS_GUN_3 POS_GUN_BORDEROFFSET -60
#define POS_GUN_4 POS_GUN_BORDEROFFSET -40
#define POS_GUN_5 POS_GUN_BORDEROFFSET -20
#define POS_GUN_6 POS_GUN_BORDEROFFSET 0

#define POS_HEX_1 20 -230
#define POS_HEX_2 73 -195
#define POS_HEX_3 126 -230
#define POS_HEX_4 179 -195
#define POS_HEX_5 232 -230
#define POS_HEX_6 285 -195

#define DRAW_HEX_WEAPONCLASS( _name , _group , _pos , _txt ) \
itemDef \
{ \
rect 0 0 70 70 HORIZONTAL_ALIGN_LEFT VERTICAL_ALIGN_CENTER \
visible 1 \
origin _pos \
style WINDOW_STYLE_SHADER \
background "white" \
forecolor 1 1 0 0.5 \
} \
itemDef \
{ \
name _name \
visible 1 \
rect _pos 50 50 HORIZONTAL_ALIGN_LEFT VERTICAL_ALIGN_CENTER \
origin 10 10 \
forecolor GLOBAL_UNFOCUSED_COLOR \
type ITEM_TYPE_BUTTON \
text _txt \
textscale 0.23 \
textstyle ITEM_TEXTSTYLE_SHADOWEDMORE \
textalign ITEM_ALIGN_CENTER \
textalignx 25 \
textaligny 25 \
action \
{ \
play "mouse_click"; \
hide weaponclass_shotgun; \ //hide all groups first
hide weaponclass_semi; \
hide weaponclass_rifle; \
hide weaponclass_sniper; \
hide weaponclass_smg; \
hide weaponclass_lmg; \
show _group; \ //show the desired group DOESNT WORK!!! damnit
scriptMenuResponse _group; \ //THIS IS MESSED UP! menu: "" response "bad"
} \
}

#define DRAW_WEAPON( _name , _group , _pos ) \
itemDef \
{ \
name _group \ //same name
visible 1 \
style WINDOW_STYLE_FILLED \
rect _pos 200 15 HORIZONTAL_ALIGN_LEFT VERTICAL_ALIGN_CENTER \
origin 10 10 \
backcolor 1 1 1 0.1 \
forecolor GLOBAL_UNFOCUSED_COLOR \
type ITEM_TYPE_BUTTON \
text _name \
textscale 0.3 \
textstyle ITEM_TEXTSTYLE_SHADOWEDMORE \
textalign ITEM_ALIGN_CENTER \
textalignx 100 \
textaligny 10 \
action \
{ \
play "mouse_click"; \
scriptMenuResponse _name; \ //well this one works fine..
close cac_primary; \
} \
}

{
menuDef
{
name "cac_primary"
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
focuscolor GLOBAL_FOCUSED_COLOR
style WINDOW_STYLE_EMPTY
popup
fullscreen 0
onOpen
{
hide "weaponclass_shotgun";
hide "weaponclass_semi";
hide "weaponclass_rifle";
hide "weaponclass_sniper";
hide "weaponclass_smg";
hide "weaponclass_lmg";
}
onEsc
{
close cac_primary;
}

itemDef
{
rect 0 0 400 480
visible 1
style WINDOW_STYLE_FILLED
backcolor 0.1 0.1 0.1 1
}

DRAW_HEX_WEAPONCLASS( "c1" , "weaponclass_shotgun" , POS_HEX_1 , "Shotguns" )
DRAW_HEX_WEAPONCLASS( "c2" , "weaponclass_semi" , POS_HEX_2 , "Semiauto\rrifles" )
DRAW_HEX_WEAPONCLASS( "c3" , "weaponclass_rifle" , POS_HEX_3 , "Boltaction\rrifles" )
DRAW_HEX_WEAPONCLASS( "c4" , "weaponclass_sniper" , POS_HEX_4 , "Scoped\rrifles" )
DRAW_HEX_WEAPONCLASS( "c5" , "weaponclass_smg" , POS_HEX_5 , "SMG" )
DRAW_HEX_WEAPONCLASS( "c6" , "weaponclass_lmg" , POS_HEX_6 , "LMG" )

DRAW_WEAPON( "weapon_mp40" , "weaponclass_smg" , POS_GUN_1 )
DRAW_WEAPON( "weapon_mp44" , "weaponclass_lmg" , POS_GUN_1 )
DRAW_WEAPON( "weapon_bar" , "weaponclass_lmg" , POS_GUN_2 )
DRAW_WEAPON( "weapon_bren" , "weaponclass_lmg" , POS_GUN_3 )
}
}



EDIT: there was a weird invisible letter in the word "weaponclass_"...
well its working fine now -____-
both issues are gone!