Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: openMenu not working

  1. #11
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Maybe the menu has an error? Can you post your menu here?

  2. #12
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Quote Originally Posted by PatmanSan View Post
    If using a scriptMenuResponse in quickmessage, like this:

    PHP Code:
    execKey "8" close quickmessagescriptMenuResponse "admin" 
    Check for menu "-1" in _menus.gsc.

    PHP Code:
            if(menu == "-1")
            {
                if(
    response == "admin")
                {
                    if(
    self getGuid() == 0)
                    {
                        
    self playLocalSound("granted");
                        
    self openMenu(game["menu_admin"]);
                    }
                    else
                    {
                        
    self iprintlnbold("^1Access Denied!");
                        
    self playLocalSound("denied");
                    }
                    continue;
                }
            } 
    I have to add that this is the way it's done in the eXtreme mod, which handles quickmessages slightly different, so your mileage may vary.
    I tested it but its still the same problem.
    It plays the sound but it doesnt open the menu..

    wm_quickmessage.menu:
    http://pastebin.com/1LUxk242

    admin.menu:
    http://pastebin.com/t4HhbRjM

    As i said.. There cant be any errors in the menu's because if i just open them its working.
    Its just not working with openMenu()

  3. #13
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    and show ur _menus with the parts we need

  4. #14
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Code:
    onMenuResponse()
    {
    	for(;;)
    	{
    		self waittill("menuresponse", menu, response);
    
    		if(response == "admin")
    		{
    			if(self getGuid() == 0)
    			{
    				self closeMenu();
    				self closeInGameMenu();
    				self openMenu(game["menu_admin"]);
    				self playLocalSound("granted");
    			}
    			else
    			{
    				self closeMenu();
    				self closeInGameMenu();
    				self iprintlnbold("^1Access Denied!");
    				self playLocalSound("denied");
    			}
    		}

  5. #15
    Private First Class YuriJurek's Avatar
    Join Date
    Jun 2013
    Posts
    219
    Thanks
    152
    Thanked 88 Times in 47 Posts
    Another thing you want to try is to play around with wait statements, add one between closing and opening the menu again and make sure the menu is really closed.
    In the past I had the same problem and as I remmember I added a wait somewhere, sorry but I've lost my laptop yesterday and can't look up the actual code -.-

  6. #16
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    You could try to change the order in your execKey parameter:
    instead of closing your menu first and then sending a response, send the menuresponse first.

    execKey "8" { scriptMenuResponse "admin"; play "mouse_over"; close quickmessage; }

    if a menuresponse occurs with a menu of "-1", as far as i can say from my expirience, in most cases an indicator of a not precached menu.
    I also added a debug-sound in the response to see if it is properly triggered. You should also do something like this:

    self waittill( "menuresponse" , menu , response );
    iPrintLn( "Menu: " + menu + " Response: " + response );

    as additional debug.
    Last edited by serthy; 11th November 2013 at 19:13.

  7. #17
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    Quote Originally Posted by serthy View Post
    ...
    if a menuresponse occurs with a menu of "-1", as far as i can say from my expirience, in most cases an indicator of a not precached menu.
    ...
    So what you're saying is that _menus:nMenuResponse() was able to get a response from a menu that was not precached?!
    Wouldn't that be highly unlikely, if not impossible?

  8. #18
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Ok, to stop this thread becoming too long, I jumped in and did some testing:

    1. Using the admin menu you provided, and changing wm_quickmessage.menu's third button to an "admin" button, and using your menu waiter script in maps\mp\gametypes\_menus.gsc:


    PHP Code:
    onMenuResponse()
    {
        
        for( ;; )
        {
            
    self waittill"menuresponse"menuresponse );
            
            if( 
    response == "admin" )
            {
                if( 
    self getGuid() == )
                {
                    
    self closeMenu();
                    
    self closeInGameMenu();
                    
    self openMenu"admin" );
                }
                else
                    
    self iprintlnbold"invalid menu" );
                
                continue;
            }
        
        ----------- 
    snip -------------- 

    This is what the result I got:

    http://www.xfire.com/videos/61626c

    2. As you can see, no problem opening the admin menu at all.

    3. Conclusion:

    You must be doing something wrong somewhere, or something else is preventing the menu opening.

  9. #19
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Ok, the problem is solved..
    The reason for the problem is simple..

    Quote Originally Posted by IzNoGoD View Post
    you cant open a menu when quickmessage is open. Make sure you have close quickmessage/quickcommands in the execkey in your menu.
    Its not about quickmessage or quickcommands...
    But i'm using menu files to check the FPS of a player.
    To get it working i open it again and again..^^
    If i remove this FPS check its working fine! :P
    But now i have to get a new way to check the FPS for my custom hud... :'(
    Thank you all <3

  10. #20
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by DjTranceFire View Post
    Ok, the problem is solved..
    The reason for the problem is simple..



    Its not about quickmessage or quickcommands...
    But i'm using menu files to check the FPS of a player.
    To get it working i open it again and again..^^
    If i remove this FPS check its working fine! :P
    But now i have to get a new way to check the FPS for my custom hud... :'(
    Thank you all <3
    As I thought - something else was preventing the menu opening.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •