I looked around and found a couple stock scripts that restart themselves on version change:Aldebaran_Prime wrote:But if somebody has some code snipplets for me to do it right, I will try it again.
!job.special.tpliners
!station.shieldstock.terran
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Yes, I recognized this effect, too. But just the actual savegame isn't shown anymoreSirNukes wrote:...
However, the list of save games got messed up somehow and appears to be listing the directory contents from when I made the save months ago, so something weird got messed up.
I got between 5 an 10 FPS more, if I deleted 12.000 SpaceflysSirNukes wrote:...
Other bad news is that I didn't notice any notable framerate boost after the spacefly deaths...
yes, the side effect, that the current savegane isn't shown anymore is strange - I' m curious, if you'll find something. In the meantime I'll try the correct script-update/restart mechanismSirNukes wrote:...
Maybe it is unsafe to call destruct on [THIS] in a script? At any rate, I can play around a bit more and see if a solution works without side effects.
This motivated me to recheck, this time measuring practical SETA speedup (game minutes passed during a couple real minutes).Aldebaran_Prime wrote: I got between 5 an 10 FPS more, if I deleted 12.000 Spaceflys
Generally anything after the destruct command will be ignored, the script editor does automatically add return statements at the end though, so all scripts have a return, even if they never get to itSirNukes wrote: There are vanilla scripts that call "[THIS]->destruct:..." followed by a return, for what that's worth. Maybe I need to look into where the saved game list is built to get an idea of what is going on.
Code: Select all
$this.sector = [THIS]-> get sector
$player.sector = [PLAYERSHIP]-> get sector
if $this.sector != $player.sector
return null
end
$sectorID = [PLAYERSHIP]-> get SectorObject ID
$flies = array alloc: size=0
while [TRUE]
dec $sectorID
$object = get object from SectorObject $sectorID
$class = $object-> get object class
* Break out of the loop if you encounter an existng object that is NOT a Space Fly
if $object != null AND $class != [Raumfliege]
break
end
if $object-> exists
append $object to array $flies
end
end
$size = size of array $flies
* Return null if no flies where found.
if $size == 0
return null
end
return $flies
This is spot on, except that the mods do not exactly forget to clean up. They destroy the single spacefly they meant to create, but not the unexpected extra swarm.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. 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.
Very good, that you find a potential reason for the mess of spaceflys!SirNukes wrote:...
In short, the fundamental problem is either bad documentation or bad behavior of the "create ship" command (depending on which angle you look at it). When a spacefly is requested, the script engine redirects from Create to CreateSwarm, so a whole flock of spaceflies are created and their scripts started. The documentation doesn't mention this, and modders do not expect this behavior.
... They destroy the single spacefly they meant to create, but not the unexpected extra swarm.
....
Code: Select all
...
$WareSubType = get number of subtypes of maintype 7
while $WareSubType
dec $WareSubType
$cShipWare = get ware from maintype 7 and subtype $WareSubType
gosub CheckType:
if $EvalRet == [FALSE]
continue
end
$SpawnedShip = create ship: type=$cShipWare owner=[Unbekannt] addto=null x=0 y=0 z=0
...
Code: Select all
CheckType:
$EvalRet = [FALSE]
$eval = $cShipWare
if $eval == {Argonen Truelight Seeker}
endsub
else if $eval == {Terraner #deca.deaf}
endsub
else if $eval == {Terraner #deca.cefa}
endsub
Code: Select all
else if $eval == {Unbekannt Raumfliegen}
endsub
my guess on this is that SCS is an older script, and was probably made before the command to check a types class was added.SirNukes wrote: SCS, on the other hand, appears to think the ship has to be made first to be able to check its class, and so ends up making everything, spaceflies included. It does do some name checks for filtering out unwanted ships, so spaceflies could be added there. Though, now that I look at it, that name check (eg. "$tmp = find position of pattern 'Beacon' in $shp") wouldn't work on non-English versions, would it?