Home   Help Search Login Register  

Author Topic: displaySetEventHandler issue [SOLVED]  (Read 1635 times)

0 Members and 1 Guest are viewing this topic.

Offline ModestNovice

  • Members
  • *
displaySetEventHandler issue [SOLVED]
« on: 05 Aug 2012, 21:07:04 »
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:
Code: [Select]
'|#|_this call fnc_keyUp'
Error Type Script, expected Bool

my code:
Code: ("init.sqf") [Select]
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"];

Code: ("fnc_keyUp.sqf") [Select]
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...
Code: ("fnc_keyUp.sqf") [Select]
private ["_key"];
_key = (_this select 1);
_ret = false;

switch (_key) do
{
     case 20: //T
     {
     };

     case 23: //I
     {
          _ret = true;
          [player] spawn fnc_showInventory;
     };
};

_ret
« Last Edit: 06 Aug 2012, 00:15:11 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley