Interfaces Overview

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting(Redirected from HPL3/Interfaces Overview)
Jump to navigation Jump to search


Script interfaces connect SOMA’s AngelScript classes to engine objects and callbacks. Start with a stock terminal to see how a base class differs from a callback interface.

Trace the terminal script

  1. Open script/props/Prop_Terminal.hps. Its declaration is:
class cScrPropTerminal : iScrProp, iScrProp_Interface
  1. Follow iScrProp to script/interfaces/Prop_Interface.hps. It stores a native cLuxProp handle in mBaseObj. SetupBaseInterface assigns it and GetBase() returns it.
  2. Return to the terminal’s SetupAfterLoad. It reads resource variables and calls mBaseObj.CreateAndSetupGui to set up the terminal GUI. This is an example of using the engine object exposed by the base.

The terminal also implements iScrProp_Interface. Its script defines callbacks such as SetupAfterLoad, OnInteract and GetInteractIconId; these are separate from the base’s handle-access functions.

Find the matching base

The area, agent, critter, player, effect and user-module interface files use the same handle-wrapper pattern for their corresponding native object types. Use the base belonging to the script you are studying; the prop wrapper holds a cLuxProp, while the module wrapper holds a cLuxUserModule.

Continue with a working example