Joined: 09 Mar 2016
|Posted: Thu Dec 01, 2016 9:56 pm Post subject: Radar Contact
|Here is the scenario.
I am running WideView for my 3 pc/views each with a copy of Prepar3D and FSUIPC (only the master has WideServer enabled). I want to run Radar Contact on my left view pc to spread the load.
I installed RC on the left computer which has a copy of FSUIPC runing (WideServer disabled)
Radar contact runs okay but gets stuck when I have to tune to a com frequency as requested by RC (I have auto tune option off in RC).
I change the frequency on my FDS com1 radio but nothing happens as far as RC is concerned.
I believe this is because the left hand screen computer does not get that frequency (only the master center screen pc).
After some research I found a pair of LUA scripts designed to write the radio offset frequencies from the "master" copy of Prepar3D/FSUIPC to a file that can then be read by a slave copy of Prepar3d/FSUIPC.
This is the LUA script that writes to a file
-- lua plugin to write updated COM/NAV frequencies and other data to local data.txt file at SERVER
-- this plugin to be located in the SERVER FSX\Modules folder
-- add this lua to the [Auto] section of the SERVER FSUIPC
function processdata(offset, value)
COM1freq = ipc.readUW(0x034E)
COM2freq = ipc.readUW(0x3118)
NAV1freq = ipc.readUW(0x0350)
NAV2freq = ipc.readUW(0x0352)
-- code string, just numbers in order with non-number separators
local value = string.format("COMone=" .. COM1freq .. ",COMtwo=" .. COM2freq .. ",NAVone=" .. NAV1freq .. ",NAVtwo=" .. NAV2freq)
file = io.open("data.txt","w")
event.offset(0x034E, "UW", "processdata")
event.offset(0x3118, "UW", "processdata")
event.offset(0x0350, "UW", "processdata")
event.offset(0x0352, "UW", "processdata")
and this is the script that reads from the file into the offsets on the slave screen pc
-- lua plugin to copy NAV/COM frequencies and other data from data.txt file in Server FSX\Modules to local FSUIPC offsets
-- this plugin to be located in the CLIENT FSX\Modules folder, and is run automatically on a 500 mSec interval (can be changed)
-- add this lua to the [Auto] section of the CLIENT FSUIPC
file = io.open("\\PREPAR3DCENTER\LockheedMartin\Prepar3D v3\Modules\data.txt","r")
value = file:read()
-- decode string, just numbers in order with non-number separators
w = string.gmatch(value, "[+-]?[0-9%.?]+")
COM1freq = w()
COM2freq = w()
NAV1freq = w()
NAV2freq = w()
The write script is working as its creating the data.txt file. However, the frequencies written to it do not reflect what I have input into the FDS radios and I cannot figure out why - Any ideas welcome.
Once I get the correct frequencies written to the data.txt file I can move onto testing the receive LUA script. I am not sure that I have got this line correct in the receive LUA script.
|file = io.open("\\PREPAR3DCENTER\LockheedMartin\Prepar3D v3\Modules\data.txt","r")
in terms of the correct syntax for the master file location (the machine name is PREPAR3DCENTER - If someone could advise.
Once all the above is working I can then see if it solves the Radar Contact problem.
Off course there may be an easier way and again I am open to suggestions.
Once again thanks for any help.