Originally Posted by
IzNoGoD
Even onopen sends the menu to a menuresponse listener anyway, so there is no need to hack around it like that.
Seems like OP didnt adequately test the code posted here, did no debugging at all and just relies on the community to send him a bit-perfect script to copy-paste into his mod.
Edit: and asid from that, the only way you can open a non-quickmessage menu is by using openmenu() in script, which should allow for the server to have a really good idea (read: know) what menu is open.
I agree with you about his testing. I knew the menu sent a response without any further work needing doing. However, the bit about the only way to open a menu is by using openmenu() - this may be true at the script language level, but in the menu language level, you can open a menu with a menu or command (open [nameofmenu). If Ni3ls is working with a COD4-type system, where sub-menus open all the time, it is difficult to know what menu is open because they DO NOT send a notification. Let's take an example:
Code:
#define LOCAL_PRIMARY_POPUP_GROUP( suffix, pos, y_offset )\
menuDef\
{\
IMPROVED_POPUP_SETUP_ONOPEN( "ocd_popup_"suffix"_cac_primary", 5, (CHOICE_X( pos )-2), (CHOICE_Y( pos )-y_offset+24), ;, execnow "set ui_inside_popup weapon_class; set ui_show_preview 1; set ui_weapon_class_selected @Primary Weapon";, 1 )\
onClose{ execnow "set ui_show_preview 0; set ui_primary_highlighted 0; set ui_attachment_highlighted 0"; }\
LOCAL_WEAPON_CLASS( 1, "assault", "@MPUI_ASSAULT_RIFLES", suffix )\
LOCAL_WEAPON_CLASS( 2, "SMG", "@MPUI_SUB_MACHINE_GUNS", suffix )\
LOCAL_WEAPON_CLASS( 3, "LMG", "@MPUI_LIGHT_MACHINE_GUNS", suffix )\
LOCAL_WEAPON_CLASS( 4, "shotgun", "@MPUI_SHOTGUNS", suffix )\
LOCAL_WEAPON_CLASS( 5, "sniper", "@MPUI_SNIPER_RIFLES", suffix )\
}
LOCAL_PRIMARY_POPUP_GROUP( "1", 1, 4 )
LOCAL_PRIMARY_POPUP_GROUP( "2", 3, 0 )
When you open any of those menus, there is no notification sent that can be monitored at the script level. So, you would have to put one in using one of the menu language's open/close/escape notifiers. Like this:
Code:
#define LOCAL_PRIMARY_POPUP_GROUP( suffix, pos, y_offset )\
menuDef\
{\
IMPROVED_POPUP_SETUP_ONOPEN( "ocd_popup_"suffix"_cac_primary", 5, (CHOICE_X( pos )-2), (CHOICE_Y( pos )-y_offset+24), ;, execnow "set ui_inside_popup weapon_class; set ui_show_preview 1; set ui_weapon_class_selected @Primary Weapon";, 1 )\
onClose{ execnow "set ui_show_preview 0; set ui_primary_highlighted 0; set ui_attachment_highlighted 0"; }\
onOpen{ Scriptmenureponse "ocd_popup_"suffix"_cac_primary:open" }\
LOCAL_WEAPON_CLASS( 1, "assault", "@MPUI_ASSAULT_RIFLES", suffix )\
LOCAL_WEAPON_CLASS( 2, "SMG", "@MPUI_SUB_MACHINE_GUNS", suffix )\
LOCAL_WEAPON_CLASS( 3, "LMG", "@MPUI_LIGHT_MACHINE_GUNS", suffix )\
LOCAL_WEAPON_CLASS( 4, "shotgun", "@MPUI_SHOTGUNS", suffix )\
LOCAL_WEAPON_CLASS( 5, "sniper", "@MPUI_SNIPER_RIFLES", suffix )\
}
LOCAL_PRIMARY_POPUP_GROUP( "1", 1, 4 )
LOCAL_PRIMARY_POPUP_GROUP( "2", 3, 0 )
That follows the example I posted above and you can parse it for the menu that opens and the menu operation - in this case "open".