Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Linked Applications
Loading…
Spaces
Create
Quick Search
Help
Online Help
Keyboard Shortcuts
Feed Builder
What’s new
Available Gadgets
About Confluence
Log in
X Rebirth Wiki (English)
Pages
…
X Rebirth Wiki
Modding support
Understanding X: Rebirth from a Modder's View
Module 2: XML
Module 2: XML
You are not logged in. Any changes you make will be marked as
anonymous
.
This page is also being edited by
. Your changes will be merged with theirs when you save.
image-effects
image-attributes
search
attachments
weblink
advanced
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
Colour picker
More colours
Formatting
Strikethrough
Subscript
Superscript
Monospace
Clear formatting
Bullet list
Numbered list
Task list
Outdent
Indent
Align left
Align center
Align right
Page layout
Link
Table
Insert
Insert content
Image
Link
Attachment
Symbol
Emoticon
Markup
Horizontal rule
Task list
Insert macro
User mention
JIRA Issue/Filter
Info
Status
Gallery
Table of Contents
Other macros
Page layout
No layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard shortcuts help
<p>As you may know, there are a lot of XML files in the X Rebirth game itself, ranging from production specification (i.e., how to make E-Cells), station definitions, galaxy layouts, to AI scripts, MD scripts and other unexpected things.</p><p>Basically everything in X Rebirth that is not part of the "core" system is XML.</p><h1>XML Patching Guide</h1><p><strong>For further details, there is a page talking about patching XMLs, and it can be found <a href="https://forum.egosoft.com/viewtopic.php?t=354310">here</a>.</strong> This page offers an overview of what can be done.</p><p>Note that when you apply replace or remove patches, <strong><em><u>make sure you match your file structure and file location with the target XML you wish to replace or remove</u></em></strong>, or else funny things might occur.</p><p>For your interest, starting from v4.0 RC3, you can add silent="true" attribute to any add, replace or remove node to suppress errors when any is produced during loading. This can be useful to create overrides to other mods as 'optional' content and not show up as errors when the other mods are not present.</p><h2>Add Patch</h2><p>This patch method adds new content into the vanilla XML when the game processes the mods.</p><p>NOTE: You can directly type the XML nodes when adding instead of a diff-add node set, like in the language files, instead of doing <diff><add sel="/languages"><page id=""/></add></diff> you can just directly do <languages><page id=""/></languages></p><h2>Replace Patch</h2><p>This patch method replaces contents in existing (other mods count as "existing" too) XML with something you specify.</p><p>NOTE: The content you replace with should match the type of the original content, so after replacing, there will not be any part in the XML "standing out from the rest" because it has been replaced wrongly.</p><h2>Remove Patch</h2><p>This patch method removes content in existing (other mods count as "existing" too) XML. To clarify, this method clears the node itself, not replace with white text.</p><h1>Good Practices</h1><h2>Be Specific</h2><p>This is simple to understand. Consider the following example, patching the file "/libraries/wares.xml":</p><p><diff> </p><div class="collapsible-content" style="margin-left: 1.0em;"><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware/production/@amount</span>"</span>></span><span class="text">50</span><span class="html-tag"></replace></span> </div><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware/production/@time</span>"</span>></span><span class="text">600</span><span class="html-tag"></replace></span> </div><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware/production/@amount</span>"</span>></span><span class="text">50</span><span class="html-tag"></replace></span> </div><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware/production/@time</span>"</span>></span><span class="text">600</span><span class="html-tag"></replace></span> </div></div><div class="line"><span class="html-tag"></diff></span> </div><div class="line"><span class="html-tag">The game will throw an error because it does not know what you are talking about, or precisely, <u>which ware and which production</u> you are talking about.</span></div><div class="line"><span class="html-tag">In these situations where there are <u>multiple nodes of the same tag under the same node (common in index files)</u>, try to specify like:</span></div><div class="line"><span class="html-tag"><br /></span></div><div class="line"><span class="html-tag"><diff></span> </div><div class="collapsible-content" style="margin-left: 1.0em;"><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware[@id='fusionreactor']/production[@method='default']/@amount</span>"</span>></span><span class="text">50</span><span class="html-tag"></replace></span> </div><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware[@id='fusionreactor']/production[@method='default']/@time</span>"</span>></span><span class="text">600</span><span class="html-tag"></replace></span> </div><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware[@id='fusionreactor']/production[@method='omicron']/@amount</span>"</span>></span><span class="text">50</span><span class="html-tag"></replace></span> </div><div class="line"><span class="html-tag"><replace<span class="html-attribute"> <span class="html-attribute-name">sel</span>="<span class="html-attribute-value">/wares/ware[@id='fusionreactor']/production[@method='omicron']/@time</span>"</span>></span><span class="text">600</span><span class="html-tag"></replace></span></div></div><div class="line"><span class="html-tag"></diff></span></div><div class="line"><span class="html-tag"><br /></span></div><div class="line"><span class="html-tag">Here, I used the format [@attribute='value'] (notice the single quotation marks) to specify the ware fusionreactor (Fusion Reactors) and its production method default and omicron (Default and Omicron Lyrae respectively). This patch file replaces the values such that "a group of 50 Fusion Reactors will be produced in an interval of 600 seconds in an hour" instead of the existing values.</span></div><h2 class="line"><span class="html-tag">Be Considerate/Be Specific 2.0</span></h2><p><span class="html-tag">This situation is a bit rare, but might occur when you do not know how to "be specific" when replacing something. Here is an example:</span></p><p><span class="html-tag">You saw an Energy Array in an Albion zone, and feel very sad because it is not a complete build of the Energy Array. You would like to mod such that it is a complete build of the Energy Array, and you type something like (<strong>This is a pseudo-code; it shows you the idea instead of the actual code</strong>):</span></p><p><code></p><p><span class="html-tag">Replace Concealed Hideout (AES Energy Array 1, AES Energy Array 2, AES Energy Array 3, AES Energy Array 4, AES Cell Fab Matrix, Build Spot 1, Build Spot 2), Far Out (...), Albion (...)</span></p><p><span class="html-tag"> with Concealed Hideout (AES Energy Array 1, AES Energy Array 2, <u><em>AES Energy Array 3 (...)</em></u>, AES Energy Array 4, AES Cell Fab Matrix, Build Spot 1, Build Spot 2)</span></p><p><span class="html-tag"></code></span></p><p><span class="html-tag">You make your mod, and happily load it into the game. You are now satisfied that the AES Energy Array 3 ins finally complete.</span></p><p>This may seem like a happily ever after, but what if you load another mod into the game, and it has the following code:</p><p><code></p><p><span class="html-tag">Replace Concealed Hideout (AES Energy Array 1, AES Energy Array 2, AES Energy Array 3, AES Energy Array 4, AES Cell Fab Matrix, Build Spot 1, Build Spot 2), Far Out (...), Albion (...)</span></p><p><span class="html-tag">with Concealed Hideout (<u><em>PMC</em></u> Energy Array 1, <u><em>PMC</em></u> Energy Array 2, <u><em>PMC</em></u> Energy Array 3, <u><em>PMC</em></u> Energy Array 4, <u><em>PMC</em></u> Cell Fab Matrix, Build Spot 1, Build Spot 2)</span></p><p></code></p><p>Since both mods are replacing the same zone, <strong>funny results will occur</strong>. For some users, their end result will be "AES Energy Array 3 is a complete build", and for the others, theirs will be "All NPC stations in Concealed Hideout, Far Out, Albion are owned by PMC", <strong>depending on the load order (which you, as the modder, do not have much control on)</strong>. No errors will be thrown since technically, there is no error - all XML syntax checks would be OK.</p><p>To solve this problem, each of the mods can be rewritten as:</p><p><code></p><p>Replace Build Plan (...), AES Energy Array 3 (...), Concealed Hideout (...), Far Out (...), Albion (...)</p><p>with <u><em>Build Plan</em></u></p><p></code></p><p><code></p><p>Replace Owner, AES Energy Array 1 (...), Concealed Hideout (...), Far Out (...), Albion (...)</p><p>with <u><em>PMC</em></u></p><p></code></p><p>In this way, when both mods are loaded, the end results will always be "AES Energy Array 3 is a complete build" AND "All NPC stations in Concealed Hideout, Far Out, Albion are owned by PMC", reducing potential conflicts, confusions and loss of profitssssss.</p><p>Please, be considerate.</p>
If you are unable to use this CAPTCHA please
contact your administrator
for assistance.
Attachments
Labels
Watch this page
What did you change?
Notify watchers
Edit
Preview
Save
Cancel