many script instances slow down SETA (spaceflies, Anarkis/Pirate Guild)

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

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

many script instances slow down SETA (spaceflies, Anarkis/Pirate Guild)

Post by |K.O.S.H. » Mon, 5. Feb 18, 08:33

Hi,

i've allready started a topic in the german forum without success.
There three scripts running on many instances and i can't stop them:

!ship.cmd.follow.spacefly: ~6500 instances
!ship.cmd.idle.spacefly: 551 instances
anarkis.pirate.sig.pb.attacked: ~1200 instances (that one comes from the pirate guild - plugin (maybe an old version))

Those scripts are subject to slow down my seta (only works 2x)


I focussed on the spacefly scripts and tried to stop them via:
- return null -> does not work, because the are cached
- find spaceflies via "find ship" with shipttype (from main and subtype) -> no spaceflies found, even if tehre were some in my sector
- find spaceflies via "find ship" with object class -> no spaceflies found, even if tehre were some in my sector
- changed object class, types and objectid!! in tships to target them via scripteditor
- kill everything manually via modded weapon, that clears a sector
- kill all ships, stations, asteroids, debries, planets, nebulas via script

It seems like these scripts run on something else, than a spacefly. All spaceflies - even in the unfocused sectors - get destroyed, when my ship leaves the sector.

The anarkis script also remains, after all ships and stations are destroyed via script.

On which objects can they run at?
I think they may have been startet in the mission director, but i have no experience with it.


My savegame is ten years old, i really want to keep it. But without seta it gets complicated...

Can somebody help me please?
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by |K.O.S.H. » Tue, 6. Feb 18, 19:12

no ideas? :(
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by X2-Illuminatus » Wed, 7. Feb 18, 19:08

It wouldn't surprise me if you cannot find Spaceflies with the Script Editor, as in the vanilla game they are created and treated differently to other ships. There are also other ingame objects (like suns) which the Script Editor cannot find. You may have more luck with the Mission Director's find ship/object commands, but that is pure speculation from my side.
|K.O.S.H. wrote:All spaceflies - even in the unfocused sectors - get destroyed, when my ship leaves the sector.
Everything is destroyed in the Unfocussed Jumpdrive sector, when you leave it. So this alone isn't special. What you could test is what happens when you create spaceflies OOS (i.e. in a sector you're currently not in, except for the UFJD sector). Do they persist or are they destroyed immediately? If they persist, then what happens when you enter and leave the sector they were created in shortly afterwards? If leaving the sector destroys them, writing a script which jumps your ship to every possible sector and waits a short while, before jumping to the next, might be a viable solution to get rid of the spaceflies.
What could prove difficult is when the spaceflies were created in sector null. Some scripts use this area to create objects in a safe place, before they are used later, or to read their properties upfront for which you need the actual object. If, for example, a script was looping through all TShips entries and forgot to clean up afterwards, this may explain why there are Spaceflies you cannot find in the normal universe.
|K.O.S.H. wrote:It seems like these scripts run on something else, than a spacefly.
In theory it could be another ship. But then again, you mentioned you destroyed all of them already. Considering that the spacefly scripts use ship specific commands I doubt that they would even run on something else than a ship without throwing errors or even causing a game freeze.
|K.O.S.H. wrote:The anarkis script also remains, after all ships and stations are destroyed via script.

On which objects can they run at?
I think they may have been startet in the mission director, but i have no experience with it.
I feel that's rather unlikely. Interaction of Mission Director and Script Editor is rather limited. While it's possible to start MSCI scripts from the MD, the cleaner and easier way is using the SE directly. Of course, there are cases where the MD may have to call scripts. However, looking at the script in question - as its name already suggests it's a custom signal script connected via a secondary signal by another script to Pirate Bases - this is hardly the case here. Besides iirc Serial Kicked wasn't a big fan of the MD to begin with.
I can remember that there was some discussion about secondary signals not working correctly, I think some of them firing twice, with some older X3TC version. But I don't recall the details. Maybe this led to a problem with the clean-up after destruction, too. But again that's pure speculation, and not really possible to prove.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

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

Post by |K.O.S.H. » Fri, 9. Feb 18, 09:05

Thx alot for your answer and your ideas.

I allready visited all sectors manually, but nevertheless i made that jump script.
I also tried everything else:

Creating a spacefly via maintype 7, subtype 275 and "create ship" command does create a whole spacefly wing, not a single one. Thats interesting, because if you use subtype 276 (stardust ship) it only cretes a single ship.

Creating spaceflies in an OOS, entering and leaving this sector destroys them.

So a i created that jump script and jumped all sectors. After my journey there as many spaceflies, as before.

Creating spaceflies with "null" als sector does not work. Well, at least, no more script instances get startet.


I checked some of the MD scripts and noticed that they create spaceflys - maybe as dummies. So this will be my next attempt (i still have almost zero knowlegde of the MD).
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by Cycrow » Fri, 9. Feb 18, 11:54

i seem to remembering someone else mentioning this happen as well. I think it was coming from some script, but i cant remember which one.

but just to confirm, there isn't a way to get the spacefly objects in scripts, they are classed as special objects in the sector, and not part of the ship arrays.

And they are only in the active sector.
They are created in swarms, with the leader getting the script !ship.cmd.idle.spacefly, and the rest getting !ship.cmd.follow.spacefly.

based on the ratio, it would seem likely they are running on spaceflies.

maybe do a file search in your current script directory, for all scripts that are using the create spacefly command

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

Post by |K.O.S.H. » Fri, 9. Feb 18, 13:22

I also tried to delete all scripts without "!", but with no success.

I think they have been generated in sector null, maybe it was possible in some earlier versions of the game...

I think i did a file search with total commander, but to be sure i will do it (again).
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by SirNukes » Fri, 9. Feb 18, 21:56

One out of the box approach would be to figure out how running scripts are stored in the save file, find where the spacefly scripts are, then edit them directly to exit out. Off the top of my head, the general steps would be:

1) Decompress the save; it is in a gzip format. (Since the pck files are gzipped, I gave a shot at unzipping a save the same way, successfully.)

2) Find where and how any spacefly scripts are cached. The aim would be to find the code sections, which contain the commands used by the script. They might show up multiple times; in the save I looked at, a particular comment line from the spacefly idle script is present 120 times. This part could be somewhat bothersome, if a lot of pointer chasing will be involved.

3) Find some convenient node in the script that can be swapped to something that will exit it (a 'return' (code 103) or a 'break' replacing a part of the loop that will be reachable). It would be safest if the replacement node is the same size as the replaced node (when including any extra arguments), for the cleanest edit. Apply the change to all of the scripts found, and hope for the best.

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

Post by |K.O.S.H. » Sat, 10. Feb 18, 10:00

I also had the idea to edit the savegame. The for the information about the zipping.

My approach will be to find the objects, delete them directly or change the sector if possible.

edit: i unzipped it, some things are readable, but ist still somehow encoded.
That will Need some time.. ;)

Maybe Egosoft wants to help me? (hahaha)
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by |K.O.S.H. » Sat, 10. Feb 18, 11:50

It Looks like the scripts and objects are not stored plain or ordered.

There seems to be links/addresses, which are badly encoded, so you cant even search them in the file.

I managed to edit the savegame, and rename the idle scripts name, trying to inject my return script, but of course i didnt work ;)

Only the name was changed
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by |K.O.S.H. » Tue, 13. Feb 18, 11:50

I managed to get all possible cue name from the egosofts scripts (2258) and canceled them all. - no success...
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

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

Post by Cycrow » Tue, 13. Feb 18, 12:34

One thing you could try is to start a new game eave it running for awhile then check if it has the same problem. If it doesn't, then you will know that it's a script in your save game that's causing it. Have you also checked if any scripts are running globally, and cancelled them?

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

Post by |K.O.S.H. » Tue, 13. Feb 18, 13:13

Yes, I stopped all global scripts.

I have an eye on the instances, the number does not increse anymore.
I patched the two (spacefly) scripts, so that i can kill any new instances, but he old ones remain :/

If there was a way to restart running scripts with a newer version, my problem would be solved.

Or a command to get all objects, that run a certain script.
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

User avatar
ubuntufreakdragon
Posts: 4044
Joined: Thu, 23. Jun 11, 14:57
x4

Post by ubuntufreakdragon » Tue, 13. Feb 18, 23:02

already tried find flying ware: sector=<Var/Sector> maintype=<Var/Number> subtype=<Var/Number> flags=<Var/Number> refobj=<Value> maxdist=<Var/Number> maxnum=<Var/Number>, refpos=<Var/Array> instead of find ship?
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

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

Post by |K.O.S.H. » Thu, 15. Feb 18, 15:26

yes, but thanks :/
Wing Commander Mod - German Topic
06.07.11 - v1.1 RELEASED!

User avatar
Aldebaran_Prime
Posts: 1127
Joined: Sat, 20. Feb 10, 18:47
x4

Post by Aldebaran_Prime » Fri, 8. Jun 18, 00:28

X2-Illuminatus wrote:...
What could prove difficult is when the spaceflies were created in sector null. Some scripts use this area to create objects in a safe place, before they are used later, or to read their properties upfront for which you need the actual object. ....
do you have an example of the syntax for us? Maybe we can delete them there in the NULL device?
Image

Post Reply

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