Clearing invalid scripts
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Clearing invalid scripts
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.
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.
-
- Moderator (English)
- Posts: 30367
- Joined: Fri, 16. Apr 04, 19:21
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.
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.
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
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
Welp, I don't have any scripting knowledge and simply kill all those space flies? 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]
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]
Re: Clearing invalid scripts
Same issue as Rhone and Kosh. Did either of you guys figure it out?
Re: Clearing invalid scripts
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.
Author of X3 Customizer and X4 Customizer