--- title: Code examples summary: Regular mod examples for XML properties, a first MD script, UI windows, buttons and text. section: wiki kind: example status: example tags: ["X4","modding","examples"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/"] --- ## Change ship hull strength The [XML patch guide](wiki:editing-parameters) uses complete files from `wiki/examples/elite_hull`: [manifest](../examples/elite_hull/content.xml) and [Elite macro patch](../examples/elite_hull/assets/units/size_s/macros/ship_arg_s_fighter_02_a_macro.xml). Copy the folder contents into your extension and retain the directory structure. The selector was checked against X4 9.00; the new mod was not separately run in game. ## A first MD script [Hello X4](wiki:first-extension) provides a [manifest](../examples/hello_x4/content.xml) and [MD script](../examples/hello_x4/md/HelloX4.xml). Its one-time cue writes to the log and need not execute again when loading an already saved state. ## A custom UI [Create a window](wiki:create-ui) covers a Helper frame, table, text and Close button. Your mod must supply a call after UI readiness. [Lua ↔ MD](wiki:md-lua-bridge) shows both event endpoints; [a standard UI button](wiki:extend-ui) is a fragment inside an existing table builder. ## New content [Add a ship](wiki:adding-ship) follows macro, index and ware registration. Obtain the complete original macro from your own game; original game files are not presented as authored examples. [Text](wiki:localization) and [prices](wiki:wares-and-prices) provide targeted XML examples. ## Before using a block Identify whether it is a complete file, an actions fragment, part of a Lua function or pseudocode. Check version, dependencies and IDs. A successful wiki build does not turn a learning example into a tested game scenario.