Jump to content
Mr H.

Better explanation on finddisplay 46

Recommended Posts

Hi so I have this script which detects keystrokes and calls for another script

waituntil {!(IsNull (findDisplay 46))};

key_ctrl = 29;
key_star = 55;



pressed_ctrl = false;
pressed_star = false;



(findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == key_ctrl) then {pressed_ctrl = true;}, if (_this select 1 == key_star) then {pressed_star = true;}"];
(findDisplay 46) displayAddEventHandler ["KeyUp",   "if (_this select 1 == key_ctrl) then {pressed_ctrl = false;}, if (_this select 1 == key_star) then {pressed_star = false;}"];


while {true} do {
if (pressed_ctrl && pressed_star) then { startscript = true};
if (startscript) then {roster = []execVM "MRHRoster\rosterscript.sqf"; startscript = false;};

};

Now, trouble is it uses display 46, and the loop seems to mess big time with any other script using display 46. I am trying to call a visual interface (made with GUI editor) for instance, and when this script is running the interface won't close. So i'd like to create a new display, but the documentation is very unclear, it says I need to create a new display in the description.ext
I have tried this :
 

class RscDisplayNew
{
    idd=77;
    scriptName = "RscDisplayNew";
    
};

to no avail....

What am I doing wrong?

Share this post


Link to post
Share on other sites

the GUI editor should have a function to export your dialog in config format. do that and paste that into you class inside description.ext.

 

also i don't quite understand why you need that loop. those two eventhandlers already handle that event of both keys being down. i think you should just put your condition of both being true in there. but keep your set up with the two variables because afaik the EHs will fire for each key seperately. basically jsut add what you have in the while loop to the end of the code in the "keyDown" EH. it's more economical.

Share this post


Link to post
Share on other sites

Thanks, without the loop, it didn't work, I have no clue why, but I found a completely different solution using CBA's keybind fnc

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

×