Sabre10 8 Posted April 1, 2013 Share Posted April 1, 2013 I can't figure out what is wrong with Mach decrease. Below is my lua for Inc/Dec SPD and MACH, depending on the mode. Unfortunately MACH dec does not work to some reason, while SPEED dec works ok, as well as MACH inc and the rest. Any idea what's wrong here? -- SPD/MACH switch button function switchSPDMACH (joynum, button, downup) ipc.writeLvar( "L:AB_AP_SPDMACH", 1 - ipc.readLvar("L:AB_AP_SPDMACH") ) ipc.writeLvar( "L:SmallOverheadPushButtons", 1 ) end -- SPD/MACH Inc function incSPDorMACH ( joynum, button, downup ) if ipc.readLvar("L:AB_AP_SPDMACH") == 1 then local lMACH = ipc.readLvar( "L:AB_AP_Mach_Select" ) + 0.01 if lMACH > 1.0 then lMACH = 1.0 end ipc.writeLvar( "L:AB_AP_Mach_Select", lMACH ) else local lSPD = ipc.readLvar( "L:AB_AP_SPEED_Select" ) + 1 if lSPD > 340 then lSPD = 340 end ipc.writeLvar( "L:AB_AP_SPEED_Select", lSPD ) end end -- SPD/MACH IncFast function incFastSPDorMACH ( joynum, button, downup ) if ipc.readLvar("L:AB_AP_SPDMACH") == 1 then local lMACH = ipc.readLvar( "L:AB_AP_Mach_Select" ) + 0.1 if lMACH > 1.0 then lMACH = 1.0 end ipc.writeLvar( "L:AB_AP_Mach_Select", lMACH ) else local lSPD = ipc.readLvar( "L:AB_AP_SPEED_Select" ) + 10 if lSPD > 340 then lSPD = 340 end ipc.writeLvar( "L:AB_AP_SPEED_Select", lSPD ) end end -- SPD/MACH Dec function decSPDorMACH ( joynum, button, downup ) if ipc.readLvar("L:AB_AP_SMPDMACH") == 1 then local lMACH = ipc.readLvar( "L:AB_AP_Mach_Select" ) - 0.01 -- if lMACH < 0 then -- lMACH = 0 -- end ipc.writeLvar( "L:AB_AP_Mach_Select", lMACH ) else local lSPD = ipc.readLvar( "L:AB_AP_SPEED_Select" ) - 1 if lSPD < 0 then lSPD = 0 end ipc.writeLvar( "L:AB_AP_SPEED_Select", lSPD ) end end -- SPD/MACH DecFast function decFastSPDorMACH ( joynum, button, downup ) if ipc.readLvar("L:AB_AP_SMPDMACH") == 1 then local lMACH = ipc.readLvar( "L:AB_AP_Mach_Select" ) - 0.1 -- if lMACH < 0 then -- lMACH = 0 -- end ipc.writeLvar( "L:AB_AP_Mach_Select", lMACH ) else local lSPD = ipc.readLvar( "L:AB_AP_SPEED_Select" ) - 10 if lSPD < 0 then lSPD = 0 end ipc.writeLvar( "L:AB_AP_SPEED_Select", lSPD ) end end Thanks, Sabre10. Link to comment Share on other sites More sharing options...
Aerosoft Aerosoft Team [Inactive Account] 51558 Posted April 5, 2013 Aerosoft Share Posted April 5, 2013 I have asked the tester who helped us with LUA to take a look at this. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.