I am working on creating a command prompt style operating system in Arma 3 and I am using the 'KeyDown' event handler to get the key presses for typing on screen. This works great until you try to localize the key presses (so its MP compatible) and when implementing shift (for Caps and symbols).
Right now I have an event handler at the top of my script. When the user types a key its code is assigned to 'pressedKey' and shift's pressed state is assigned to 'shift'. The problem here is when you are pressing shift, after a second, it ignores other keys you have pressed and just notices shift. Is there a way to get around this so that the user can press shift and another key to get caps and symbols?
Second, those two variables 'shift' and 'pressedKey' are not local variables meaning, if in multiplayer, any users using the command prompt thing simultaneously, would all have a combination of everyone's input (if I understand it correctly, I haven't done much mp scripting and can't really test it.). When I try making 'pressedKey' and 'shift' local ('_pressedKey' && '_shift') they are updated to the new values in the event handler code, but outside the event handler, they return to normal. I have tried putting the event handler inline and doing a function call like in:
https://community.bistudio.com/wiki/User_Interface_Event_Handlers at the bottom under 'Script Defined Events'. When I do this, the functions never call, though any hints I put in for testing do. If I could call a function from inside the event handler, I wouldn't have to use global variables, but at the moment I am unable to do that.
Fixing these two problems would help me finish up the I/O for this. If you have any unanswered questions about this, or need code let me know.