Hello, I'm currently having issues with displaySetEventHandler, yet I believe I'm doing everything correctly. Argh. It works fine pressing any key, until the key is 20 or 23 (the ones I have it call functions for), in which I get the error:
'|#|_this call fnc_keyUp'
Error Type Script, expected Bool
my code:
private ["_c"];
_c = 0; //counter for arrays
fnc_showInventory = compile preProcessFileLineNumbers "fnc_showInventory.sqf";
fnc_invDlgMouseButtonUp = compile preProcessFileLineNumbers "fnc_invDlgMouseButtonUp.sqf";
fnc_keyUp = compile preProcessFileLineNumbers "fnc_keyUp.sqf";
Player_isTrading = false;
Player_DlgInv_Ctrls = [];
for [{_c=330101}, {_c < 330133}, {_c=_c+2}] do
{
Player_DlgInv_Ctrls = Player_DlgInv_Ctrls + [[_c, (_c + 1), 0]];
};
sleep 1;
(findDisplay 46) displaySetEventHandler ["KeyUp", "_this call fnc_keyUp"];
private ["_key"];
_key = _this select 1;
hint str _this;
switch (_key) do
{
case 20:
{
[player] spawn fnc_showInventory;
};
case 23:
{
[player] spawn fnc_showInventory;
};
};
//SOLUTION
Appears I missed an important piece of the annotation of displaySetEventHandler...
private ["_key"];
_key = (_this select 1);
_ret = false;
switch (_key) do
{
case 20: //T
{
};
case 23: //I
{
_ret = true;
[player] spawn fnc_showInventory;
};
};
_ret