Jump to content

Mach does not decrease


Sabre10

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy & Terms of Use