Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated ui.xml file layout

...

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

 


Code Block
titlesample ui.xml file

 

...

1
2
3
4
5
6
7
linenumberstrue
<?xml version="1.0" encoding="UTF-8"?>

...


<addon name="foo"

...

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../ui/core/addon.xsd

...

">
  <environment type="detailmonitor">
    <file name="ui/file1.lua" />

...


    <file name="ui/file2.lua" />

...


    <dependency name="foo_dependency" />

...


    <savedvariable name="foo_MyData" storage="userdata" />

...


  </environment>
</

...

addon>

line 1: The file being in the XML-format, this is the XML-header.
line 2: The addon node is the root-node of the ui.xml file and describes the UI addon.

 

  • name: Gives the addon a unique name. It's suggested to name the addon according to the folder name of your addon. This ensures that if everybody sticks with that rule, players will never end up with two addons using the same name. (note that the addon-name must not start with ego_)viewtype
  • xmlns:xsi: specified for XML-standard compliance
  • xsi:noNamespaceSchemaLocation: references the corresponding XSD in the ui-directory. This allows your editor to highlight errors and display documentation/tooltips directly in the file, if supported by your editor.

line 3: Specifies the "display environment" of the addon. At the time of writing this, X Rebirth contains three distinct environments: "detailmonitor", "fullscreen", "fullscreen2". At any time there can be only one frame being displayed in each of these environments. Detailmonitor represents the environment for the cockpit detailmonitor, the other two are displayed fullscreen.

...

...

line 3+4line 4+5: 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 luaLua-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 56: 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. If an addon is running in multiple environments and you want to depend on the addon in all its environments, the dependency to that addon must be specified in each environment separately.
line 67: You can specify multiple variables which are to be saved either as userdata or in a savegame.

...