OwenM Posted May 27, 2020 Report Share Posted May 27, 2020 Hi all I have a RAAF MRTT kC-30 Tanker sim that does all the normal tanker things like extend Hoses and extend boom. I have been playing round with capturing the LVar data (when it changes) for the hose extension and boom extension and writing the data to Offset 66C0 and 66C2 where I an read it with my Delphi app that runs my annunciator. These scripts are all in the Auto section of FSUIPC.ini I made a Lua script that I thought should work but it doesnt . There is no error message in FSUIPC log OLD_MRTTPOD = 0 OLD_MRTTBOOM = 0 while 1 do MRTTPOD = ipc.readLvar("L:MRTTPOd") MRTTBoom = ipc.readLvar("L:MRTTBoom") if MRTTPOD ~= OLD_MRTTPOD then ipc.writeSW(0X66C0, MRTTPod) OLD_MRTTPOD = MRTTPOD end if MRTTBOOM ~= OLD_MRTTBOOM then ipc.writeSW(0X66C2, MRTTBoom) OLD_MRTTBOOM = MRTTBOOM end -- DELAY ipc.sleep(100) end however if I break it down to two individual scripts as follows they both work perfectly OLD_MRTTBOOM = 0 while 1 do MRTTBoom = ipc.readLvar("L:MRTTBoom") if MRTTBoom ~= OLD_MRTTBoom then ipc.writeSW(0X66C2, MRTTBoom) OLD_MRTTBOOM = MRTTBOOM end -- DELAY ipc.sleep(100) end and the Pod script OLD_MRTTPOD = 0 while 1 do MRTTPOD = ipc.readLvar("L:MRTTPOd") if MRTTPOD ~= OLD_MRTTPOD then ipc.writeSW(0X66C0, MRTTPOD) OLD_MRTTPOD = MRTTPOD end -- DELAY ipc.sleep(100) end I thought it would be tidier to have them in one script but after hours of tinkering I have had to resort to using the two scripts. Just wondering if anyone can point out my error in the first script Thanks heaps Owen Moore Link to comment Share on other sites More sharing options...
spokes2112 Posted May 27, 2020 Report Share Posted May 27, 2020 All that code looks like you are waiting for an L:Var change, if it does, write to 0x66C0 & C2 as signed words. The following code could (not tested) replace all that by using the on "event" listeners in the lua library. The function will not do anything until a L:Var change. When logging luas, use the left side option of the logging tab "Debug/Trace Lua". (something like that) Looking at your "all in one" code the only thing I found, and is probably the reason... "MRTTBoom" is not the same variable name as "MRTTBOOM" , CaPiTaLiZaTiOn counts.. 😉 function write2offset(varname, value) if varname == "MRTTPOd" then ipc.writeSW(0X66C0, value) else ipc.writeSW(0X66C2, value) end end event.Lvar("MRTTPOd", 250, "write2offset") event.Lvar("MRTTBoom", 250, "write2offset") Roman Link to comment Share on other sites More sharing options...
OwenM Posted May 28, 2020 Author Report Share Posted May 28, 2020 Thanks Roman Your Code worked just fine and is a lot better way for sure Thanks again Owen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now