Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added note on Lua files not in extension root-directory

...

The entry point for any UI mod is the ui.xml file. In your folder in the extensions directory, simply create such a file. Examples can be taken from the ui.xml files in ui/addons/ego_xxxx. The structure is documented via the XSD-file under ui/core/addon.xsd.

Info

Please note that Lua files must not be put into the root-folder of the extension. It's best practice to create a ui-folder and put the Lua files there.

Creating the ui.xml file

sample ui.xml file

 

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<addon name="foo" viewtype="detailmonitor" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ui/core/addon.xsd">
  <file name="ui/file1.lua" />
  <file name="ui/file2.lua" />
  <dependency name="foo_dependency" />
  <savedvariable name="foo_MyData" storage="userdata" />
</addon>

 

...

line 3+4: You can specify multiple Lua scripts which the game loads in the given sequence when loading the addon. Note that Lua scripts must have the lua-extension and MUST NOT contain bytecode. If a Lua file contains bytecode, the file will not be loaded and you will get an error message. Furthermore the Lua file MUST NOT be located in the extension's root directory.
line 5: You can specify dependencies for the addon. This ensures that any dependent addon is loaded prior to your addon. For instance if you plan to modify the ego_detailmonitor addon, you would specify the "ego_detailmonitor" dependency here. Note that only addons in the same environment can be specified as dependent.
line 6: You can specify multiple variables which are to be saved either as userdata or in a savegame.

...