Input Handler

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:21, 2 October 2026 by TiMan (talk | contribs) (Add a sourced SOMA guide with explanations and stock-script examples.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


The SOMA script declarations for this interface reference are in script/interfaces/InputHandler_Interface.hps.

The Input Handler creates named input actions and their bindings. Its CreateActions includes movement, Jump, Crouch, Run, Interact, Flashlight, menu actions and analog gamepad actions. Stock modules receive action IDs and a pressed/released flag through OnAction when configured to receive input callbacks.

Trace an action from registration to callback

  1. Open script/base/InputHandler.hps and find CreateActions.
  2. Compare the action name with its enum ID in the registration call below.
  3. Open script/modules/InventoryHandler.hps and find OnAction; then check the module’s UseInputCallbacks entry in config/Modules.cfg.

Follow the stock registration in CreateActions: CreateAction("Jump", eAction_Jump, true, "Movement") creates the Jump action. A receiving module uses the enum ID rather than comparing the action’s text name. The inventory module demonstrates this with if(alAction == eAction_OpenInventory && abPressed). In Modules.cfg, that module has UseInputCallbacks="true".

See also