Init vs Setup scripts

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
CaplinCaplin
Posts: 94
Joined: Wed, 16. Jan 19, 20:23
x3ap

Init vs Setup scripts

Post by CaplinCaplin » Sat, 2. Feb 19, 19:28

Hi ALl,

THis distinction is probably covered somewhere in the forums, but I can't find an answer after some searching. What exactly is different between an init.* script and a setup.* script? When should you use one or the other? I see some instructions say explicitly to not use an init script, but they don't really explain why.

Any info would be greatly appreciated.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: Init vs Setup scripts

Post by Joubarbe » Sat, 2. Feb 19, 19:55

!init.* scripts are used by vanilla scripts to initiate things.

setup.* are automatically run by the game when started.

You want setup.* scripts.

CaplinCaplin
Posts: 94
Joined: Wed, 16. Jan 19, 20:23
x3ap

Re: Init vs Setup scripts

Post by CaplinCaplin » Sat, 2. Feb 19, 20:30

Thanks. :)

I was just wondering because in this thread, it's suggested I use an init script. Should I just rename it to "setup" and carry on?

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24965
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Init vs Setup scripts

Post by X2-Illuminatus » Sun, 3. Feb 19, 10:17

No, using an init script in your case is fine. The main difference between init and setup scripts is when they are loaded. init scripts are loaded first, even before other assets in the universe are set up properly. Thus, init scripts can be used to register command slots or hotkeys and the like. If, however, you want to set up anything regarding assets, for example add a specific ware to stations for sale, you would rather use a setup script. Additionally, init scripts are loaded automatically on gamestart or game load. It does not matter whether they are signed (through Egosoft) or not. In contrast, unsigned setup scripts are only loaded in a modified game.

Most of this basic knowledge about scripting is explained in the MSCI Handbook, which you can find in our downloads section here.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: Init vs Setup scripts

Post by Joubarbe » Sun, 3. Feb 19, 11:33

I lack basic knowledge then :)

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”