Interface System

This section describes the base level UI system definitions and functions.

Summary
Interface SystemThis section describes the base level UI system definitions and functions.
XML DefinitionsThese are non-window XML definitions.
System Interface XML
InterfaceThis is the top level xml-tag for each interface xml file.
IncludeThis element allows you to include additiontional files.
ScriptsThis element allows you to include lua files directly.
AssetsThis is the container tag for all source file assets.
TextureThis element defines a single art texture component.
FontThis element defines a font defintion.
IconThis element defines the data for a single icon.
MapIconThis element defines the data for a single icon.
Ui Log Filters Type
Constants
Constants
Button Flags
Variables
Variables
SystemData. ActiveWindow.name
SystemData. InputProcessed. EnterKey
SystemData. InputProcessed. EscapeKey
SystemData. InputProcessed. GamepadKey
SystemData. InputProcessed. LButtonDown
SystemData. InputProcessed. LButtonUp
SystemData. InputProcessed. RButtonDown
SystemData. InputProcessed. RButtonUp
SystemData. MouseOverWindow.name
SystemData. InputProcessed. RButtonUp
SystemData. MousePosition.x
SystemData. MousePosition.y
SystemData. UpdateProcessed.Time
EventsAll events are cached in the lua table in the format of SystemData.Events.EVENT_NAME
Events
ENTER_KEY_PROCESSEDThis event is broadcast when the enter key processing has completed.
ESCAPE_KEY_PROCESSEDThis event is broadcast when the enter key processing has completed.
L_BUTTON_DOWN_PROCESSEDThis event is broadcast when the LButtonDown processing has completed.
ENTER_KEY_PROCESSEDhis event is broadcast when the LButtonUP processing has completed.
ENTER_KEY_PROCESSED
L_BUTTON_DOWN_PROCESSED
R_BUTTON_DOWN_PROCESSEDThis event is broadcast when the RButtonDown processing has completed.not.
R_BUTTON_UP_PROCESSEDThis event is broadcast when the RButtonUp processing has completed.
UPDATE_PROCESSEDThis event is broadcast when the update pass has completed.
ALL_MODULES_INITIALIZEDThis event is broadcast after all modules have had their OnInitialize handlers executed
Functions
Functions
LoadResources()Loads UI resources from an xml file.
RegisterWindowSet()Registers a new set of windows with the UI system.
CreateWindow()Creates a window from an XML definition.
CreateWindowFromTemplate()Creates a window of the specified name from an XML definition.
CreateWindowFromTemplateShow()Creates a window of the specified name from an XML definition.
DestroyWindow()Removes a window and all of it’s children from the current UI.
GetScreenResolution()Returns the current screen resolution.
BroadcastEvent()Broadcasts an event with the UI system’s assigned event processor.
BuildTableFromCSV()Broadcasts an event with the UI system’s assigned event processor.
GetIconData()Returns the data for the specified icon.
GetMapIconData()Returns the data for the specified map icon.
LoadStringTable()Creates a new string table of the specified name from the data file.
UnloadStringTable()Unloads the specified string table.
GetStringFromTable()Returns the specified string from a string table
GetStringFormatFromTable()Returns a string from a string table with the substitution tags replaced by values in the params table.
LogSystem()Creates log files for all the functions & variables available to Lua.
CreateUIDocumentFile()Creates a NaturalDocs style output file that lists all registered functions and variables.
StringToWString()Converts a string to a wstring
WStringToString()Converts a string to a wstring
ScaleInterface()Sets the master UI scale.
SetUseLuaErrorHandling()Enables lua_errors for UI debugging.
GetUseLuaErrorHandling()Returns if lua-error handling is currently turned on.
SetLoadLuaDebugLibrary()Sets if the lua debug library should be loaded when reloading the UI.
GetLoadLuaDebugLibrary()Returns if the Lua debug library will be loaded when reloading the UI
SetCheckForCircularDependencies()Sets if the UI should check for circular dependencies.
GetCheckForCircularDependencies()Returns if the UI is currently checking for circular dependencies.
SetItemDragging()Inform the UI system that we are currently dragging something
RegisterEventHandler()Registers a generic lua callback event handler that is not tied to a window.
UnregisterEventHandler()Unregisters a generic event handler that is not tied to a window.
ForceProcessAllWindowAnchors()Force anchor processing for all windows.

XML Definitions

These are non-window XML definitions.

Summary
System Interface XML
InterfaceThis is the top level xml-tag for each interface xml file.
IncludeThis element allows you to include additiontional files.
ScriptsThis element allows you to include lua files directly.
AssetsThis is the container tag for all source file assets.
TextureThis element defines a single art texture component.
FontThis element defines a font defintion.
IconThis element defines the data for a single icon.
MapIconThis element defines the data for a single icon.
Ui Log Filters Type

System Interface XML

Interface

This is the top level xml-tag for each interface xml file.  All other elements must be contained within the Interface tag

Syntax

<?xml version="1.0" encoding="UTF-8"?>
<Interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Interface.xsd">
...
</Interface>
xmlns:xsiThe location of the xml language specification.
xsi:noNamespaceSchemaLocationThe location of the MythInterface scheme file.

Sub-Elements

Notes

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

Include

This element allows you to include additiontional files.  This must be inside of an Interface tag.

Syntax

<Include file="Source/ChatWindow.xml" />

file = The relative file path of the xml file from the location of the main xml file.

Notes

none

Scripts

This element allows you to include lua files directly.  This must be inside of an Interface tag.

Syntax

<Scripts>
<Script file="Interface.lua" />
<Script file="Source/Cursor.lua" />
</Scripts>

file = The relative file path of the lua file from the location of the main xml file.

Notes

none

Assets

This is the container tag for all source file assets.  This must be inside of an Interface tag.

Syntax

<Assests>
...
</Assests>

Sub-Elements

Notes

none

Texture

This element defines a single art texture component.  This must be inside of an Assets tag.

Syntax

<Texture name="ui_main" file="Textures/UI_Main01.dds" />
nameThe name for the texture to be used in other window-element texture fields.
fileThe relative file path of the texture file from the location of the main xml file.

Notes

  • Texture files must be of type .dds or .tga, and have dimensions in powers of two.

Font

This element defines a font defintion.  In this UI system a font, is a single font style at a single size.  This must be inside of an Assets tag.

Syntax

<Font name="font_default_text" face="AgeOfReckoning" file="fonts/AgeOfReckoning.ttf" height="18" texsize="256"
antialias="true" hinting="false" autohinting="true" outline="true" shadow="false"/>
nameThe name to call this font definition.
faceThe face name of the font type.
fileThe relative file path of the texture file from the location of the main xml file.
heightThe height in pixels for this font.
texsizeThe texture size to use to render this font.  If the texture runs out of space, additional textures of this size will be created as needed.
anitialiasEnables/Disabled anitialiasing.
hintingTurns on/off the TrueType hinting algorithm.
autohintingTurns on/off the FreeType custom hinting algorithm.
outlineTurns on/off an outline on the characters.
shadowTurns on/off a drop shadow on the characters.

Notes

  • If the UI is scaled, the font height will be scaled accordingly to fit the windows.

Icon

This element defines the data for a single icon.  This must be inside of an Assets tag.

Syntax

<Icon id="00100" texture="Icons/Skl_Strength.dds" x="0" y="0" name="Strength Icon"/>
idThe icon id number, must be unique.
textureThe relative file path of the icon texture file from the location of the main xml file.
xThe x coordinate within the texture.
yThe y coordinate within the texture.
nameA descriptive name field, this is only added for readability and is not loaded.

Related Functions

Notes

  • Texture files must be of type .dds or .tga, and have dimensions in powers of two.

MapIcon

This element defines the data for a single icon.  This must be inside of an Assets tag.

Syntax

<MapIcon id="00001" texture="map_markers01" textureX="514" textureY="2" sizeX="16" sizeY="21" pointX="8" pointY="10" />
idThe icon id number, must be unique.
textureThe UI texture name for the map icons.
textureXThe x coordinate within the texture.
textureYThe y coordinate within the texture.
sizeXThe x pixel size.
sizeYThe y pixel size.
pointXThe x point within the icon that should be considered its center.
pointYThe y point within the icon that should be considered its center.

Related Functions

Notes

  • Texture files must be of type .dds or .tga, and have dimensions in powers of two.

Ui Log Filters Type

Values

SystemData.UiLogFilters.SYSTEMGeneral Ui System messages
SystemData.UiLogFilters.WARNINGWarning messages - things that may not be behaving as you expect.
SystemData.UiLogFilters.ERRORAn Error in either lua or xml processing
SystemData.UiLogFilters.DEBUGUser generated debugging messages.
SystemData.UiLogFilters.FUNCTIONFunction calls into Lua
SystemData.UiLogFilters.LOADINGFile loading log messages.

Constants

Constants

Button Flags

SystemData.ButtonFlags.SHIFTThe shift key is pressed.
SystemData.ButtonFlags.CONTROLThe control key is pressed.
SystemData.ButtonFlags.ALTThe alt key is pressed.

Variables

Variables

SystemData. ActiveWindow.name

stringThis variable contains the name of the window that is currently active for the callback event.  This is updated prior to every <SystemData.Events.UPDATE_PROCESSED> event.

SystemData. InputProcessed. EnterKey

booleanThis variable contains result for the last enter key event.  True if the event was handled by the UI, false if not.  This is updated prior to every <SystemData.Events.ENTER_KEY_PROCESSED> event.

SystemData. InputProcessed. EscapeKey

booleanThe result for the last escape key event.  True if the event was handled by the UI, false if not.

SystemData. InputProcessed. GamepadKey

booleanThe result for the last game pad key event.  True if the event was handled by the UI, false if not.

SystemData. InputProcessed. LButtonDown

booleanThe result for the last LButtonDown event.  True if the event was handled by the UI, false if not.

SystemData. InputProcessed. LButtonUp

booleanThe result for the last LButtonUp event.  True if the event was handled by the UI, false if not.

SystemData. InputProcessed. RButtonDown

booleanThe result for the last RButtonDown event.  True if the event was handled by the UI, false if not.

SystemData. InputProcessed. RButtonUp

booleanThe result for the last RButtonUp event.  True if the event was handled by the UI, false if not.

SystemData. MouseOverWindow.name

stringThe Window the mouse is currently over.

SystemData. InputProcessed. RButtonUp

numberThe current x mouse position on the screen.

SystemData. MousePosition.x

numberThe current x mouse position on the screen.

SystemData. MousePosition.y

numberThe current y mouse position on the screen.

SystemData. UpdateProcessed.Time

numberThe time value for the last update pass.

Events

All events are cached in the lua table in the format of SystemData.Events.EVENT_NAME

Summary
Events
ENTER_KEY_PROCESSEDThis event is broadcast when the enter key processing has completed.
ESCAPE_KEY_PROCESSEDThis event is broadcast when the enter key processing has completed.
L_BUTTON_DOWN_PROCESSEDThis event is broadcast when the LButtonDown processing has completed.
ENTER_KEY_PROCESSEDhis event is broadcast when the LButtonUP processing has completed.
ENTER_KEY_PROCESSED
L_BUTTON_DOWN_PROCESSED
R_BUTTON_DOWN_PROCESSEDThis event is broadcast when the RButtonDown processing has completed.not.
R_BUTTON_UP_PROCESSEDThis event is broadcast when the RButtonUp processing has completed.
UPDATE_PROCESSEDThis event is broadcast when the update pass has completed.
ALL_MODULES_INITIALIZEDThis event is broadcast after all modules have had their OnInitialize handlers executed

Events

ENTER_KEY_PROCESSED

This event is broadcast when the enter key processing has completed.  The variable SystemData.InputProcessed.EnterKey is updated prior to each broadcast.

ESCAPE_KEY_PROCESSED

This event is broadcast when the enter key processing has completed.  The variable SystemData.InputProcessed.EnterKey is updated prior to each broadcast.

L_BUTTON_DOWN_PROCESSED

This event is broadcast when the LButtonDown processing has completed.

ENTER_KEY_PROCESSED

his event is broadcast when the LButtonUP processing has completed.

ENTER_KEY_PROCESSED

booleanThe result for the last LButtonDown event.  True if the event was handled by the UI, false if not.

L_BUTTON_DOWN_PROCESSED

booleanThe result for the last LButtonUp event.  True if the event was handled by the UI, false if not.

R_BUTTON_DOWN_PROCESSED

This event is broadcast when the RButtonDown processing has completed.not.

R_BUTTON_UP_PROCESSED

This event is broadcast when the RButtonUp processing has completed.

UPDATE_PROCESSED

This event is broadcast when the update pass has completed.

ALL_MODULES_INITIALIZED

This event is broadcast after all modules have had their OnInitialize handlers executed

Functions

Summary
Functions
LoadResources()Loads UI resources from an xml file.
RegisterWindowSet()Registers a new set of windows with the UI system.
CreateWindow()Creates a window from an XML definition.
CreateWindowFromTemplate()Creates a window of the specified name from an XML definition.
CreateWindowFromTemplateShow()Creates a window of the specified name from an XML definition.
DestroyWindow()Removes a window and all of it’s children from the current UI.
GetScreenResolution()Returns the current screen resolution.
BroadcastEvent()Broadcasts an event with the UI system’s assigned event processor.
BuildTableFromCSV()Broadcasts an event with the UI system’s assigned event processor.
GetIconData()Returns the data for the specified icon.
GetMapIconData()Returns the data for the specified map icon.
LoadStringTable()Creates a new string table of the specified name from the data file.
UnloadStringTable()Unloads the specified string table.
GetStringFromTable()Returns the specified string from a string table
GetStringFormatFromTable()Returns a string from a string table with the substitution tags replaced by values in the params table.
LogSystem()Creates log files for all the functions & variables available to Lua.
CreateUIDocumentFile()Creates a NaturalDocs style output file that lists all registered functions and variables.
StringToWString()Converts a string to a wstring
WStringToString()Converts a string to a wstring
ScaleInterface()Sets the master UI scale.
SetUseLuaErrorHandling()Enables lua_errors for UI debugging.
GetUseLuaErrorHandling()Returns if lua-error handling is currently turned on.
SetLoadLuaDebugLibrary()Sets if the lua debug library should be loaded when reloading the UI.
GetLoadLuaDebugLibrary()Returns if the Lua debug library will be loaded when reloading the UI
SetCheckForCircularDependencies()Sets if the UI should check for circular dependencies.
GetCheckForCircularDependencies()Returns if the UI is currently checking for circular dependencies.
SetItemDragging()Inform the UI system that we are currently dragging something
RegisterEventHandler()Registers a generic lua callback event handler that is not tied to a window.
UnregisterEventHandler()Unregisters a generic event handler that is not tied to a window.
ForceProcessAllWindowAnchors()Force anchor processing for all windows.

Functions

LoadResources()

Loads UI resources from an xml file.

Parameters

directory(string) The directory from which to load.
xmlFileName(number) The name of the main xml file
allowRaw(boolean) Can we load raw versions of these files, or should be only look in a Mythic-Approved archive?

Returns

nilno return value

Notes

  • A file may only be loaded once, and all currently loaded files share the same resource database in the UI system.
  • You may call LoadResources as many times as you wish to load additional files.
  • To remove resource files, remove the includes xml and/or load calls from lua and reload the Ui sytem.

Example

none

RegisterWindowSet()

Registers a new set of windows with the UI system.  When the current window set changes, the specified lua callback function is called.

Parameters

setId(number) The id # for the window set
initializationFunction(string) The lua-callback function to be called for initialization.
shutdownFunction(string) The lua-callback function to be called when this set is de-activated.

Returns

nilno return value

Notes

  • Only one window set may be active at a time, but a particular window may be a part of multiple window sets.
  • initializationFunction is responsible for calling CreateWindow on its windows and initializing any other lua systems.
  • shutdownFunction is responsible for cleaning up after your window set in case it is deactivated unexpectedly.

Example

none

CreateWindow()

Creates a window from an XML definition.

Parameters

windowName(string) The name of the XML definition
show(boolean) Shows the window after creation if true, hides the window if false.

Returns

nilno return value

Notes

  • Reports an error and does not create the window if another window of that name exists.

Example

CreateWindow( "ChatWindow", true )

CreateWindowFromTemplate()

Creates a window of the specified name from an XML definition.

Parameters

windowName(string) The desired name for the created window.
templateName(string) The name of the XML template to use for creation.
parent(string) The name of the parent this new window should be a child of.

Returns

boolWhether or not the window could be created.

Notes

  • Each created window must have a unique name, so using this function allows you to create multiple instances of a particular window definition without explicitly defining each instance in xml.

Example

none

CreateWindowFromTemplateShow()

Creates a window of the specified name from an XML definition.

Parameters

windowName(string) The desired name for the created window.
templateName(string) The name of the XML template to use for creation.
parent(string) The name of the parent this new window should be a child of.
showWindow(boolean) Show the window on creation.

Returns

boolWhether or not the window could be created.

Notes

  • Each created window must have a unique name, so using this function allows you to create multiple instances of a particular window definition without explicitly defining each instance in xml.

Example

none

DestroyWindow()

Removes a window and all of it’s children from the current UI.  If an OnShutDown() callback is specified, that callback is executed prior to destruction.

Parameters

windowName(string) The name of the window.

Returns

nilno return value

Notes

  • If you call DestroyWindow from within a window callback for the window, or any of it’s children, the delete will be delayed until after the call completes.

Example

none

GetScreenResolution()

Returns the current screen resolution.  This is also the size of the Root window.

Parameters

none

Returns

xRes(number) The x screen resolution, in pixels.
yRes(number) The y screen resolution, in pixels.

Notes

  • The screen resolution is also the size of the Root window.

Example

none

BroadcastEvent()

Broadcasts an event with the UI system’s assigned event processor.  This is intended to be the primary method of communication between game system and lua interface layer.

Parameters

eventId(number) The event id to broadcast.

Returns

nilno return value

Notes

  • See the <Event Index> for a list of events available.

Example

none

BuildTableFromCSV()

Broadcasts an event with the UI system’s assigned event processor.  This is intended to be the primary method of communication between game system and lua interface layer.

Parameters

csvFilePath(string) The path for the csv file.
baseLuaVarName(string) The lua-table name to which to add the csv data.

Returns

nilno return value

Notes

  • The first line of the CSV file is expected to contain valid ansii string variable names, while all subsequent lines contain entries into that table.

Example

none

GetIconData()

Returns the data for the specified icon.

Parameters

iconId(string) The icon id

Returns

texutureName(string) The texture name for the icon.
xTexCoord(number) The x pixel texture coordinate in the texture.
yTexCoord(number) The y pixel texture coordinate in the texture.
disabledTexutureName(string) The texture name for the disable version of the icon.

Notes

  • If no icon is found, the UI system will return an error icon image.  These are can be defined as icon xml definitions such that:
Icon -1Invalid Icon Def.
Icon -2Icon texture is missing.

Example

local texture, x, y, disabledTexture = GetIconData( iconNum )

GetMapIconData()

Returns the data for the specified map icon.

Parameters

iconId(string) The map icon id

Returns

texutureName(string) The texture name for the icon.
xTexCoord(number) The x pixel texture coordinate in the texture.
yTexCoord(number) The y pixel texture coordinate in the texture.
xSize(number) The x pixel size of the icon.
ySize(number) The y pixel size of the icon.
rTintColor(number) The red tint color value for the icon (0-255).
gTintColor(number) The green tint color value for the icon (0-255).
bTintColor(number) The blue tint color value for the icon (0-255).

Notes

none

Example

local texture, textureX, textureY, sizeX, sizeY, colorR, colorG, colorB = GetMapIconData( ptData.icon )

LoadStringTable()

Creates a new string table of the specified name from the data file.

Parameters

tableName(string) The name for this new string table.
fileDirectory(string) The directory for the string table file
fileName(string) The file name of the string table file.
cacheDir(string) The cache directory to use for the string table file.
enumRoot(string) A lua-table name to use to create an enumeration for the string table.

Returns

nilno return value

Notes

  • String table names must be unique.
  • You must explicitly call UnloadStringTable prior to the load when reloading a string table.

Example

LoadStringTable("Default", "data/strings/"..language, "default.txt", "cache/"..language, "StringTables.Default" )

ToDo

Simplify this function...

UnloadStringTable()

Unloads the specified string table.

Parameters

tableName(string) The name of the string table.

Returns

nilno return value

Notes

none

Example

UnloadStringTable( "Default" )

GetStringFromTable()

Returns the specified string from a string table

Parameters

tableName(string) The name of the string table.
id(number) Index within this string table.

Returns

text(string) The string table entry text.

Notes

Returns the empty string “” if the function fails for any reason.

Example

local text = GetStringFromTable("Default", id )

GetStringFormatFromTable()

Returns a string from a string table with the substitution tags replaced by values in the params table.

Parameters

tableName(string) The name of the string table.
id(number) Index within this string table.
params(wstringTable) A table of wide-string parameters

Returns

text(string) The string table entry text.

Notes

none

Example

local text = GetStringFormatFromTable( "Default", id, params )

LogSystem()

Creates log files for all the functions & variables available to Lua.

Parameters

functionsFileName(string) Name of file to export the list of functions.
variablesFileName(string) Name of file to export the list of variables.

Returns

nilno return value

Notes

none

Example

none

CreateUIDocumentFile()

Creates a NaturalDocs style output file that lists all registered functions and variables.  This file can be included in a Natural docs project to track which functions and variables have been documented.

Parameters

fileName(string) Name of file to export the NaturalDocs output.

Returns

nilno return value

Notes

none

Example

none

StringToWString()

Converts a string to a wstring

Parameters

stringText(string) The string-type text.

Returns

wStringText(wstring) The wide-string conversion.

Notes

none

Example

none

WStringToString()

Converts a string to a wstring

Parameters

wstringText(wstring) The wstring-type text,

Returns

stringText(string) The string conversion.

Notes

none

Example

none

ScaleInterface()

Sets the master UI scale.  Scales the entire interface and establishes the default scale for all subsequently created windows.

Parameters

scale(number) Global scaling factor for the UI.  A scale of 1.0 is 100%.

Returns

nilno return value.

Notes

none

Example

ScaleInterface( InterfaceCore.scale )

SetUseLuaErrorHandling()

Enables lua_errors for UI debugging.  When enabled, all code-detected errors, such as failures in function calls, will trigger lua_error and force execution of the lua script to halt.  This will cause an error message with the file and line number to be printed to the DebugWindow.

Parameters

enabled(boolean) True = turns on, False = turns off

Returns

nilno return value.

Notes

none

Example

local enabled = GetUseLuaErrorHandling()
enabled = not enabled
SetUseLuaErrorHandling( enabled )

GetUseLuaErrorHandling()

Returns if lua-error handling is currently turned on.

Parameters

nilno parameters

Returns

enabled(boolean) True = turns on, False = turns off

Notes

none

Example

local enabled = GetUseLuaErrorHandling()
enabled = not enabled
SetUseLuaErrorHandling( enabled )

SetLoadLuaDebugLibrary()

Sets if the lua debug library should be loaded when reloading the UI.

Parameters

enabled(boolean) True = turns on, False = turns off

Returns

nilno return value.

Notes

  • The lua-debug library gives you additional tools for debugging your lua code.  One of the more useful commands is the <SHOW_STACKTRACE()> from our <Debug Utils>.

Example

local enabled = GetLoadLuaDebugLibrary()
enabled = not enabled
SetLoadLuaDebugLibrary( enabled )

GetLoadLuaDebugLibrary()

Returns if the Lua debug library will be loaded when reloading the UI

Parameters

nilno parameters

Returns

enabled(boolean) True = yes, False = no

Notes

none

Example

local enabled = GetLoadLuaDebugLibrary()

SetCheckForCircularDependencies()

Sets if the UI should check for circular dependencies.  This provides some additional debug checking at a cost of performance.  This is intended to be used by UI developers.  Currently this turns on checks for:

  • Circular Dependencies in your .mod files.

Parameters

enabled(boolean) True = turns on, False = turns off

Returns

nilno return value.

Example

local enabled = SetCheckForCircularDependencies()
enabled = not enabled
SetCheckForCircularDependencies( enabled )

GetCheckForCircularDependencies()

Returns if the UI is currently checking for circular dependencies.

Parameters

nilno parameters

Returns

enabled(boolean) True = yes, False = no

Notes

none

Example

local enabled = GetCheckForCircularDependencies()

SetItemDragging()

Inform the UI system that we are currently dragging something

Parameters

itemDraggingg(boolean) Sets item dragging to to true/fasle

Returns

nilno return value.

Notes

none

Example

none

RegisterEventHandler()

Registers a generic lua callback event handler that is not tied to a window.

Parameters

eventId(number) The id number of the event for which to register a callback.
callback(string) Full name of the lua function to be called when this event occurs.

Returns

nilno return value

Notes

You may register as many unique callbacks for a particular event as you wish.  General callbacks will remain registered as long as the current lua state persists or until you call UnregisterEventHandler() for this event/callback pairing.  All generic event registration will be cleared (and must be re-registered) when you reload the UI.

If your event really pertains to a specific window, it is better to use the WindowRegisterEventHandler(), so that the <GameData.ActiveWindow.name> variable will be set prior to the call.

Example

RegisterEventHandler(  SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED, "PlayerWindow.UpdateCurrentHitPoints")

UnregisterEventHandler()

Unregisters a generic event handler that is not tied to a window.

Parameters

eventId(number) The id number of the event for which to register a callback.
callback(string) Full name of the lua callback function.

Returns

nilno return value

Notes

  • none

Example

UnregisterEventHandler(  SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED, "PlayerWindow.UpdateCurrentHitPoints")

ForceProcessAllWindowAnchors()

Force anchor processing for all windows.

Parameters

nilno parameters

Returns

nilno return value

Notes

  • none

Example

ForceProcessAllWindowAnchors()
This element allows you to include additiontional files.
This element allows you to include lua files directly.
This is the container tag for all source file assets.
Window is the base level window definition.
This is the top level xml-tag for each interface xml file.
This element defines a single art texture component.
This element defines a font defintion.
This element defines the data for a single icon.
This element defines the data for a single icon.
Returns the data for the specified icon.
Returns the data for the specified map icon.
Creates a window from an XML definition.
Unloads the specified string table.
Unregisters a generic event handler that is not tied to a window.
Registers a lua callback for a game event.