HelloWorld Sample

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
werit
Werit Gaming
Posts: 39
Joined: Mon, 8. Jul 19, 14:45
x4

HelloWorld Sample

Post by werit » Wed, 24. Jul 19, 14:07

Hi all,

I put together a quick HelloWorld sample mod. Steps:

1) Create a directory called HelloWorld in X4 Foundations\extensions\HelloWorld

2) Create a content.xml file in that directory, as seen below.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<content id="HelloWorld" name="HellowWorld" description="Simple hello world extension."  author="werit" version="001" date="2019-07-24" save="0">
<text language="44" name="HelloWorld" description="Sample extension" author="Werit" />
</content>
3) Create a directory named md

4) In the md directory, create a file called HelloWorld.xml with the contents below

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<mdscript name="HelloWorld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <cue name="WaitForGameStart">
      <conditions>
         <event_game_loaded />
      </conditions>
      <actions>
        <debug_text text="'Hello World!'" filter="error" />
      </actions>
    </cue>
  </cues>
</mdscript>
5) When starting up X4, add the command line option: -logfile debuglog.txt

6) Startup X4, go into Extensions and make sure HelloWorld is enabled. Log into a game.

7) Find debugLog.txt, it should have a line: [=ERROR=] 29816.83 Context:md.HelloWorld.WaitForGameStart: Hello World!

This may be old news, but hopefully, someone finds it useful.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13296
Joined: Sun, 15. Feb 04, 20:12
x4

Re: HelloWorld Sample

Post by euclid » Wed, 24. Jul 19, 20:31

Thanks, werit. You may want to check this sticky for other examples ;-)

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Post Reply

Return to “X4: Foundations - Scripts and Modding”