[SCR] Replication v1.0.0 (21-03-14)
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
SUCCESS! Er, oh dear. I took your advice and manually typed in the required lines (on a fresh version of the file I hadn't edited with Notepad ++). This saved properly with no error messages. The only problem is that when I loaded a save I found that I couldn't now Replicate ANY missiles at all - only satellites and drones!
Progress
To debug, insert some logging into Get.Missiles as follows. It'll output to 'Documents\Egosoft\X3AP\log01234.txt'.
a. If no logging appears check that Get.Missiles is being called
b. If no missiles are found, check the logic of Get.Missiles
c. If missiles are found, check that the calling logic is assigning $Unsorted = $Missiles.
To debug, insert some logging into Get.Missiles as follows. It'll output to 'Documents\Egosoft\X3AP\log01234.txt'.
a. If no logging appears check that Get.Missiles is being called
b. If no missiles are found, check the logic of Get.Missiles
c. If missiles are found, check that the calling logic is assigning $Unsorted = $Missiles.
Code: Select all
Get.Missiles:
$Missiles = array alloc: size = 0
$idx = get number of subtypes of maintype 10
write to log file 1234 append=0 printf: fmt='Found %s missiles', $idx, null, null, null, null
while $idx
dec $idx
$Missile = get ware from maintype 10 and subtype $idx
write to log file 1234 append=1 printf: fmt='Missile=%s', $Missile, null, null, null, null
append $Missile to array $Missiles
end
write to log file 1234 append=1 printf: fmt='Missiles=%s', $Missiles, null, null, null, null
endsub
I pasted that same Get.Missiles code and it finds them for me, how bizarre.
The found 'null' missiles might be a clue though, as null tends to mean its either uninitialized or is returned as a fallback when doing dodgy operations (5 + null = null). I'd be suspicious of that $idx assignment.
In case you're wondering where the magic number of 10 comes from, maintypes are like ware categories and 10 is the category for missiles:
http://forum.egosoft.com/viewtopic.php?t=292613
Btw I noticed when pasting from the forum's code block that it adds a trailing space to every line, and this seems to be what caused the compile error in X-Studio. Trimming off the space makes it work.
As a last resort you could hardcode them:
You can use X-Studio's Game Objects tab on the right to filter down to a list of missiles then double-click them to insert the appropriate token for that missile into the code window at the cursor.
The found 'null' missiles might be a clue though, as null tends to mean its either uninitialized or is returned as a fallback when doing dodgy operations (5 + null = null). I'd be suspicious of that $idx assignment.
In case you're wondering where the magic number of 10 comes from, maintypes are like ware categories and 10 is the category for missiles:
http://forum.egosoft.com/viewtopic.php?t=292613
Btw I noticed when pasting from the forum's code block that it adds a trailing space to every line, and this seems to be what caused the compile error in X-Studio. Trimming off the space makes it work.
Code: Select all
Found 49 missiles
Missile=Pirate Dummy Missile
...
Missile=Mosquito Missile
Missiles=ARRAY ( Pirate Dummy Missile, Teladi Dummy Missile, Split Dummy Missile, Paranid Dummy Missile, Boron Dummy Missile, Argon Dummy Missile, Gibson Barrage Missile, Heinlein Heavy Torpedo, ... )
Code: Select all
Get.Missiles:
$Missiles = array alloc: size = 0
append {Mosquito Missile} to array $Missiles
...
endsub
I haven't tried LU yet. If it bundles the extended EMP (EMP-X) ware entries then it should work right away. Alternatively if X plugin manager can be used with LU, then it I believe this installs EMP-X.
Replication adds the following message to the player logbook at game load if it can't find the ware slot it needs.
Replication adds the following message to the player logbook at game load if it can't find the ware slot it needs.
Code: Select all
Replication: Cannot find Replicator ware. Note that this script depends on EMP
- jack775544
- Posts: 1277
- Joined: Tue, 13. Dec 11, 08:27
LU doesn't have EMP installed by default and it is incompatible with the plugin manager making installing it a big pain in the ass. And even then there is no guarantees since Litcube has made so many changes.
1940s - Various "computers" are "programmed" using direct wiring and switches. Engineers do this in order to avoid the tabs vs spaces debate.