S_displayEventHandlers v0.1
yes boys and girls, sharing keys hasn't been this much fun since the seventies; the extended displayEventHandler key-events addon
as XEH crew gave no response to PM and spooner had no plans for an addon of his implementation, i cooked up this myself
at current it comprises of two parts; KeyDown, which handles all keydown events, and KeyUp, which handles all keyup events
their functionality and code is identical, apart from their purpose
previously your code looked probably something like this;
(findDisplay 46) displaySetEventHandler ["KeyDown","_this call AddonGlobalFunction"];
this reserved the entire displayEventHandler for your purposes only
you should replace that line with this;
["AddonIdentifierString","_this call AddonGlobalFunction;"] call S_displayEventHandler_KeyDown_add;
functionally this is identical to how it was
to remove your key from the pool simply enter this;
["AddonIdentifierString"] call S_displayEventHandler_KeyDown_remove;
i have included two example addons;
S_NVG.pbo - a version 0.6 of my nightvision mod, now requires this addon to function
S_QuickMap.pbo - a VERY simple example of a press-and-hold ingame map (from the Tab key) - just to get an idea of the implementation and functionality
and two fixes for third party addons;
S_KeyDown_SightAdjustmentFix.pbo - wraps GMJ's SightAdjustment addon's keydown events
S_KeyDown_Chicago_SATCOMFix.pbo - wraps chicago's satcom keydown events - not thoroughly play-tested
as you might notice, this is functionally still identical to the original event handler in that it sends every key to every function, leaving the parsing job for the addon function
this is to be built upon in 0.2 with a third parameter where the addon makers can assign and externalize specific keys for their functions
release history;
v0.1 - 080427 - initial beta release
* has basic keydown and keyup event handling, function adding and removal
plans for future;
* three stage objective;
1. bring key parsing out from external addon code
meaning, specific keys could be assigned directly to specific functions
2. externalise these keys into a setup file
3. add a menu inside the game to edit this setup file
* create fixes for more addons, if their creators won't fix them themselves
* make deleting keys more foolproof
* make threadsafe
* what else?
below is a generic summary of all functional globals that these addons spout out
note that you should not meddle with the global variables
S_KeyDown 0.1
global vars;
S_displayEventHandler_KeyDown_List
the plaintext array of names and functions for KeyDown events
not to be used externally
S_KeyDown_Private_KeyDown
the compiled function array generated from the key database
not to be used externally
global functions;
S_displayEventHandler_KeyDown_hintlist
debug database dump
use anywhere
syntax: _this call S_displayEventHandler_KeyDown_hintlist;
S_displayEventHandler_KeyDown_Refresh
force database refresh
use anywhere
you should never need this
syntax: _this call S_displayEventHandler_KeyDown_Refresh;
S_displayEventHandler_KeyDown_add
add keys to database
use anywhere
identically named keys are overwritten
syntax: ["AddonIdentifierString","_this call AddonGlobalFunction;"] call S_displayEventHandler_KeyDown_add;
S_displayEventHandler_KeyDown_remove
remove keys from database
use anywhere
syntax: ["AddonIdentifierString"] call S_displayEventHandler_KeyDown_remove;
S_KeyUp 0.1
identical to KeyDown - just replace all KeyDown with KeyUp