Have TrackIR running before you run the script in FreePIE.
In vJoy I have two devices. vJoy[1] is referring to device 2. To use vJoy device 1, change the code to vJoy[0].
You can add devices using the “Configure vJoy” application.
If you are not using vJoy for your physical joystick then you will probably only need the one virtual joystick.
To check its working run the Windows Game Controllers app. “Set up USB Game Controllers” in the start menu.
Select vJoy Device in the list and click Properties.
You should see the axes move in response to the TrackIR input.
Also, as per my comment above about the in-game head movement being limited, you should change the script from 16382 / 180
to 16382 / 90
to get the correct movement.
Once you’ve confirmed it’s working using the Windows Game Controllers UI, to setup Battlescape:
Launch DetectInput.exe from Program Files\I-Novae Studios\Battlescape\Dev\Profiles\Detect Input Tool
as an Administrator and use it to detect what the game will detect the axes as. Then set them in your input profile XML.
Weirdly the game detects the x and y axis of my second vJoy device as button60 and button61 rather than axis0 and axis1 like my first vJoy device, but meh - I just map them like this:
<Input Event="SetViewYaw" Keys="joystick1button60" Type="AxisX" GroupID="4"/>
<Input Event="SetViewPitch" Keys="joystick1button61" Type="AxisY" GroupID="4"/>
Let me know how you get on.