Clearing invalid 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
rhine770
Posts: 6
Joined: Sat, 24. Oct 15, 20:42
x3tc

Clearing invalid scripts

Post by rhine770 » Sat, 2. Sep 17, 06:54

I don't know whether to ask this in the scripting and modding section or here, so sorry, if this doesn't belong here.

I am playing a modified version of X3AP (still using 3.1) with XRM. A few weeks ago, I encountered a problem with a mod calling a certain script every time I saved and loaded the game. These scripts were piling up on my save over time before I realized this. Luckily, I found out the mod causing the problem and removed it, but I still have the script pile there (about 2000 !ship.cmd.follow.spacefly why the mod even called this script is a mystery to me.)

My question is pretty simple, how the heck do I remove these dead scripts? Is there a command or something I can do to clear them up? I know some of those called upon are valid, but the rest are just there taking up space and I imagine contributing to lag.

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 30367
Joined: Fri, 16. Apr 04, 19:21
x4

Post by Alan Phipps » Sat, 2. Sep 17, 13:58

Moving to S&M where more scripting experts will see this.
A dog has a master; a cat has domestic staff.

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

Post by Joubarbe » Sat, 2. Sep 17, 18:22

It's not as easy as you think. To remove a script from the stack, you have three options:

1/ The script has an update routine, and when you change its version, it resets itself and can potentially "return null", i.e be removed from the game.

2/ You have a mean to restart your game by saving all your previous game data.

3/ If the script is attached to an object, you can delete this object from the game.

Unfortunately, the first two options do not apply to you, because I really doubt your script has an update routine, and the second option only applies to Litcube's Universe (the famous Export/Import feature).
So the only thing you can do is to either wait for the destruction of these ships, or kill them yourself... (preferably with a cheat) But 2000... Meehh that's gonna take some time!

EDIT: and as Cycrow said below, you can "interrupt" the script, but that requires some scripting knowledge.
Last edited by Joubarbe on Sat, 2. Sep 17, 19:59, edited 1 time in total.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22201
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sat, 2. Sep 17, 18:48

Scripts are usually either global, or they are run on objects.

for global scripts, you can manually kill them from the script editor.

for the others, its abit more difficult, as they could be running on any of the objects in the game.

you could write a script that gets a list of all ships/stations, then checks if that script is running on any of the tasks, and then call !lib.interrupt on that task which will stop it.

The script !ship.cmd.follow.spacefly is one of the spacefly command scripts, and is usually run on spaceflys. If you really have lots of those scripts active, it likely means you also have lots of spaceflys.

you could simply find all spaceflys and destroy them

rhine770
Posts: 6
Joined: Sat, 24. Oct 15, 20:42
x3tc

Post by rhine770 » Sat, 2. Sep 17, 23:52

Welp, I don't have any scripting knowledge and simply kill all those space flies? :skull: If it's manually, it would be easier just to start a new game and cheat every back in. Well, maybe if they all spawn in one place... but, how easy would it be to kill them with a script like Joubarbe said?

Ah well, I can just start a new game and make liberal use of your cheat scripts Cycrow. Any scripts out there that increase combat/trade rank, by the way?[/u]

|K.O.S.H.
Posts: 3724
Joined: Fri, 19. Dec 03, 10:36
x3tc

Post by |K.O.S.H. » Fri, 9. Feb 18, 12:33

hey rhine.
I have the same problem.
Which script did create the flies?

Did you solve it?
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

GunthorNC
Posts: 13
Joined: Tue, 3. Jan 17, 00:23
x3tc

Re: Clearing invalid scripts

Post by GunthorNC » Mon, 21. Jan 19, 04:12

Same issue as Rhone and Kosh. Did either of you guys figure it out?

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: Clearing invalid scripts

Post by SirNukes » Tue, 22. Jan 19, 06:02

I put in a fix for the spacefly problem in the X3 Customizer (link in sig). Well, two fixes: one to stop them being spammed, the other to kill off existing ones.

Post Reply

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