SantoJ 0 Posted August 10, 2019 I am trying to open a dialog with the O key using: waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown","_this call keyspressed"]; keyspressed = { _keyDik = _this select 1; _shift =_this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; switch (_this select 1) do { case 24: {//U key if (_shift) then { createDialog "SANT_Loadout_Screen"; }; }; _handled; }; however nothing happens when the O key is pressed Share this post Link to post Share on other sites
Maff 251 Posted August 10, 2019 It looks like you have missed something at the end if your keypressed function. keyspressed = { _keyDik = _this select 1; _shift =_this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; switch (_keyDik) do { case 24: { if (_shift) then { hint "Shift + O KEYPRESS DETECTED"; createDialog "SANT_Loadout_Screen"; }; }; _handled; }; }; // D'oh! waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown","_this call keyspressed"]; Pressing Shift + O should open up your Dialog... As long as there are no issues with that. Share this post Link to post Share on other sites
SantoJ 0 Posted August 11, 2019 16 hours ago, Maff said: It looks like you have missed something at the end if your keypressed function. keyspressed = { _keyDik = _this select 1; _shift =_this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; switch (_keyDik) do { case 24: { if (_shift) then { hint "Shift + O KEYPRESS DETECTED"; createDialog "SANT_Loadout_Screen"; }; }; _handled; }; }; // D'oh! waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown","_this call keyspressed"]; Pressing Shift + O should open up your Dialog... As long as there are no issues with that. this works however no other key press is detected I.e. I cnanot move in any direction with WASD cant open Inventory Etc. Share this post Link to post Share on other sites
Maff 251 Posted August 11, 2019 Try: keyspressed = { _keyDik = _this select 1; _shift =_this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; switch (_keyDik) do { case 24: { if (_shift) then { hint "Shift + O KEYPRESS DETECTED"; createDialog "SANT_Loadout_Screen"; }; }; }; _handled; // Moved outside of switch. }; waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown", { _this call keyspressed; }]; Share this post Link to post Share on other sites
SantoJ 0 Posted August 11, 2019 2 hours ago, Maff said: Try: keyspressed = { _keyDik = _this select 1; _shift =_this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; switch (_keyDik) do { case 24: { if (_shift) then { hint "Shift + O KEYPRESS DETECTED"; createDialog "SANT_Loadout_Screen"; }; }; }; _handled; // Moved outside of switch. }; waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown", { _this call keyspressed; }]; That works thank you! Share this post Link to post Share on other sites