On the subject of unsigned scripts loading without enabling the editor

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

On the subject of unsigned scripts loading without enabling the editor

Post by Burianek » Sun, 27. Nov 05, 21:53

Hi everyone, we had some good discussion a while back in one of the script threads about whether or not unsigned setup and init scripts are loaded upon game load if the script editor has not been enabled.

I was under the impression that no unsigned script should be loaded if the script editor has not been activated. I was, of course, wrong ;).

Here is what is going on:

If you have any unsigned scripts that begin with a '!' they will be loaded regardless of whether they are signed or unsigned. Scripts that begin with a ! are special cases and will always be run, signed or not.

However, loading an unsigned script simply because it begins with a '!' will kick your game into running in *modified* mode. You can check the player stats at the bottom to verify this. This is exactly the same as if you had enabled the script editor to get your game into modified mode.

Once your game is running in modified mode, upon the next game load, all unsigned scripts will be run, since running in modified mode is equivalent to having activated the script editor.

Make sense?

So under normal circumstances, unless you have a script that begins with an !, unsigned setup/init scripts should not be running in an unmodified game. This is how it worked in X2 as well.

It is suggested that community modders do NOT EVER start a script with !.
Since it can cause a cascading effect, loading unsigned scripts into a game where the script editor has not been expressly activated.

Hope that clears things up.

Cheers.
"Nature's first green is gold" . . . stay golden.

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

Post by Burianek » Mon, 28. Nov 05, 03:34

Comments welcome, want to make sure everyone sees this.
"Nature's first green is gold" . . . stay golden.

RaGodofTehSun
Posts: 417
Joined: Thu, 23. Dec 04, 04:02
x3

Post by RaGodofTehSun » Mon, 28. Nov 05, 03:38

whats the point of it saying modified btw?

User avatar
Red Spot
Posts: 3224
Joined: Fri, 4. Feb 05, 14:44
x3

Post by Red Spot » Mon, 28. Nov 05, 03:38

seen it ..;)


maybe an idea to put it in one off the stickys so people who do their homework can still find it later on ..??


G

User avatar
Burianek
Posts: 2928
Joined: Mon, 29. Dec 03, 04:29
x3tc

Post by Burianek » Mon, 28. Nov 05, 03:43

I might eventually, I'll probably just make a link from the tutorials sticky.
In fact, I'll do that now ....
"Nature's first green is gold" . . . stay golden.

Sirus5
Posts: 1338
Joined: Sun, 31. Aug 03, 16:29
x4

Phew, Only ref I can find

Post by Sirus5 » Sat, 5. Jan 08, 04:11

Apologies to Overworked Moderators for ressurecting a REALLY old thread.

However...
1. It's the only reference I can find to this.
2. It's really pertinent.
3. I feel the thread really hasn't yet answered all the parameters.

I undersand why we shouldn't start an unsigned setup script/init script with "!", however, I have an Unsigned Setup script which I wish to load and wondered how to go about it!

As I see it, I have 3 options.
1. Use the "!" - and have every Tom, Dick and Harry load with it!
2. Have it packed in with Cat/Dat in a Mod... well, not really for me
3. Load the Script Editor...- hmm - I don't like people to see all that info and some of them don't like this...

Soo, what's my solution - danged if I know. Please would someone assist

Thanks

eladan
Posts: 5354
Joined: Sat, 7. Jan 06, 17:01
x4

Re: Phew, Only ref I can find

Post by eladan » Sat, 5. Jan 08, 06:39

Sirus5 wrote:As I see it, I have 3 options.
1. Use the "!" - and have every Tom, Dick and Harry load with it!
2. Have it packed in with Cat/Dat in a Mod... well, not really for me
3. Load the Script Editor...- hmm - I don't like people to see all that info and some of them don't like this...
4. None of the above.

There are special script names which are used to automatically load scripts. They are any scripts starting with setup., al.plugin., and init. They each work in somewhat different ways, and are used for different purposes.

For most scripts, they will use the setup type, and you won't need to look any further. Scripts of this type will be automatically run whenever you start a game or load a saved game, and so are perfect for setting up command-based scripts, which are the most common script type. If you aren't wanting to tie your script to a command, i.e. you want it to run on a regular basis without player interaction, then AL plugins are the way to go.

:EDIT: Note that these require the script editor to be enabled. This whole thread is really actually only about having scripts run without enabling the script editor.

User avatar
ninjitsumonk
Posts: 1309
Joined: Thu, 1. Mar 07, 10:21
x3

Post by ninjitsumonk » Sat, 5. Jan 08, 10:13

not necessarily, I've seen a number of unsigned scripts run on a game.
It seems though that setup.xxxxx scripts are one of the types that aren't loaded *properly*[1] upon a new game starting.
al.plugin.xxxx scripts seem to run fine(may just be my experience of them) upon starting a new game.

[1]it would seem that there is something that prevents setup.xxxxx scripts from functioning properly.

The setup script in question, after testing&messing about with it registered the Tfile fine, allocated array size(3) and set it as a global variable.
It didn't, however, manage to run the plugin.plugman.getware script and set the appropraite addresses for the wares.

When I checked it(got the global variable) and printed it to the logbook it came up with:
ARRAY(null, null, null)

After enabling the script editor, saving and loading, then repeating the process, it came up with:
ARRAY(Nanite light, Nanight heavy, Nanite Military)

This suggests that setup scripts are limited in how they are allowed to work(possibly lower "setup" time?) in an unmodified game.
Archeo Avis wrote:
if you take out phrasing and root notes and just look at the notes, they are the same
So what you're saying is, if you ignore everything that's different and focus only on the one thing that's the same, they're same.

Good God.

eladan
Posts: 5354
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Sat, 5. Jan 08, 10:39

Huh. You're right, ninjitsu. I've never tried it to see.

Side effect is that starting a new game with unsigned AL plugins installed will automatically mark it modified, exactly the way Burianek was discussing above... :roll:

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Sat, 5. Jan 08, 13:37

ninjitsumonk wrote:not necessarily, I've seen a number of unsigned scripts run on a game.
It seems though that setup.xxxxx scripts are one of the types that aren't loaded *properly*[1] upon a new game starting.
al.plugin.xxxx scripts seem to run fine(may just be my experience of them) upon starting a new game.
setup scripts wont run when you start a new game because new games aren't modified, so no unsigned scripts will run.

if u prefix the script name with ! then it forces the game into modified mode, which means any game you start or load will automatically be modified without enabling the script editor.

init scripts should be avoided if possible.
setup scripts are run once the game has been loaded, ie, after the creation of the universe.

init scripts run before, which means if you try to do anythign in the universe in an init script it will have problems as the universe is not yet created.

al.plugin scripts are simlar to setup scripts, but they are run first and usually used to register the al plugins

eladan
Posts: 5354
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Sat, 5. Jan 08, 14:47

Cycrow wrote:setup scripts wont run when you start a new game because new games aren't modified, so no unsigned scripts will run.
It seems from what ninjitsu said, though, that this is not quite accurate - that certain commands put into a setup script will still run. And certainly, AL plugins also will run without enabling the script editor first (forcing the game into a *modified* state...) which is a case that Burianek didn't mention above, and one which deserves some pause for consideration...

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Sat, 5. Jan 08, 21:41

the only ones that force modified mode is if they start with !.

any others shouldn't be run at all.

however, if your using a mod, ie have anything selected in the mod package, or have any kind of fake patch, then the game will also go into modified mode allowing some scripts to run.

if you dont have any of those and scripts are still forcing modified mode, then theres likly a problem somewhere

eladan
Posts: 5354
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Sun, 6. Jan 08, 04:33

Ah crap. Humble pie time.

For some reason, my vanilla install (which I keep vanilla precisely to test non-modded conditions,) had one minor fake patch. I must have been absent when I put that in.

Removed said fake patch, and amazingly enough, you're right. unsigned AL plugins are blocked. Apologies if I confused anyone.

Post Reply

Return to “X³: Reunion - Scripts and Modding”