Discoveroutdoors Posted September 3, 2013 Report Posted September 3, 2013 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
Pete Dowson Posted September 3, 2013 Report Posted September 3, 2013 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 '=='Regards It would have been more precise if you had shown me the actual error message. I had to extract your code, save it as a Lua, and try loading it to find the actual line. The error message is: *** LUA Error: E:\FSX\Modules\GFMCP.lua:50: unexpected symbol near '==' In other words, Line 50, not the line 46 you quote! The line in question is therefore: else ipc.readUD("07DC") == 1 and ("07E42") == 0 then which has a meaningless statement between the else and the then, with several errors. Looks like you might have omitted an "if" and an "ipc.readUD" and inserted an extra character in "07E42" !!! And I think you've repeated this further down. I do not provide a code debugging or checking service, sorry. Please use the tools available. Once you get the syntax correct throughout, use the FSUIPC built-in tracing facilty to find execution errors (see the Logging page). Pete
Discoveroutdoors Posted September 3, 2013 Author Report Posted September 3, 2013 thanks pete of look at the code, i did not then see that in line 50, I know you do not do code checking but i just need a freash eye. thanks again johan
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