Ui Modules

This section describes how to use a Ui Module (or .mod file).  The .mod file contains meta data about a portion of interface.

To add new elements to your Game interface, you must create a new ui module, or “UiMod”.  Each UiMod is described by a single .mod file which tells the Interface System what files to load and how to initialize your component.

This format will eventual be expanded to include things such as keybindings and saved variables.

Summary
Ui ModulesThis section describes how to use a Ui Module (or .mod file).
.mod File DefinitionThe .mod file is an XML file with the following field.s
.mod XML Description
ModuleFileThis is the top level xml-tag for each ui module xml file.
UiModThis is the top level xml-tag for each ui module xml file.
AuthorThe element contains information about the module author.
DescriptionThis element contains a text description of the mod
DependenciesThis element allows you require other mods to be loaded and initialized prior to initializing this mod.
OnInitializeThis element allows you to provide initialization instructions for each mod.
OnInitializeThis element allows you to provide initialization instructions for each mod.
OnUpdateThis element allows you to provide update instructions for each mod.
OnShutdownThis element allows you to provide shutdown instructions for each mod.
CreateWindowThis element defines the command for creating a single window.
CallScriptThis element defines the command for calling a single script function.
Functions
Functions
ModulesLoadFromDirectory()Scans the specified directory and loads all of the .mod definition files.
Functions
Functions
ModulesLoadFromListFile()Loads a list of .mod files from a list.
Functions
Functions
ModuleLoad()Loads a single module path.
Functions
Functions
ModuleRestrictedLoad()This loads a restricted module that is not added to the the Mod Data.
Functions
Functions
ModulesInitializeAllEnabled()Loads all of the the lua/xml data and runs the initialization sequence for each enabled mod.
Functions
Functions
ModulesInitializeRestricted()Loads all of the the lua/xml data and runs the initialization sequence for each Restricted mod.
Functions
Functions
ModulesGetData()Returns a table containing the data for all loaded Ui Modules.
Functions
Functions
ModuleSetEnabled()Enables / Disables a single module.
Functions
Functions
ModuleInitialize()Initialize a single module.

.mod File Definition

The .mod file is an XML file with the following field.s

Summary
.mod XML Description
ModuleFileThis is the top level xml-tag for each ui module xml file.
UiModThis is the top level xml-tag for each ui module xml file.
AuthorThe element contains information about the module author.
DescriptionThis element contains a text description of the mod
DependenciesThis element allows you require other mods to be loaded and initialized prior to initializing this mod.
OnInitializeThis element allows you to provide initialization instructions for each mod.
OnInitializeThis element allows you to provide initialization instructions for each mod.
OnUpdateThis element allows you to provide update instructions for each mod.
OnShutdownThis element allows you to provide shutdown instructions for each mod.
CreateWindowThis element defines the command for creating a single window.
CallScriptThis element defines the command for calling a single script function.

.mod XML Description

ModuleFile

This is the top level xml-tag for each ui module xml file.  All other elements must be contained within the ModuleFile tag

Syntax

<?xml version="1.0" encoding="UTF-8"?>
<ModuleFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
...
</ModuleFile>
xmlns:xsiThe location of the xml language specification.

Sub-Elements

  • UiMod Notes:
  • This code should be use for the first and last lines of each mod file.

UiMod

This is the top level xml-tag for each ui module xml file.  All other elements must be contained within the ModuleFile tag

Syntax

<UiMod name="EA_TomeOfKnowledge" version="1.0" date="11/6/2007" >
...
</UiMod>
nameThe name of the Module, this must be unique.
versionThe version number of this module.
dateThe date this module was last updated.

Sub-Elements

Notes

  • This code should be use for the first and last lines of each mod file.

Author

The element contains information about the module author.

Syntax

<Author name="EAMythic" email="" />
nameThe name of the author.
emailThe email address of the author.

Notes

none

Description

This element contains a text description of the mod

Syntax

<Description text="This module contains all of the code and data for the Tome Of Knowledge window." />
textThe description text.

Notes

none

Dependencies

This element allows you require other mods to be loaded and initialized prior to initializing this mod.

Syntax

<Dependencies>
<Dependency name="EA_TooltipSystem" />
</Dependencies>

name = The name of the module this mod depends on.

Notes

none

OnInitialize

This element allows you to provide initialization instructions for each mod.  There is no limit on the number of init actions you can perform, however it may make sense to

Syntax

<OnInitialize>
<CreateWindow name="TomeWindow" show="false" />
</OnInitialize>

name = The name of the module this mod depends on.

Notes

none

OnInitialize

This element allows you to provide initialization instructions for each mod.

Syntax

<OnInitialize>
...
</OnInitialize>

Sub-Elements

Notes

none

OnUpdate

This element allows you to provide update instructions for each mod.

Syntax

<OnUpdate>
...
</OnUpdate>

Sub-Elements

Notes

You can improve performance by reducing the number of Update callbacks that you include.  If you only need updates when a particular window is showing, it is better to add an OnUpdate callback to the window itself, rather than the entire mod.  This is designed for ‘System’ updates that do not correspond to a single window and are needed at all times.

OnShutdown

This element allows you to provide shutdown instructions for each mod.

Syntax

<OnShutdown>
...
</OnShutdown>

Sub-Elements

Notes

none

CreateWindow

This element defines the command for creating a single window.

Syntax

<CreateWindow name="TomeWindow" show="true"/>
nameA valid window defintion name.
showShould the window be shown after it is created?

Notes

none

CallScript

This element defines the command for calling a single script function.

Syntax

<CreateWindow name="TomeWindow" show="true"/>
nameA valid window defintion name.
showShould the window be shown after it is created?

Notes

When included in a OnInitialize or OnShutdown section, this is called with no parameters.  When included in an OnUpdate section, this is called with a single ‘seconds elapsed’ variable.

Functions

Summary
Functions
ModulesLoadFromDirectory()Scans the specified directory and loads all of the .mod definition files.

Functions

ModulesLoadFromDirectory()

Scans the specified directory and loads all of the .mod definition files.  This does NOT actually load any of the lua/xml code create the windows.  This just loads the UI-Module meta data.

Parameters

directory(string) The directory from which to search for modules.
setName(wstring) The name to use to describe this set of modules.  For example, “EA Default” or “Add Ons”

Returns

nilno return value

Notes

  • You must call ModulesInitializeAllEnabled() to actually create the windows.  This call only works for raw UI data.

Example

none

Functions

Summary
Functions
ModulesLoadFromListFile()Loads a list of .mod files from a list.

Functions

ModulesLoadFromListFile()

Loads a list of .mod files from a list.

Parameters

listFilePath(string) The file path for the list of mod files.
setName(wstring) The name to use to describe this set of modules.  For example, “EA Default” or “Add Ons”
allowRaw(wstring) Are raw versions of this file permitted?

Returns

nilno return value

Notes

  • This function expects a single input file which contains line separated .mod file paths.

Example

none

Functions

Summary
Functions
ModuleLoad()Loads a single module path.

Functions

ModuleLoad()

Loads a single module path.

Parameters

modFilePath(string) The file path for the mod file.
setName(wstring) The name to use to describe this set of modules.  For example, “EA Default” or “Add Ons”
allowRaw(wstring) Are raw versions of this mod permitted?

Returns

nilno return value

Notes

  • none

Example

none

Functions

Summary
Functions
ModuleRestrictedLoad()This loads a restricted module that is not added to the the Mod Data.

Functions

ModuleRestrictedLoad()

This loads a restricted module that is not added to the the Mod Data.

Parameters

modFilePath(string) The file path for the mod file.
allowRaw(wstring) Are raw versions of this mod permitted?

Returns

nilno return value

Notes

  • none

Example

none

Functions

Summary
Functions
ModulesInitializeAllEnabled()Loads all of the the lua/xml data and runs the initialization sequence for each enabled mod.

Functions

ModulesInitializeAllEnabled()

Loads all of the the lua/xml data and runs the initialization sequence for each enabled mod.

Parameters

none

Returns

nilno return value

Notes

  • none

Example

none

Functions

Summary
Functions
ModulesInitializeRestricted()Loads all of the the lua/xml data and runs the initialization sequence for each Restricted mod.

Functions

ModulesInitializeRestricted()

Loads all of the the lua/xml data and runs the initialization sequence for each Restricted mod.

Parameters

none

Returns

nilno return value

Notes

  • none

Example

none

Functions

Summary
Functions
ModulesGetData()Returns a table containing the data for all loaded Ui Modules.

Functions

ModulesGetData()

Returns a table containing the data for all loaded Ui Modules.

Parameters

none

Returns

modDataTable(table) A table of Ui Modules

Format as follows...

modDataTable[1...n].name(wstring) The name of the module
modDataTable[1...n].setName(wstring) The name of the set that this module is in.
modDataTable[1...n].author(table) A table containing the author information
modDataTable[1...n].author.name(wstring) The name of the author
modDataTable[1...n].author.email(wstring) The email of the author
modDataTable[1...n].description(table) A table containing the description information
modDataTable[1...n].description.text(wstring) The description text
modDataTable[1...n].dependencies(table) A table containing the dependencies information
modDataTable[1...n].dependencies[1..n].name(wstring) The name of the dependency mod.

Example

local modsData = ModulesGetData()

Functions

Summary
Functions
ModuleSetEnabled()Enables / Disables a single module.

Functions

ModuleSetEnabled()

Enables / Disables a single module.

Parameters

moduleName(string) The name of the module.
enabled(boolean) Should this module be enabled?

Returns

nilno return value

Notes

  • none

Example

ModuleSetEnabled( “EA_BackpackWindow”, true )

Functions

Summary
Functions
ModuleInitialize()Initialize a single module.

Functions

ModuleInitialize()

Initialize a single module.

Parameters

moduleName(string) The name of the module.

Returns

nilno return value

Notes

  • none

Example

ModuleInitialize( “EATemplate_DefaultWindowSkin” )

This is the top level xml-tag for each ui module xml file.
The element contains information about the module author.
This element contains a text description of the mod
This element allows you require other mods to be loaded and initialized prior to initializing this mod.
This element allows you to provide initialization instructions for each mod.
This element allows you to provide update instructions for each mod.
This element allows you to provide shutdown instructions for each mod.
This element defines the command for creating a single window.
This element defines the command for calling a single script function.