<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FScripting%2FModule_Interface</id>
	<title>HPL3/SOMA/Scripting/Module Interface - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FScripting%2FModule_Interface"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Module_Interface&amp;action=history"/>
	<updated>2026-10-04T04:25:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Module_Interface&amp;diff=7255&amp;oldid=prev</id>
		<title>TiMan: Add a sourced SOMA guide with explanations and stock-script examples.</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Module_Interface&amp;diff=7255&amp;oldid=prev"/>
		<updated>2026-10-02T12:21:11Z</updated>

		<summary type="html">&lt;p&gt;Add a sourced SOMA guide with explanations and stock-script examples.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{shortPageTitle}}&lt;br /&gt;
&lt;br /&gt;
A SOMA user module combines a script class with a native module object. This guide traces the Light Flash Handler so you can recognize the two interfaces and call the module from a map script.&lt;br /&gt;
&lt;br /&gt;
== Follow a stock module ==&lt;br /&gt;
# Open &amp;lt;code&amp;gt;script/modules/LightFlashHandler.hps&amp;lt;/code&amp;gt;. Its class inherits the base, callback interface and its own typed interface:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class cScrLightFlashHandler : iScrUserModule, iScrUserModule_Interface, iScrLightFlashHandler_Interface&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Read &amp;lt;code&amp;gt;script/interfaces/UserModule_Interface.hps&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;iScrUserModule&amp;lt;/code&amp;gt; stores the native &amp;lt;code&amp;gt;cLuxUserModule&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;mBaseObj&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;SetupBaseInterface&amp;lt;/code&amp;gt; assigns it and &amp;lt;code&amp;gt;GetBase()&amp;lt;/code&amp;gt; returns it.&lt;br /&gt;
# Read &amp;lt;code&amp;gt;script/modules/ModuleInterfaces.hps&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;iScrLightFlashHandler_Interface&amp;lt;/code&amp;gt; declares the module’s &amp;lt;code&amp;gt;Add&amp;lt;/code&amp;gt; operation. This typed interface is the contract used by the helper, rather than the lifecycle callback interface.&lt;br /&gt;
# Follow the position overload of &amp;lt;code&amp;gt;LightFlash_Add&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;helpers/helper_modules.hps&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
iScrLightFlashHandler_Interface @LFHandler = cast&amp;lt;iScrLightFlashHandler_Interface&amp;gt;( cLux_GetUserModuleFromID(eModuleType_LightFlashHandler) );&lt;br /&gt;
return LFHandler.Add(afTime, afFadeInTime, afFadeOutTime, avTargetPos, aColor, afRadius, afBrightness);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The helper retrieves the registered module, casts it to the typed interface and calls &amp;lt;code&amp;gt;Add&amp;lt;/code&amp;gt;. A map script can use the helper without repeating that lookup and cast; see [[HPL3/SOMA/Scripting/Light Flash Handler|the light-flash example]].&lt;br /&gt;
&lt;br /&gt;
== Make your own module ==&lt;br /&gt;
Follow [[HPL3/Scripting/User Modules Overview|User Modules Overview]] for the class, callbacks and &amp;lt;code&amp;gt;Modules.cfg&amp;lt;/code&amp;gt; entry. Match the configured class name to your script class and use a unique module ID. SOMA’s inspected configuration already uses IDs 0–20, including 20 for the Eye Tracking Handler.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[HPL3/SOMA/Scripting/Modules Helper|Calling stock modules]]&lt;br /&gt;
&lt;br /&gt;
[[Category:English]]&lt;/div&gt;</summary>
		<author><name>TiMan</name></author>
		
	</entry>
</feed>