Jump to content
Sign in to follow this  
soundblaster

Key hold script open

Recommended Posts

Hello fellow friends!

 

I am working on a small mission and I want to add custom controls to it. Currently it is working but it opens the menu when you press the button. What I want is that you need to hold the keybinding in order for the menu to keep displaying. Right now when you hold the button it also creates infinite amounts of extra layers of the same dialog.

 

What I got is this:

Key_Binding = {
	switch (_this) do {
		
        //Key end
		case 207: {
			execVM "Script\earplugs\earplugs.sqf";
		}; 
		//Key ~
		case 41: {
			createDialog "CTI_RscMainMenu";
		};
	};
}; 

I only want to do this for case 41:

 

Hopefully someone can help me out.

 

Thank you!

Share this post


Link to post
Share on other sites
case 41: 
{
   if (!dialog) then {createDialog "CTI_RscMainMenu"};
}

Maybe?

 

Hey, thanks that fixed the endless dialog pop-up, now just the other problem that is that the dialog is only open when the button is being pressed.

 

Thank you!

Share this post


Link to post
Share on other sites

KeyUp eventhandler and then

case 41:
{  
    if(!isNull (findDisplay <insert dialog IDD>)) then 
    {
        closeDialog <insert dialog idd here>
    };
};
This way when you release the button, dialog closes itself

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×