- Available in v1.19
The System Node $KEYCAPTURE implements the MMO Foundation Framework's mechanics for extending HeroBlade with scripted tools. It supports the capture of keyboard events while using HeroBlade's "edit" mode, allowing developers to assign scripted tools/actions to those keys.
What problem(s) does this solve?
- Extension of Heroblade with scripted tools/actions
- Known pattern for extension of the system (a system node)
- Common game-specific functionality is easily implemented by overriding the appropriate method
What problem(s) does this not solve?
- Not intended to be a replacement for use of the Keybindings and Command Layers for normal player input
- Does not eliminate the necessity for additional code to support alternate behaviors
$KEYCAPTURE exists on the CLIENT
Adding game-specific functionality
As a required class/script, it is not permissible to make changes to the _keyCaptureClassMethods script. Instead, extension/overriding the script is accomplished by the creation of a game-specific class (and class methods script) that is GLOMmed onto the KEYCAPTURE prototype.
- Create a new class
- Create a class method script for the class
- GLOM the class onto the prototype
Create a game-specific class
Using the DOM Editor create a new (server|client) class. Our recommendation is that you use a class name that incorporates the _keyCapture as a suffix to the name (ex. HJ_keyCapture), this makes it easier to locate the pair of classes (the required script prefixed in _keyCapture and your game-specific class).
Once you have created the game-specific class, create a new client class methods script for that class.
Adding a game-specific class
Adding your game-specific class to the KEYCAPTURE prototype is achieved using the System Node Configuration GUI or the CLI server command \mpac or client |mpac in the Console Panel. The System Node Configuration GUI is the preferred method because it handles the communication to update any instantiations of a system node to reflect the changes you have made.
Using the System Node Configuration GUI
Opening the System Node Configuration GUI requires you to access the hidden Utilities Interface toolbox, located in the top left corner of the render window with
ctrl-shift-click (or press
F5), which will open the Interface. On the Tools tab within the menu, is an option to open the System Nodes Configuration GUI.
See also: Adapting Clean Engine
Using the CLI
It is important to recognize that modification of the prototype from which a system node is instantiated will not update any instantiations that have already been made in various local GOMs. That means your changes will not take effect until the area (in the case of server system nodes) restarts, or the client (in the case of client system nodes), restarts.
\mpac KEYCAPTURE, hj_keyCapture;
|mpac KEYCAPTURE, hj_keyCapture;
Starting Key Capture
By default, key capture is started by the $BASECLIENT system node in its _FirstChance() method. If you have implemented a game-specific override HE_FirstChance(), you may need to start the key capture in your override by implementing the following code:
if IsHeroBlade() $KEYCAPTURE._StartKeyCapture() .
Stopping Key Capture
- Adapting Clean Engine - Detailing the replacement/extension of Clean Engine via game-specific classes and the GUI created for that purpose
- System Nodes - Primary mechanism for enabling the extension/overriding of the required Clean Engine implementations and a game-specific implementation of a licensee