hi Pete and all how maybe able to help
i have found and modified Goflight pro MCP Lua script but I have hit wall with IAS/MACH Crossover. It is falling over in the IAS/MACH section stringSPD = string.format("%03d", SPD) saying unexpected symbol near '=='
is the a better why to write this section, if how can i fix it.
prevCRS1 = -1
prevSPD = -1
prevHDG = -1
prevalt = -1
prevVS = -1
prevCRS2 = -1
prevMACH = -1
--************************All Working*************************************************
while 1 do
CRS1 = ipc.readSW("0C4E")
if (CRS1 ~= prevCRS1) then
stringCRS1 = string.format("%03d", CRS1)
gfd.setDisplay(GFMCPPRO,0,0,stringCRS1)
prevCRS1 = CRS1
end
HDG = ipc.readSD("07CC")
if (HDG ~= prevHDG) then
stringHDG = string.format("%03d", ((HDG/65536)*360))
gfd.setDisplay(GFMCPPRO,0,2,stringHDG)
prevHDG = HDG
end
alt = ipc.readSD("07D4")
if (alt ~= prevalt) then
stringalt = string.format("%05d", ((alt/65536)*3.2809))
gfd.setDisplay(GFMCPPRO,0,3,stringalt)
prevalt = alt
end
VS = ipc.readSW("07F2")
if (VS ~= prevVS) then
stringalt = string.format("%05d", VS)
gfd.setDisplay(GFMCPPRO,0,4,stringalt)
prevVS = VS
end
CRS2 = ipc.readSW("0C5E")
if (CRS2 ~= prevCRS2) then
stringCRS2 = string.format("%03d", CRS2)
gfd.setDisplay(GFMCPPRO,0,5,stringCRS2)
prevCRS2 = CRS2
end
--*******************************************************************************************************
--*******************IAS/MACH Crossover NEED Help!!!!!!!!!!!!!****************************************
if ipc.readUD("07DC" and "07E4") == 0 then
SPD = ipc.readSW("07E2")
if (SPD ~= prevSPD) then
stringSPD = string.format("%03d", SPD)
gfd.SetDisplay(GFMCPPRO,0,1,stringSPD)
prevSPD = SPD
end
else ipc.readUD("07DC") == 1 and ("07E42") == 0 then
SPD = ipc.readSW("07E2")
if (SPD ~= prevSPD) then
stringSPD = string.format("%03d", SPD)
gfd.SetDisplay(GFMCPPRO,0,1,stringSPD)
prevSPD = SPD
end
else ipc.readUD("07DC") == 0 and ("07E42") == 1 then
MACH = ipc.readSD("07E8")
if (MACH ~= prevMACH) then
stringMACH = string.format ("%02f", MACH/65536)
gfd.SetDisplay(GFMCPPRO,0,1,stringMACH)
prevMACH = MACH
end
--**********************************************************************************************
ipc.sleep(200)
end
Thanks
Johan