Jump to content
Sign in to follow this  
guenseli

reworked PMDG J41 LUA Script

Recommended Posts

Updates...1. MCP display indication added for:- Baro setting, - Brg1/2 current mode, - decision height set (updated), - current mode for each of dual-mode knobs. 2. Little bug with VS indication fixed.DownloadIt's a shame that we cannot fully control the MCP display, only the small part of it... Seems it's time to open my own developement journal. :-)


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

Thanks all of you for all the hard work (and brain power) with these lua's. Right know, the JS41 is the only plane I fly. Cant go back to anything else. Couple of questions,The download link in the previous post does not appear to be working?Also, I have a strange result when using the latest knobs lua.Turning the Insight mcp alt knob does not change the altitude on the screen but, if I change the altitude via the alt knob with my mouse on the js41 vc, the first time I move the alt knob on the insight mcp, the alt will update with what is on the screen.The other luas before this seemed to work in both directions, only the version v1.1b 18 apr. 2011 seems to not work.Can someone nudge me in the right direction?Thanks

Share this post


Link to post

lancealotg, there will be a major update about this script soon. It's gonna be a totaly new version with much more functionality. We are working on it now, but it will take some more time before release. Meanwhile try to look into fsuipc.log -- there could be some error messages about ALT knob function. This could help to understand what's going wrong.


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

Thanks for all the hard work you guys have done for this.But, I can't get my script working.What I've done:1. created a new LUA file called J41Script.lua and placed it in my FSX/modules folder2. selected buttons+switches from my registered FSUIPC, chose a button on my Saitek throttle quadrant (I couldn't get FSUIPC to recognize CH Yoke keypresses at all for some reason)3. checked the box next to "Select for FS Control"4. chose BOTH Lua J41Script AND LuaValue J41script (I tried one then the other)5. set a parameter of 170 to test "Seatbelt On"6. pressed the button on my throttle....seatbelt switch didn't moveI tested 3 other parameters before I gave up on buttons+switches.I then tested keypresses in FSUIPC. Tried both Lua and LuaValue...nothing.What am I doing wrong?

Share this post


Link to post
Thanks for all the hard work you guys have done for this.But, I can't get my script working.What I've done:1. created a new LUA file called J41Script.lua and placed it in my FSX/modules folder2. selected buttons+switches from my registered FSUIPC, chose a button on my Saitek throttle quadrant (I couldn't get FSUIPC to recognize CH Yoke keypresses at all for some reason)3. checked the box next to "Select for FS Control"4. chose BOTH Lua J41Script AND LuaValue J41script (I tried one then the other)5. set a parameter of 170 to test "Seatbelt On"6. pressed the button on my throttle....seatbelt switch didn't moveI tested 3 other parameters before I gave up on buttons+switches.I then tested keypresses in FSUIPC. Tried both Lua and LuaValue...nothing.What am I doing wrong?
It seems you should use "Lua J41script " action in FSUIPC not the "LuaValue J41script""LuaValue" is used only in my script for MCP rotaries. Guenter's original script should be used with "Lua" command.And you should use the script from the first page of this thread, not the latest ones from my posts (they are for VRI MCP, not for joysticks).

Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

I already tried Lua J41Script. When that didn't work I tried LuaValue J41Script.And I am using the original script from the first post.

Share this post


Link to post
I already tried Lua J41Script. When that didn't work I tried LuaValue J41Script.And I am using the original script from the first post.
Everything should work then. Check the fsuipc.log for LUA errors.May be the problem is that script tries to connect to VRI device. There are two parts of code about it. One at the top of script:
--------------------------------------------------------------------------------- you should delete this part BELOW the lines if you don't use a VRInsight device-------------------------------------------------------------------------------if VRImodel == nil then  VRIdevice = "COM3"   VRIdriver = "COM2"endspeed = 115200 handshake = 0  minsize = 8maxsize = 8 	dev = com.open(VRIdevice, speed, handshake)if dev == 0 then   ipc.log("Could not open VRIdevice port")        ipc.display("Could not open VRIdevice port")        ipc.sleep(1000)end--------------------------------------------------------------------------------- you should delete this part ABOVE the lines if you don't use a VRInsight device-------------------------------------------------------------------------------

And another at the bottom:

--------------------------------------------------------------------------------- you can delete this part below the lines if you don't use a VRInsight device--------------------------------------------------------------------------------------------------------------------                buffer = ipc.readLvar("L:AltSelAlt")/100                if buffer <= 0 then                buffer = 0                end                com.write(dev, string.format("ALT%03d", buffer), 8)-------------------------------------                buffer = ipc.readLvar("L:HDGBug")                com.write(dev, string.format("HDG%03d", buffer), 8)-- ipc.display(ipc.readLvar("L:AltSelAlt"))-- ipc.sleep(1000)

Try to delete both - may be it will help.


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

I had already deleted those sections as well.I'll check the log tomorrow.

Share this post


Link to post

Okay, here's what my FSUIPC log said:

2514767 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'  2516233 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'  2521023 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'  2580740 Sim stopped: average frame rate for last 81 secs = 35.2 fps  2688927 Sim stopped: average frame rate for last 106 secs = 40.7 fps  2704152 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'  2705166 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'  2705432 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'  2705775 *** LUA Error: ...(x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\J41Script.lua:170: '<eof>' expected near 'elseif'

And this is what is in my J41Script.lua: (I added the zoom in/out functions for parameters 205 and 206...I understand those zoom my LNAV map display in and out?)

-- LUA Script for the PMDG J41-- January, the 4th 2011-- made by Guenter (Guenseli) Steiner-- file is free for use; credits are always welcome-- thanks to Word Not Allowed and some other guys... of course Pete Dowson-- 9 ALT sel-- 10 ALT plus-- 11 ALT plus fast-- 12 ALT minus-- 13 ALT minus fast-- 14 ALT hold---- 15 HDG inc-- 16 HDG inc fast-- 17 HDG dec-- 18 HDG dec fast-- 19 HDG-- 20 HDG bug press---- 25 VS inc-- 26 VS dec---- 30 CRS left press---- 35 IAS Press-- 36 IAS plus-- 37 IAS plus fast-- 38 IAS minus-- 39 IAS minus fast---- 50 NAV-- 51 APR-- 52 VS-- 53 BC-- 54 IAS-- 55 STBY---- 56 AP Trim Power Switch on-- 57 AP Trim Power Switch off-- 58 AP Master-- 59 AP Master off---- 70 LEFT Bearing CIRCLE Knob Minus-- 71 LEFT Bearing CIRCLE Knob plus-- 72 LEFT Bearing DIAMOND Knob Minus-- 73 LEFT Bearing DIAMOND Knob plus---- 75 EFIS FULL/Map-- 76 EFIS TCAS-- 77 EFIS GSPD/TTG-- 78 EFIS ET-- 79 EFIS V/L-- 80 EFIS LNAV---- 90 Pilot analog ADFVOR 1 Toggle-- 91 Pilot analog ADFVOR 2 Toggle-- 92 Pilot ADF1-- 93 Pilot VOR1-- 94 Pilot ADF2-- 95 Pilot VOR2---- 100 Panel flood light on-- 101 Panel flood light off-- 102 Panel flood light toggle---- 103 Console lights ON-- 104 Console lights Off-- 105 Console lights toggle---- 106 flightdeck flood light toggle-- 107 BCN light toggle---- 108 NAV Lights ON-- 109 NAV Lights Off-- 110 NAV Lights toggle---- 111 STR light toggle-- 112 Landing lights toggle-- 113 Taxi light toggle---- 114 Consp Lights ON-- 115 Consp Lights Off-- 116 Consp Lights toggle---- 120 LEFT Battery switch TOGGLE-- 121 RIGHT Battery switch TOGGLE-- 122 BOTH Battery switch ON-- 123 BOTH Battery switch OFF---- 125 Left AVIONICS SWITCh TOGGLE-- 126 Right AVIONICS SWITCh TOGGLE-- 127 both AVIONICS SWITCh on-- 128 both AVIONICS SWITCh off---- 130 LEFT Generator SWITCH TOGGLE-- 131 RIGHT Generator SWITCH TOGGLE-- 132 LEFT Generator SWITCH on-- 133 LEFT Generator SWITCH off-- 134 RIGHT Generator SWITCH on-- 135 RIGHT Generator SWITCH off---- 136 Left fuel Pump on-- 137 Left fuel Pump off-- 138 Right fuel Pump on-- 139 Right fuel Pump off---- 140 Prop Sync Toggle---- 145 Ground Spoiler switch on-- 146 Ground Spoiler switch off-- 147 Ground Spoiler switch toggle---- 150 windshield deice on-- 151 windshield deice off-- 152 airdata deice on-- 153 airdata deice off-- 155 Prop deice short on-- 156 Prop deice short off-- 157 Prop deice long on-- 158 CCT Auto Cycle Switch---- 160 warning mute switch toggle---- 165 TOCW test switch on-- 166 TOCW test switch off---- 170 Seatbelt on-- 171 Seatbelt on---- 172 no smoking on-- 173 no smoking on---- 176 engine 1 feather (LEFT)-- 177 no engine feather-- 178 engine 2 feather (RIGHT)---- 180 select engine 1 (LEFT)-- 181 select engine 2 (RIGHT)-- 182 unselect engines---- 185 Feathering and starting selected engine-- 186 abort starting sequence (stop) for selected engine-- 187 starting selected engine---- 190 gust locks toggle-- 195 APU (ground power) connection toggle-- 198 yellow attention get switch-- 200 Anti-Skid on-- 201 Anti Skid off-- 202 Anti Skid toggle--ipc.display("test start")--ipc.sleep(100)--ipc.display("VRIdevice COM".. VRIdevice.. "\nVRIdriver COM".. VRIdriver.. "\nipcPARAM".. ipcPARAM)--ipc.sleep(1000)--  zoom outelseif ipcPARAM == 205 then                ipc.control(66587,4930)                ipc.control(66587,8031)--  zoom inelseif ipcPARAM == 206 then                ipc.control(66587,4940)                ipc.control(66587,8031)------------------------------------------------------------AP ALT-- ALT selif ipcPARAM == 9 then                ipc.writeLvar("L:FdModeselAltselSwitch", 1)                ipc.control(66587,282)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselAltselSwitch", 0)                ipc.control(66587,8031)-- ALT pluselseif ipcPARAM == 10 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var >= 100 then                 Var = 1                end                ipc.writeLvar("IrcAltSelKnob", Var+1)                ipc.control(66587,3921)                                ipc.control(66587,8031)                ipc.sleep(40)-- ALT plus fastelseif ipcPARAM == 11 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var >= 100 then                 Var = 1                end                ipc.writeLvar("IrcAltSelKnob", Var+5)                for n=1, 10, 1 do                ipc.control(66587,3921)                end                ipc.control(66587,8031)                ipc.sleep(40)-- ALT minuselseif ipcPARAM == 12 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var <= 1 then                 Var = 100                end                ipc.writeLvar("IrcAltSelKnob", Var-1)                ipc.control(66587,3920)                ipc.control(66587,8031)                ipc.sleep(40)-- ALT minus fastelseif ipcPARAM == 13 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var <= 1 then                 Var = 100                end                ipc.writeLvar("IrcAltSelKnob", Var-5)                                for n=1, 10, 1 do                ipc.control(66587,3920)                end                ipc.control(66587,8031)                ipc.sleep(40)-- ALT holdelseif ipcPARAM == 14 then                ipc.writeLvar("L:FdModeselAltSwitch", 1)                ipc.control(66587,281)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselAltSwitch", 0)                ipc.control(66587,8031)------------------------------------------------------------AP HDG-- HDG pluselseif ipcPARAM == 15 then                ipc.control(66587,26902)                                ipc.control(66587,8031)                ipc.sleep(50)-- HDG plus fastelseif ipcPARAM == 16 then                for n=1, 10, 1 do                ipc.control(66587,26902)                end                ipc.control(66587,8031)                ipc.sleep(50)-- HDG minuselseif ipcPARAM == 17 then                ipc.control(66587,26901)                                ipc.control(66587,8031)                ipc.sleep(50)-- HDG minus fastelseif ipcPARAM == 18 then                for n=1, 10, 1 do                ipc.control(66587,26901)                end                ipc.control(66587,8031)                ipc.sleep(50)-- HDG elseif ipcPARAM == 19 then                ipc.writeLvar("L:FdModeselHdgSwitch", 1)                ipc.control(66587,277)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselHdgSwitch", 0)                ipc.control(66587,8031)-- HDG bug presselseif ipcPARAM == 20 then                ipc.writeLvar("L:IrcHdgKnobPush", 1)                            ipc.control(66587,2691)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:IrcHdgKnobPush", 0)                ipc.control(66587,8031)-------------------------------------------------------------- VS incelseif ipcPARAM == 25 then                buffer = ipc.readLvar("L:VSIASTarget")                                Var = ipc.readLvar("L:AP_PitchWheel")                                ipc.writeLvar("AP_PitchWheel", Var+10)                ipc.writeLvar("L:VSIASTarget", buffer+100)                ipc.control(65894)                ipc.control(66587,8031)                ipc.sleep(40)                buffer = ipc.readLvar("L:VSIASTarget")                com.write(dev, string.format("DSP_%04d", buffer), 8)-- VS decelseif ipcPARAM == 26 then                buffer = ipc.readLvar("L:VSIASTarget")                                Var = ipc.readLvar("L:AP_PitchWheel")                                ipc.writeLvar("AP_PitchWheel", Var-10)                ipc.writeLvar("L:VSIASTarget", buffer-100)                ipc.control(65895)                ipc.control(66587,8031)                ipc.sleep(40)                buffer = ipc.readLvar("L:VSIASTarget")                com.write(dev, string.format("DSP_%04d", buffer), 8)-- CRS presselseif ipcPARAM == 30 then                ipc.writeLvar("L:LeftIrcCrsKnobPush", 1)                ipc.control(66587,2671)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:LeftIrcCrsKnobPush", 0)                ipc.control(66587,8031)-- IAS knob presselseif ipcPARAM == 35 then                ipc.writeLvar("L:IrcIasKnobPush", 1)                ipc.control(66587,2681)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:IrcIasKnobPush", 0)                ipc.control(66587,8031)-- IAS plus elseif ipcPARAM == 36 then                ipc.control(66587,26802)                ipc.control(66587,8031)-- IAS plus fastelseif ipcPARAM == 37 then                for n=1, 10, 1 do                ipc.control(66587,26802)                end                ipc.control(66587,8031)                -- IAS minuselseif ipcPARAM == 38 then                ipc.control(66587,26801)                ipc.control(66587,8031)-- IAS minus fastelseif ipcPARAM == 39 then                for n=1, 10, 1 do                ipc.control(66587,26801)                end                ipc.control(66587,8031)------------------------------------------------------------ AP Mode select-- NAV elseif ipcPARAM == 50 then                ipc.writeLvar("L:FdModeselNavSwitch", 1)                ipc.control(66587,278)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselNavSwitch", 0)                ipc.control(66587,8031)-- APRelseif ipcPARAM == 51 then                ipc.writeLvar("L:FdModeselAprSwitch", 1)                ipc.control(66587,279)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselAprSwitch", 0)                ipc.control(66587,8031)-- VSelseif ipcPARAM == 52 then                ipc.writeLvar("L:FdModeselVsSwitch", 1)                ipc.control(66587,283)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselVsSwitch", 0)                ipc.control(66587,8031)-- BCelseif ipcPARAM == 53 then                ipc.writeLvar("L:FdModeselBcSwitch", 1)                ipc.control(66587,280)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselBcSwitch", 0)                ipc.control(66587,8031)-- IASelseif ipcPARAM == 54 then                ipc.writeLvar("L:FdModeselIasSwitch", 1)                ipc.control(66587,284)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselIasSwitch", 0)                ipc.control(66587,8031)-- STBYelseif ipcPARAM == 55 then                ipc.writeLvar("L:FdModeselSbySwitch", 1)                ipc.control(66587,2851)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselSbySwitch", 0)                ipc.control(66587,2850)                ipc.control(66587,8031)-- AP Trim Power Switch onelseif ipcPARAM == 56 then                ipc.writeLvar("L:ApTrimPowerSwitch", 1)                ipc.control(66587,8034)-- AP Trim Power Switch offelseif ipcPARAM == 57 then                ipc.writeLvar("L:ApTrimPowerSwitch", 0)                ipc.control(66587,8034)-- AP Masterelseif ipcPARAM == 58 then                ipc.writeLvar("L:APEngageSwitchSelect", 1)                ipc.control(65580)                ipc.control(66587,8038)                ipc.sleep(200)                ipc.writeLvar("L:APEngageSwitchSelect", 0)                ipc.control(66587,8038)-- AP Master offelseif ipcPARAM == 59 then                ipc.writeLvar("L:APEngageSwitchSelect", 1)                ipc.control(65791)                ipc.control(66587,8038)                ipc.sleep(200)                ipc.writeLvar("L:APEngageSwitchSelect", 0)                ipc.control(66587,8038)------------------------------------------------------------ EFIS BRG1 and BRG2-- LEFT Bearing CIRCLE Knob Minuselseif ipcPARAM == 70 then        i = ipc.readLvar("L:LeftBearingCircleKnob")                if i < 3 then        ipc.writeLvar("L:LeftBearingCircleKnob", i+1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 3 then        ipc.writeLvar("L:LeftBearingCircleKnob", 3)        end        -- LEFT Bearing CIRLCE Knob Pluselseif ipcPARAM == 71 then        i = ipc.readLvar("L:LeftBearingCircleKnob")                if i > 0 then        ipc.writeLvar("L:LeftBearingCircleKnob", i-1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 0 then        ipc.writeLvar("L:LeftBearingCircleKnob", 0)        end-- LEFT Bearing DIAMOND Knob Minuselseif ipcPARAM == 72 then        i = ipc.readLvar("L:LeftBearingDiamondKnob")                if i > 0 then        ipc.writeLvar("L:LeftBearingDiamondKnob", i-1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 0 then        ipc.writeLvar("L:LeftBearingDiamondKnob", 0)        end     -- LEFT Bearing DIAMOND Knob Pluselseif ipcPARAM == 73 then        i = ipc.readLvar("L:LeftBearingDiamondKnob")                if i < 3 then        ipc.writeLvar("L:LeftBearingDiamondKnob", i+1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 3 then        ipc.writeLvar("L:LeftBearingDiamondKnob", 3)        end------------------------------------------------------------ EFIS-- Full/Map elseif ipcPARAM == 75 then                ipc.control(66587,214)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- TCAS elseif ipcPARAM == 76 then                ipc.control(66587,215)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- GSPD/TTG elseif ipcPARAM == 77 then                ipc.control(66587,217)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- ETelseif ipcPARAM == 78 then                ipc.control(66587,218)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- V/L elseif ipcPARAM == 79 then                ipc.control(66587,21901)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- LNAV elseif ipcPARAM == 80 then                ipc.control(66587,21910)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)------------------------------------------------------------ Pilot analog VOR/ADF-- Pilot analog ADFVOR 1 Toggleelseif ipcPARAM == 90 then           LVarSet = "L:LeftAdfVorSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8024)-- Pilot analog ADFVOR 2 Toggleelseif ipcPARAM == 91 then        LVarSet = "L:LeftVorAdfSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8024)        -- Pilot ADF1 elseif ipcPARAM == 92 then        ipc.writeLvar("L:LeftAdfVorSwitch", 0)        ipc.control(66587, 8024)-- Pilot VOR1elseif ipcPARAM == 93 then        ipc.writeLvar("L:LeftAdfVorSwitch", 1)        ipc.control(66587, 8024)-- Pilot ADF2elseif ipcPARAM == 94 then        ipc.writeLvar("L:LeftVorAdfSwitch", 1)        ipc.control(66587, 8024)-- Pilot VOR2elseif ipcPARAM == 95 then        ipc.writeLvar("L:LeftVorAdfSwitch", 0)        ipc.control(66587, 8024)------------------------------------------------------------ Lights-- Panel flood light onelseif ipcPARAM == 100 then        ipc.writeLvar("L:PanelFloodSW", 1)        ipc.control(66587, 8029)-- Panel flood light offelseif ipcPARAM == 101 then        ipc.writeLvar("L:PanelFloodSW", 0)        ipc.control(66587, 8029)-- Panel flood light toggleelseif ipcPARAM == 102 then        LVarSet = "L:PanelFloodSW"        val = 0        if ipc.readLvar(LVarSet) == 0 then        val = 1                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8029)------------------------------------------------ Console lights ONelseif ipcPARAM == 103 then        ipc.control(66056)        ipc.writeLvar("L:InstrConsolesLightSwitch", 1)        ipc.writeLvar("L:InstrRoofLightSwitch", 1)        ipc.writeLvar("L:InstrGlareshieldLightSwitch", 1)        ipc.control(66587, 8031)-- Console lights OFFelseif ipcPARAM == 104 then        ipc.control(66057)        ipc.writeLvar("L:InstrConsolesLightSwitch", 0)        ipc.writeLvar("L:InstrRoofLightSwitch", 0)        ipc.writeLvar("L:InstrGlareshieldLightSwitch", 0)        ipc.control(66587, 8031)-- Console lights toggleelseif ipcPARAM == 105 then        val = 0        val2 = 66057        if ipc.readLvar("L:InstrConsolesLightSwitch") == 0 then        val = 1        val2 = 66056                end        ipc.control(val2)        ipc.writeLvar("L:InstrConsolesLightSwitch", val)        ipc.writeLvar("L:InstrRoofLightSwitch", val)        ipc.writeLvar("L:InstrGlareshieldLightSwitch", val)        ipc.control(66587, 8031)-- flightdeck flood light toggleelseif ipcPARAM == 106 then        ipc.control(66376)        ipc.control(66587,8027)-- BCN light toggleelseif ipcPARAM == 107 then        ipc.control(66239)        ipc.control(66587,8027)-- NAV Lights ONelseif ipcPARAM == 108 then                ipc.writeLvar("L:NavLightSwitch", 2)        ipc.control(66587, 8028)-- NAV Lights Offelseif ipcPARAM == 109 then                ipc.writeLvar("L:NavLightSwitch", 1)        ipc.control(66587, 8027)-- NAV light toggleelseif ipcPARAM == 110 then        LVarSet = "L:NavLightSwitch"        val = 1        val2 = 8027        if ipc.readLvar(LVarSet) == 1 then        val = 2        val2 = 8028                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, val2)-- STR light toggleelseif ipcPARAM == 111 then        ipc.control(65560)        ipc.control(66587,8028)-- Landing lights toggleelseif ipcPARAM == 112 then        ipc.control(65751)        ipc.control(66587,8027)-- Taxi light toggleelseif ipcPARAM == 113 then        ipc.control(66240)        ipc.control(66587,8028)-- Consp Lights ONelseif ipcPARAM == 114 then                ipc.writeLvar("L:ConspicLight", 1)        ipc.control(66587, 8028)        ipc.control(66377)-- Consp Lights Offelseif ipcPARAM == 115 then                ipc.writeLvar("L:ConspicLight", 0)        ipc.control(66587, 8027)        ipc.control(66377)-- Consp light toggleelseif ipcPARAM == 116 then        LVarSet = "L:ConspicLight"        val = 0        val2 = 8027        if ipc.readLvar(LVarSet) == 0 then        val = 1        val2 = 8028                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, val2)        ipc.control(66377)------------------------------------------------------------ Battery-- LEFT Battery switch TOGGLEelseif ipcPARAM == 120 then           LVarSet = "L:LeftBatSwitch"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8028)-- RIGHT Battery switch TOGGLEelseif ipcPARAM == 121 then        LVarSet = "L:RightBatSwitch"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8028)-- BOTH Battery switch onelseif ipcPARAM == 122 then        ipc.writeLvar("L:RightBatSwitch", 1)        ipc.control(66587, 8028)        ipc.sleep(250)        ipc.writeLvar("L:LeftBatSwitch", 1)        ipc.control(66587, 8028)-- BOTH Battery switch offelseif ipcPARAM == 123 then        ipc.writeLvar("L:RightBatSwitch", 0)        ipc.control(66587, 8027)        ipc.sleep(250)        ipc.writeLvar("L:LeftBatSwitch", 0)        ipc.control(66587, 8027)------------------------------------------------------------ Avionics-- Left AVIONICS SWITCh TOGGLEelseif ipcPARAM == 125 then        LVarSet = "L:LeftAvionicsMaster"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar("L:LeftAvionicsMasterGuard", val)        ipc.control(66587, 8026)        ipc.sleep(500)        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- RIGHT AVIONICS SWITCh TOGGLEelseif ipcPARAM == 126 then        LVarSet = "L:RightAvionicsMaster"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar("L:RightAvionicsMasterGuard", val)        ipc.control(66587, 8026)        ipc.sleep(500)        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- both AVIONICS SWITCh onelseif ipcPARAM == 127 then        ipc.writeLvar("L:RightAvionicsMasterGuard", 1)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:RightAvionicsMaster", 1)        ipc.control(66587, 8028)        ipc.sleep(100)        ipc.writeLvar("L:LeftAvionicsMasterGuard", 1)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:LeftAvionicsMaster", 1)        ipc.control(66587, 8028)-- both AVIONICS SWITCh offelseif ipcPARAM == 128 then        ipc.writeLvar("L:RightAvionicsMasterGuard", 0)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:RightAvionicsMaster", 0)        ipc.control(66587, 8027)        ipc.sleep(100)        ipc.writeLvar("L:LeftAvionicsMasterGuard", 0)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:LeftAvionicsMaster", 0)        ipc.control(66587, 8027)------------------------------------------------------------ GEN-- LEFT Generator SWITCH TOGGLEelseif ipcPARAM == 130 then        LVarSet = "L:LeftGenSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- right Generator SWITCH TOGGLEelseif ipcPARAM == 131 then        LVarSet = "L:RightGenSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- left Generator SWITCH onelseif ipcPARAM == 132 then        ipc.writeLvar("L:LeftGenSwitch", 2)        ipc.control(66587, 8027)-- left Generator SWITCH offelseif ipcPARAM == 133 then        ipc.writeLvar("L:LeftGenSwitch", 1)        ipc.control(66587, 8028)-- right Generator SWITCH onelseif ipcPARAM == 134 then        ipc.writeLvar("L:RightGenSwitch", 2)        ipc.control(66587, 8027)-- right Generator SWITCH offelseif ipcPARAM == 135 then        ipc.writeLvar("L:RightGenSwitch", 1)        ipc.control(66587, 8028)------------------------------------------------------------ FUEL PUMPS-- Left fuel Pump onelseif ipcPARAM == 136 then        ipc.writeLvar("L:LeftStbyFuelPump", 1)        ipc.control(66587, 8028)-- Left fuel Pump offelseif ipcPARAM == 137 then        ipc.writeLvar("L:LeftStbyFuelPump", 0)        ipc.control(66587, 8027)-- right fuel Pump onelseif ipcPARAM == 138 then        ipc.writeLvar("L:RightStbyFuelPump", 1)        ipc.control(66587, 8028)-- right fuel Pump offelseif ipcPARAM == 139 then        ipc.writeLvar("L:RightStbyFuelPump", 0)        ipc.control(66587, 8027)------------------------------------------------------------ Prop sync-- prop sync toggleelseif ipcPARAM == 140 then           LVarSet = "L:PropSync"        val = 0        val2 = 8027        if ipc.readLvar(LVarSet) == 0 then        val = 1        val2 = 8028                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, val2)------------------------------------------------------------ Ground spoiler--  Ground Spoiler switch onelseif ipcPARAM == 145 then                ipc.writeLvar("L:GrndSpoilersSwitch", 1)                ipc.control(66587,8034)-- Ground Spoiler switch offelseif ipcPARAM == 146 then                ipc.writeLvar("L:GrndSpoilersSwitch", 0)                ipc.control(66587,8034)-- Ground Spoiler switch toggleelseif ipcPARAM == 147 then        LVarSet = "L:GrndSpoilersSwitch"        val = 0        if ipc.readLvar(LVarSet) == 0 then        val = 1                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8034)------------------------------------------------------------ Ice oBS lights-- Ice OBS lights onelseif ipcPARAM == 148 then        ipc.writeLvar("IceOBSSwitch", 2)        ipc.control(66587,8027)-- Ice OBS lights offelseif ipcPARAM == 149 then        ipc.writeLvar("IceOBSSwitch", 0)        ipc.control(66587,8028)------------------------------------------------------------ Windshield Deice-- windshield deice onelseif ipcPARAM == 150 then        ipc.writeLvar("LeftWSAntice", 2)        ipc.writeLvar("RightWSAntice", 1)        ipc.control(66587,8027)-- windshield deice offelseif ipcPARAM == 151 then        ipc.writeLvar("LeftWSAntice", 1)        ipc.writeLvar("RightWSAntice", 0)        ipc.control(66587,8028)------------------------------------------------------------ Airdata Deice-- airdata deice onelseif ipcPARAM == 152 then        ipc.writeLvar("LeftAirData", 1)        ipc.writeLvar("RightAirData", 1)        ipc.control(66587,8027)-- airdata deice offelseif ipcPARAM == 153 then        ipc.writeLvar("LeftAirData", 0)        ipc.writeLvar("RightAirData", 0)        ipc.control(66587,8028)------------------------------------------------------------ Prop Deice-- Prop deice short onelseif ipcPARAM == 155 then        val = 2        SWvar = ipc.readLvar("LeftPropDeice")        if SWvar == 0 then        val = 1         end        ipc.writeLvar("LeftPropDeice", val)        ipc.writeLvar("RightPropDeice", val)        ipc.control(66587,8027)-- Prop deice offelseif ipcPARAM == 156 then        ipc.writeLvar("LeftPropDeice", 1)        ipc.writeLvar("RightPropDeice", 1)        ipc.control(66587,8028)-- Prop deice long onelseif ipcPARAM == 157 then        val = 0        SWvar = ipc.readLvar("LeftPropDeice")        if SWvar == 2 then        val = 1         end        ipc.writeLvar("LeftPropDeice", val)        ipc.writeLvar("RightPropDeice", val)        ipc.control(66587,8027)------------------------------------------------------------ Deice Auto cycle-- CCT Auto Cycle Switchelseif ipcPARAM == 158 then        ipc.writeLvar("L:AutoAnticeCycle", 2)        ipc.control(66587, 8028)        ipc.sleep(400)        ipc.writeLvar("L:AutoAnticeCycle", 1)        ipc.control(66587, 8027)------------------------------------------------------------ warning mute--warning mute switch toggleelseif ipcPARAM == 160 then        LVarSet = "L:CapMuted"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8031)        ipc.sleep(100)        ipc.writeLvar("L:CapMuteSwitch", val)        ipc.control(66587, 8031)------------------------------------------------------------ TOCW test switch-- TOCW Testswitch ONelseif ipcPARAM == 165 then        ipc.control(66587, 8021)                ipc.writeLvar("L:TocwTestSwitch", 1)-- TOCW Testswitch OFFelseif ipcPARAM == 166 then        ipc.control(66587, 8021)                ipc.writeLvar("L:TocwTestSwitch", 0)------------------------------------------------------------ signs-- Seatbelt onelseif ipcPARAM == 170 then        ipc.writeLvar("L:FastenSeatbeltSigns", 1)        ipc.control(66587, 8028)        ipc.sleep(10)        ipc.control(66587, 74)-- Seatbelt offelseif ipcPARAM == 171 then        ipc.writeLvar("L:FastenSeatbeltSigns", 0)        ipc.control(66587, 8027)        ipc.sleep(10)        ipc.control(66587, 74)-- no smoking onelseif ipcPARAM == 172 then        ipc.writeLvar("L:NoSmokingSigns", 1)        ipc.control(66587, 8028)        ipc.sleep(10)        ipc.control(66587, 74)-- no skmoking offelseif ipcPARAM == 173 then        ipc.writeLvar("L:NoSmokingSigns", 0)        ipc.control(66587, 8027)        ipc.sleep(10)        ipc.control(66587, 74)------------------------------------------------------------ feathering-- engine 1 (LEFT)elseif ipcPARAM == 176 then                   ipc.writeLvar("L:UnFeather", -1)                ipc.control(66587, 1420)        ipc.control(66587, 8029) -- knob sound-- no engine elseif ipcPARAM == 177 then                   ipc.writeLvar("L:UnFeather", 0)        ipc.control(66587, 8029) -- knob sound-- engine 2 (RIGHT)elseif ipcPARAM == 178 then                   ipc.writeLvar("L:UnFeather", 1)                ipc.control(66587, 1421)        ipc.control(66587, 8029) -- knob sound------------------------------------------------------------ engine starting-- select engine 1 (LEFT)elseif ipcPARAM == 180 then           if ipc.readLvar("L:StartMasterKnob") == 2  then                ipc.writeLvar("L:StartMasterKnob", 1)        ipc.display("no engine selected...")        ipc.sleep(1000)        elseif ipc.readLvar("L:StartMasterKnob") == 1  then                ipc.writeLvar("L:StartMasterKnob", 0)        ipc.display("left engine selected...")        ipc.sleep(1000)        end-- select engine 2 (RIGHT)elseif ipcPARAM == 181 then           if ipc.readLvar("L:StartMasterKnob") == 0  then                ipc.writeLvar("L:StartMasterKnob", 1)        ipc.display("no engine selected...")        ipc.sleep(1000)        elseif ipc.readLvar("L:StartMasterKnob") == 1  then                ipc.writeLvar("L:StartMasterKnob", 2)        ipc.display("right engine selected...")        ipc.sleep(1000)        end-- unselect engineselseif ipcPARAM == 182 then                   ipc.writeLvar("L:StartMasterKnob", 1)        ipc.display("no engine selected...")        ipc.sleep(1000)-- Feathering and starting selected engine -----------------elseif ipcPARAM == 185 then   -- Feathering and starting left engine                if ipc.readLvar("L:StartMasterKnob") == 0  then                ipc.control(66587, 1420)        ipc.control(66587, 8029) -- knob sound        ipc.display("feathering left engine...")        ipc.sleep(8000) -- waiting for feathering        ipc.display("feathering left engine...\n Starting left engine")        ipc.writeLvar("L:LeftStart", 1)        ipc.writeLvar("L:StartOneToggle", 1)        ipc.writeLvar("L:LeftStartCheck", 1)        ipc.writeLvar("L:LeftStartTimer", 1)        end-- Feathering and starting right engine         if ipc.readLvar("L:StartMasterKnob") == 2  then        ipc.control(66587, 1421)        ipc.control(66587, 8029) -- knob sound        ipc.display("feathering right engine...")        ipc.sleep(8000) -- waiting for feathering        ipc.display("feathering right engine...\n Starting right engine")        ipc.writeLvar("L:RightStart", 1)        ipc.writeLvar("L:StartTwoToggle", 1)        ipc.writeLvar("L:RightStartCheck", 1)        ipc.writeLvar("L:RightStartTimer", 1)        endipc.display("")-- abort starting sequence (stop) for selected engine -----------------elseif ipcPARAM == 186 then -- right engine stop        if ipc.readLvar("L:StartMasterKnob") == 2  then        -- Open the stop switch guard        RSG = ipc.readLvar("L:RightEngStopSwitchGuard")        if RSG == 0 then        ipc.writeLvar("L:RightEngStopSwitchGuard", 1)        ipc.control(66587, 8010)        end        -- Press the stop switch        ipc.sleep(700)        ipc.writeLvar("L:StopTwoToggle", 1)        ipc.control(66587, 100001)        ipc.control(66587, 8042)        ipc.control(66587, 16)        ipc.control(66301)        ipc.control(66587, 100002)        ipc.sleep(200)        ipc.writeLvar("L:StopTwoToggle", 0)        ipc.control(66587, 8042)        -- Close the stop switch guard        ipc.sleep(200)        ipc.writeLvar ("L:RightEngStopSwitchGuard", 0)        ipc.control (66587, 8010)        end-- left engine stop        if ipc.readLvar("L:StartMasterKnob") == 0  then -- Open the stop switch guard        LSG = ipc.readLvar("L:LeftEngStopSwitchGuard")        if LSG == 0 then        ipc.writeLvar("L:LeftEngStopSwitchGuard", 1)        ipc.control(66587, 8010)        end        -- Press the stop switch        ipc.sleep(700)        ipc.writeLvar("L:StopOneToggle", 1)        ipc.control(66587, 100001)        ipc.control(66587, 8042)        ipc.control(66587, 15)        ipc.control(66300)        ipc.control(66587, 100002)        ipc.sleep(200)        ipc.writeLvar("L:StopOneToggle", 0)        ipc.control(66587, 8042)        -- Close the stop switch guard        ipc.sleep(200)        ipc.writeLvar ("L:LeftEngStopSwitchGuard", 0)        ipc.control (66587, 8010)        endipc.display("engine starting sequence stopped") ipc.sleep(1000)ipc.display("")---------------------------------------------------------------- starting selected engine -----------------elseif ipcPARAM == 187 then   -- starting left engine                if ipc.readLvar("L:StartMasterKnob") == 0  then        ipc.writeLvar("L:LeftStart", 1)        ipc.writeLvar("L:StartOneToggle", 1)        ipc.writeLvar("L:LeftStartCheck", 1)        ipc.writeLvar("L:LeftStartTimer", 1)        end-- starting right engine         if ipc.readLvar("L:StartMasterKnob") == 2  then        ipc.writeLvar("L:RightStart", 1)        ipc.writeLvar("L:StartTwoToggle", 1)        ipc.writeLvar("L:RightStartCheck", 1)        ipc.writeLvar("L:RightStartTimer", 1)        end-- toggle gust lockselseif ipcPARAM == 190 then           LVarSet = "L:GustLocks"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 141)--Ground power switch toggle elseif ipcPARAM == 195 then        LVarSet = "L:GndPowerSwitch"        LVar2Set = "L:PowerCartVis"        val = 0        val2 = 1        if ipc.readLvar(LVarSet) == 0  then        val = 1        val2 = 0        end        ipc.writeLvar(LVar2Set, val2)        ipc.sleep (300)        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)---------------------------------------------------------------- yellow attention get switchelseif ipcPARAM == 198 then        ipc.writeLvar("L:LeftAmberAtgetSwitch", 1)        ipc.control(66587,2090)        ipc.control(66587,8044)        ipc.sleep(400)        ipc.writeLvar("L:LeftAmberAtgetSwitch", 0)        ipc.control(66587,2091)        ipc.control(66587,8045)----------------------------------------------------------------  Anti Skid onelseif ipcPARAM == 200 then                ipc.writeLvar("L:AntiSkid", 1)                ipc.control(66587,8029)--  Anti Skid offelseif ipcPARAM == 201 then                ipc.writeLvar("L:AntiSkid", 0)                ipc.control(66587,8029)--  Anti Skid  toggleelseif ipcPARAM == 202 then        LVarSet = "L:AntiSkid"        val = 0        if ipc.readLvar(LVarSet) == 0 then        val = 1                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8029)---------------------------------------------------------------------end

Share this post


Link to post

Ok. Yuor added zoom-code is what makes things go wrong.Here is how it should be (note the if-elseif order).Just copy&paste this code to your file.

-- LUA Script for the PMDG J41-- January, the 4th 2011-- made by Guenter (Guenseli) Steiner-- file is free for use; credits are always welcome-- thanks to Word Not Allowed and some other guys... of course Pete Dowson-- 9 ALT sel-- 10 ALT plus-- 11 ALT plus fast-- 12 ALT minus-- 13 ALT minus fast-- 14 ALT hold---- 15 HDG inc-- 16 HDG inc fast-- 17 HDG dec-- 18 HDG dec fast-- 19 HDG-- 20 HDG bug press---- 25 VS inc-- 26 VS dec---- 30 CRS left press---- 35 IAS Press-- 36 IAS plus-- 37 IAS plus fast-- 38 IAS minus-- 39 IAS minus fast---- 50 NAV-- 51 APR-- 52 VS-- 53 BC-- 54 IAS-- 55 STBY---- 56 AP Trim Power Switch on-- 57 AP Trim Power Switch off-- 58 AP Master-- 59 AP Master off---- 70 LEFT Bearing CIRCLE Knob Minus-- 71 LEFT Bearing CIRCLE Knob plus-- 72 LEFT Bearing DIAMOND Knob Minus-- 73 LEFT Bearing DIAMOND Knob plus---- 75 EFIS FULL/Map-- 76 EFIS TCAS-- 77 EFIS GSPD/TTG-- 78 EFIS ET-- 79 EFIS V/L-- 80 EFIS LNAV---- 90 Pilot analog ADFVOR 1 Toggle-- 91 Pilot analog ADFVOR 2 Toggle-- 92 Pilot ADF1-- 93 Pilot VOR1-- 94 Pilot ADF2-- 95 Pilot VOR2---- 100 Panel flood light on-- 101 Panel flood light off-- 102 Panel flood light toggle---- 103 Console lights ON-- 104 Console lights Off-- 105 Console lights toggle---- 106 flightdeck flood light toggle-- 107 BCN light toggle---- 108 NAV Lights ON-- 109 NAV Lights Off-- 110 NAV Lights toggle---- 111 STR light toggle-- 112 Landing lights toggle-- 113 Taxi light toggle---- 114 Consp Lights ON-- 115 Consp Lights Off-- 116 Consp Lights toggle---- 120 LEFT Battery switch TOGGLE-- 121 RIGHT Battery switch TOGGLE-- 122 BOTH Battery switch ON-- 123 BOTH Battery switch OFF---- 125 Left AVIONICS SWITCh TOGGLE-- 126 Right AVIONICS SWITCh TOGGLE-- 127 both AVIONICS SWITCh on-- 128 both AVIONICS SWITCh off---- 130 LEFT Generator SWITCH TOGGLE-- 131 RIGHT Generator SWITCH TOGGLE-- 132 LEFT Generator SWITCH on-- 133 LEFT Generator SWITCH off-- 134 RIGHT Generator SWITCH on-- 135 RIGHT Generator SWITCH off---- 136 Left fuel Pump on-- 137 Left fuel Pump off-- 138 Right fuel Pump on-- 139 Right fuel Pump off---- 140 Prop Sync Toggle---- 145 Ground Spoiler switch on-- 146 Ground Spoiler switch off-- 147 Ground Spoiler switch toggle---- 150 windshield deice on-- 151 windshield deice off-- 152 airdata deice on-- 153 airdata deice off-- 155 Prop deice short on-- 156 Prop deice short off-- 157 Prop deice long on-- 158 CCT Auto Cycle Switch---- 160 warning mute switch toggle---- 165 TOCW test switch on-- 166 TOCW test switch off---- 170 Seatbelt on-- 171 Seatbelt on---- 172 no smoking on-- 173 no smoking on---- 176 engine 1 feather (LEFT)-- 177 no engine feather-- 178 engine 2 feather (RIGHT)---- 180 select engine 1 (LEFT)-- 181 select engine 2 (RIGHT)-- 182 unselect engines---- 185 Feathering and starting selected engine-- 186 abort starting sequence (stop) for selected engine-- 187 starting selected engine---- 190 gust locks toggle-- 195 APU (ground power) connection toggle-- 198 yellow attention get switch-- 200 Anti-Skid on-- 201 Anti Skid off-- 202 Anti Skid toggle--ipc.display("test start")--ipc.sleep(100)--ipc.display("VRIdevice COM".. VRIdevice.. "\nVRIdriver COM".. VRIdriver.. "\nipcPARAM".. ipcPARAM)--ipc.sleep(1000)--  zoom outif ipcPARAM == 205 then                ipc.control(66587,4930)                ipc.control(66587,8031)--  zoom inelseif ipcPARAM == 206 then                ipc.control(66587,4940)                ipc.control(66587,8031)------------------------------------------------------------AP ALT-- ALT selelseif ipcPARAM == 9 then                ipc.writeLvar("L:FdModeselAltselSwitch", 1)                ipc.control(66587,282)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselAltselSwitch", 0)                ipc.control(66587,8031)-- ALT pluselseif ipcPARAM == 10 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var >= 100 then                 Var = 1                end                ipc.writeLvar("IrcAltSelKnob", Var+1)                ipc.control(66587,3921)                                ipc.control(66587,8031)                ipc.sleep(40)-- ALT plus fastelseif ipcPARAM == 11 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var >= 100 then                 Var = 1                end                ipc.writeLvar("IrcAltSelKnob", Var+5)                for n=1, 10, 1 do                ipc.control(66587,3921)                end                ipc.control(66587,8031)                ipc.sleep(40)-- ALT minuselseif ipcPARAM == 12 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var <= 1 then                 Var = 100                end                ipc.writeLvar("IrcAltSelKnob", Var-1)                ipc.control(66587,3920)                ipc.control(66587,8031)                ipc.sleep(40)-- ALT minus fastelseif ipcPARAM == 13 then                Var = ipc.readLvar("IrcAltSelKnob")                if Var <= 1 then                 Var = 100                end                ipc.writeLvar("IrcAltSelKnob", Var-5)                                for n=1, 10, 1 do                ipc.control(66587,3920)                end                ipc.control(66587,8031)                ipc.sleep(40)-- ALT holdelseif ipcPARAM == 14 then                ipc.writeLvar("L:FdModeselAltSwitch", 1)                ipc.control(66587,281)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselAltSwitch", 0)                ipc.control(66587,8031)------------------------------------------------------------AP HDG-- HDG pluselseif ipcPARAM == 15 then                ipc.control(66587,26902)                                ipc.control(66587,8031)                ipc.sleep(50)-- HDG plus fastelseif ipcPARAM == 16 then                for n=1, 10, 1 do                ipc.control(66587,26902)                end                ipc.control(66587,8031)                ipc.sleep(50)-- HDG minuselseif ipcPARAM == 17 then                ipc.control(66587,26901)                                ipc.control(66587,8031)                ipc.sleep(50)-- HDG minus fastelseif ipcPARAM == 18 then                for n=1, 10, 1 do                ipc.control(66587,26901)                end                ipc.control(66587,8031)                ipc.sleep(50)-- HDG elseif ipcPARAM == 19 then                ipc.writeLvar("L:FdModeselHdgSwitch", 1)                ipc.control(66587,277)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselHdgSwitch", 0)                ipc.control(66587,8031)-- HDG bug presselseif ipcPARAM == 20 then                ipc.writeLvar("L:IrcHdgKnobPush", 1)                            ipc.control(66587,2691)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:IrcHdgKnobPush", 0)                ipc.control(66587,8031)-------------------------------------------------------------- VS incelseif ipcPARAM == 25 then                buffer = ipc.readLvar("L:VSIASTarget")                                Var = ipc.readLvar("L:AP_PitchWheel")                                ipc.writeLvar("AP_PitchWheel", Var+10)                ipc.writeLvar("L:VSIASTarget", buffer+100)                ipc.control(65894)                ipc.control(66587,8031)                ipc.sleep(40)                buffer = ipc.readLvar("L:VSIASTarget")                com.write(dev, string.format("DSP_%04d", buffer), 8)-- VS decelseif ipcPARAM == 26 then                buffer = ipc.readLvar("L:VSIASTarget")                                Var = ipc.readLvar("L:AP_PitchWheel")                                ipc.writeLvar("AP_PitchWheel", Var-10)                ipc.writeLvar("L:VSIASTarget", buffer-100)                ipc.control(65895)                ipc.control(66587,8031)                ipc.sleep(40)                buffer = ipc.readLvar("L:VSIASTarget")                com.write(dev, string.format("DSP_%04d", buffer), 8)-- CRS presselseif ipcPARAM == 30 then                ipc.writeLvar("L:LeftIrcCrsKnobPush", 1)                ipc.control(66587,2671)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:LeftIrcCrsKnobPush", 0)                ipc.control(66587,8031)-- IAS knob presselseif ipcPARAM == 35 then                ipc.writeLvar("L:IrcIasKnobPush", 1)                ipc.control(66587,2681)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:IrcIasKnobPush", 0)                ipc.control(66587,8031)-- IAS plus elseif ipcPARAM == 36 then                ipc.control(66587,26802)                ipc.control(66587,8031)-- IAS plus fastelseif ipcPARAM == 37 then                for n=1, 10, 1 do                ipc.control(66587,26802)                end                ipc.control(66587,8031)                -- IAS minuselseif ipcPARAM == 38 then                ipc.control(66587,26801)                ipc.control(66587,8031)-- IAS minus fastelseif ipcPARAM == 39 then                for n=1, 10, 1 do                ipc.control(66587,26801)                end                ipc.control(66587,8031)------------------------------------------------------------ AP Mode select-- NAV elseif ipcPARAM == 50 then                ipc.writeLvar("L:FdModeselNavSwitch", 1)                ipc.control(66587,278)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselNavSwitch", 0)                ipc.control(66587,8031)-- APRelseif ipcPARAM == 51 then                ipc.writeLvar("L:FdModeselAprSwitch", 1)                ipc.control(66587,279)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselAprSwitch", 0)                ipc.control(66587,8031)-- VSelseif ipcPARAM == 52 then                ipc.writeLvar("L:FdModeselVsSwitch", 1)                ipc.control(66587,283)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselVsSwitch", 0)                ipc.control(66587,8031)-- BCelseif ipcPARAM == 53 then                ipc.writeLvar("L:FdModeselBcSwitch", 1)                ipc.control(66587,280)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselBcSwitch", 0)                ipc.control(66587,8031)-- IASelseif ipcPARAM == 54 then                ipc.writeLvar("L:FdModeselIasSwitch", 1)                ipc.control(66587,284)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselIasSwitch", 0)                ipc.control(66587,8031)-- STBYelseif ipcPARAM == 55 then                ipc.writeLvar("L:FdModeselSbySwitch", 1)                ipc.control(66587,2851)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.writeLvar("L:FdModeselSbySwitch", 0)                ipc.control(66587,2850)                ipc.control(66587,8031)-- AP Trim Power Switch onelseif ipcPARAM == 56 then                ipc.writeLvar("L:ApTrimPowerSwitch", 1)                ipc.control(66587,8034)-- AP Trim Power Switch offelseif ipcPARAM == 57 then                ipc.writeLvar("L:ApTrimPowerSwitch", 0)                ipc.control(66587,8034)-- AP Masterelseif ipcPARAM == 58 then                ipc.writeLvar("L:APEngageSwitchSelect", 1)                ipc.control(65580)                ipc.control(66587,8038)                ipc.sleep(200)                ipc.writeLvar("L:APEngageSwitchSelect", 0)                ipc.control(66587,8038)-- AP Master offelseif ipcPARAM == 59 then                ipc.writeLvar("L:APEngageSwitchSelect", 1)                ipc.control(65791)                ipc.control(66587,8038)                ipc.sleep(200)                ipc.writeLvar("L:APEngageSwitchSelect", 0)                ipc.control(66587,8038)------------------------------------------------------------ EFIS BRG1 and BRG2-- LEFT Bearing CIRCLE Knob Minuselseif ipcPARAM == 70 then        i = ipc.readLvar("L:LeftBearingCircleKnob")                if i < 3 then        ipc.writeLvar("L:LeftBearingCircleKnob", i+1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 3 then        ipc.writeLvar("L:LeftBearingCircleKnob", 3)        end        -- LEFT Bearing CIRLCE Knob Pluselseif ipcPARAM == 71 then        i = ipc.readLvar("L:LeftBearingCircleKnob")                if i > 0 then        ipc.writeLvar("L:LeftBearingCircleKnob", i-1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 0 then        ipc.writeLvar("L:LeftBearingCircleKnob", 0)        end-- LEFT Bearing DIAMOND Knob Minuselseif ipcPARAM == 72 then        i = ipc.readLvar("L:LeftBearingDiamondKnob")                if i > 0 then        ipc.writeLvar("L:LeftBearingDiamondKnob", i-1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 0 then        ipc.writeLvar("L:LeftBearingDiamondKnob", 0)        end     -- LEFT Bearing DIAMOND Knob Pluselseif ipcPARAM == 73 then        i = ipc.readLvar("L:LeftBearingDiamondKnob")                if i < 3 then        ipc.writeLvar("L:LeftBearingDiamondKnob", i+1)        ipc.sleep(10)        ipc.control(66587, 8031)        end        if i == 3 then        ipc.writeLvar("L:LeftBearingDiamondKnob", 3)        end------------------------------------------------------------ EFIS-- Full/Map elseif ipcPARAM == 75 then                ipc.control(66587,214)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- TCAS elseif ipcPARAM == 76 then                ipc.control(66587,215)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- GSPD/TTG elseif ipcPARAM == 77 then                ipc.control(66587,217)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- ETelseif ipcPARAM == 78 then                ipc.control(66587,218)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- V/L elseif ipcPARAM == 79 then                ipc.control(66587,21901)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)-- LNAV elseif ipcPARAM == 80 then                ipc.control(66587,21910)                ipc.control(66587,8031)                ipc.sleep(200)                ipc.control(66587,8031)------------------------------------------------------------ Pilot analog VOR/ADF-- Pilot analog ADFVOR 1 Toggleelseif ipcPARAM == 90 then           LVarSet = "L:LeftAdfVorSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8024)-- Pilot analog ADFVOR 2 Toggleelseif ipcPARAM == 91 then        LVarSet = "L:LeftVorAdfSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8024)        -- Pilot ADF1 elseif ipcPARAM == 92 then        ipc.writeLvar("L:LeftAdfVorSwitch", 0)        ipc.control(66587, 8024)-- Pilot VOR1elseif ipcPARAM == 93 then        ipc.writeLvar("L:LeftAdfVorSwitch", 1)        ipc.control(66587, 8024)-- Pilot ADF2elseif ipcPARAM == 94 then        ipc.writeLvar("L:LeftVorAdfSwitch", 1)        ipc.control(66587, 8024)-- Pilot VOR2elseif ipcPARAM == 95 then        ipc.writeLvar("L:LeftVorAdfSwitch", 0)        ipc.control(66587, 8024)------------------------------------------------------------ Lights-- Panel flood light onelseif ipcPARAM == 100 then        ipc.writeLvar("L:PanelFloodSW", 1)        ipc.control(66587, 8029)-- Panel flood light offelseif ipcPARAM == 101 then        ipc.writeLvar("L:PanelFloodSW", 0)        ipc.control(66587, 8029)-- Panel flood light toggleelseif ipcPARAM == 102 then        LVarSet = "L:PanelFloodSW"        val = 0        if ipc.readLvar(LVarSet) == 0 then        val = 1                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8029)------------------------------------------------ Console lights ONelseif ipcPARAM == 103 then        ipc.control(66056)        ipc.writeLvar("L:InstrConsolesLightSwitch", 1)        ipc.writeLvar("L:InstrRoofLightSwitch", 1)        ipc.writeLvar("L:InstrGlareshieldLightSwitch", 1)        ipc.control(66587, 8031)-- Console lights OFFelseif ipcPARAM == 104 then        ipc.control(66057)        ipc.writeLvar("L:InstrConsolesLightSwitch", 0)        ipc.writeLvar("L:InstrRoofLightSwitch", 0)        ipc.writeLvar("L:InstrGlareshieldLightSwitch", 0)        ipc.control(66587, 8031)-- Console lights toggleelseif ipcPARAM == 105 then        val = 0        val2 = 66057        if ipc.readLvar("L:InstrConsolesLightSwitch") == 0 then        val = 1        val2 = 66056                end        ipc.control(val2)        ipc.writeLvar("L:InstrConsolesLightSwitch", val)        ipc.writeLvar("L:InstrRoofLightSwitch", val)        ipc.writeLvar("L:InstrGlareshieldLightSwitch", val)        ipc.control(66587, 8031)-- flightdeck flood light toggleelseif ipcPARAM == 106 then        ipc.control(66376)        ipc.control(66587,8027)-- BCN light toggleelseif ipcPARAM == 107 then        ipc.control(66239)        ipc.control(66587,8027)-- NAV Lights ONelseif ipcPARAM == 108 then                ipc.writeLvar("L:NavLightSwitch", 2)        ipc.control(66587, 8028)-- NAV Lights Offelseif ipcPARAM == 109 then                ipc.writeLvar("L:NavLightSwitch", 1)        ipc.control(66587, 8027)-- NAV light toggleelseif ipcPARAM == 110 then        LVarSet = "L:NavLightSwitch"        val = 1        val2 = 8027        if ipc.readLvar(LVarSet) == 1 then        val = 2        val2 = 8028                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, val2)-- STR light toggleelseif ipcPARAM == 111 then        ipc.control(65560)        ipc.control(66587,8028)-- Landing lights toggleelseif ipcPARAM == 112 then        ipc.control(65751)        ipc.control(66587,8027)-- Taxi light toggleelseif ipcPARAM == 113 then        ipc.control(66240)        ipc.control(66587,8028)-- Consp Lights ONelseif ipcPARAM == 114 then                ipc.writeLvar("L:ConspicLight", 1)        ipc.control(66587, 8028)        ipc.control(66377)-- Consp Lights Offelseif ipcPARAM == 115 then                ipc.writeLvar("L:ConspicLight", 0)        ipc.control(66587, 8027)        ipc.control(66377)-- Consp light toggleelseif ipcPARAM == 116 then        LVarSet = "L:ConspicLight"        val = 0        val2 = 8027        if ipc.readLvar(LVarSet) == 0 then        val = 1        val2 = 8028                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, val2)        ipc.control(66377)------------------------------------------------------------ Battery-- LEFT Battery switch TOGGLEelseif ipcPARAM == 120 then           LVarSet = "L:LeftBatSwitch"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8028)-- RIGHT Battery switch TOGGLEelseif ipcPARAM == 121 then        LVarSet = "L:RightBatSwitch"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8028)-- BOTH Battery switch onelseif ipcPARAM == 122 then        ipc.writeLvar("L:RightBatSwitch", 1)        ipc.control(66587, 8028)        ipc.sleep(250)        ipc.writeLvar("L:LeftBatSwitch", 1)        ipc.control(66587, 8028)-- BOTH Battery switch offelseif ipcPARAM == 123 then        ipc.writeLvar("L:RightBatSwitch", 0)        ipc.control(66587, 8027)        ipc.sleep(250)        ipc.writeLvar("L:LeftBatSwitch", 0)        ipc.control(66587, 8027)------------------------------------------------------------ Avionics-- Left AVIONICS SWITCh TOGGLEelseif ipcPARAM == 125 then        LVarSet = "L:LeftAvionicsMaster"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar("L:LeftAvionicsMasterGuard", val)        ipc.control(66587, 8026)        ipc.sleep(500)        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- RIGHT AVIONICS SWITCh TOGGLEelseif ipcPARAM == 126 then        LVarSet = "L:RightAvionicsMaster"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar("L:RightAvionicsMasterGuard", val)        ipc.control(66587, 8026)        ipc.sleep(500)        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- both AVIONICS SWITCh onelseif ipcPARAM == 127 then        ipc.writeLvar("L:RightAvionicsMasterGuard", 1)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:RightAvionicsMaster", 1)        ipc.control(66587, 8028)        ipc.sleep(100)        ipc.writeLvar("L:LeftAvionicsMasterGuard", 1)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:LeftAvionicsMaster", 1)        ipc.control(66587, 8028)-- both AVIONICS SWITCh offelseif ipcPARAM == 128 then        ipc.writeLvar("L:RightAvionicsMasterGuard", 0)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:RightAvionicsMaster", 0)        ipc.control(66587, 8027)        ipc.sleep(100)        ipc.writeLvar("L:LeftAvionicsMasterGuard", 0)        ipc.control(66587, 8026)        ipc.sleep(400)        ipc.writeLvar("L:LeftAvionicsMaster", 0)        ipc.control(66587, 8027)------------------------------------------------------------ GEN-- LEFT Generator SWITCH TOGGLEelseif ipcPARAM == 130 then        LVarSet = "L:LeftGenSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- right Generator SWITCH TOGGLEelseif ipcPARAM == 131 then        LVarSet = "L:RightGenSwitch"        val = 1        if ipc.readLvar(LVarSet) == 1  then        val = 2        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)-- left Generator SWITCH onelseif ipcPARAM == 132 then        ipc.writeLvar("L:LeftGenSwitch", 2)        ipc.control(66587, 8027)-- left Generator SWITCH offelseif ipcPARAM == 133 then        ipc.writeLvar("L:LeftGenSwitch", 1)        ipc.control(66587, 8028)-- right Generator SWITCH onelseif ipcPARAM == 134 then        ipc.writeLvar("L:RightGenSwitch", 2)        ipc.control(66587, 8027)-- right Generator SWITCH offelseif ipcPARAM == 135 then        ipc.writeLvar("L:RightGenSwitch", 1)        ipc.control(66587, 8028)------------------------------------------------------------ FUEL PUMPS-- Left fuel Pump onelseif ipcPARAM == 136 then        ipc.writeLvar("L:LeftStbyFuelPump", 1)        ipc.control(66587, 8028)-- Left fuel Pump offelseif ipcPARAM == 137 then        ipc.writeLvar("L:LeftStbyFuelPump", 0)        ipc.control(66587, 8027)-- right fuel Pump onelseif ipcPARAM == 138 then        ipc.writeLvar("L:RightStbyFuelPump", 1)        ipc.control(66587, 8028)-- right fuel Pump offelseif ipcPARAM == 139 then        ipc.writeLvar("L:RightStbyFuelPump", 0)        ipc.control(66587, 8027)------------------------------------------------------------ Prop sync-- prop sync toggleelseif ipcPARAM == 140 then           LVarSet = "L:PropSync"        val = 0        val2 = 8027        if ipc.readLvar(LVarSet) == 0 then        val = 1        val2 = 8028                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, val2)------------------------------------------------------------ Ground spoiler--  Ground Spoiler switch onelseif ipcPARAM == 145 then                ipc.writeLvar("L:GrndSpoilersSwitch", 1)                ipc.control(66587,8034)-- Ground Spoiler switch offelseif ipcPARAM == 146 then                ipc.writeLvar("L:GrndSpoilersSwitch", 0)                ipc.control(66587,8034)-- Ground Spoiler switch toggleelseif ipcPARAM == 147 then        LVarSet = "L:GrndSpoilersSwitch"        val = 0        if ipc.readLvar(LVarSet) == 0 then        val = 1                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8034)------------------------------------------------------------ Ice oBS lights-- Ice OBS lights onelseif ipcPARAM == 148 then        ipc.writeLvar("IceOBSSwitch", 2)        ipc.control(66587,8027)-- Ice OBS lights offelseif ipcPARAM == 149 then        ipc.writeLvar("IceOBSSwitch", 0)        ipc.control(66587,8028)------------------------------------------------------------ Windshield Deice-- windshield deice onelseif ipcPARAM == 150 then        ipc.writeLvar("LeftWSAntice", 2)        ipc.writeLvar("RightWSAntice", 1)        ipc.control(66587,8027)-- windshield deice offelseif ipcPARAM == 151 then        ipc.writeLvar("LeftWSAntice", 1)        ipc.writeLvar("RightWSAntice", 0)        ipc.control(66587,8028)------------------------------------------------------------ Airdata Deice-- airdata deice onelseif ipcPARAM == 152 then        ipc.writeLvar("LeftAirData", 1)        ipc.writeLvar("RightAirData", 1)        ipc.control(66587,8027)-- airdata deice offelseif ipcPARAM == 153 then        ipc.writeLvar("LeftAirData", 0)        ipc.writeLvar("RightAirData", 0)        ipc.control(66587,8028)------------------------------------------------------------ Prop Deice-- Prop deice short onelseif ipcPARAM == 155 then        val = 2        SWvar = ipc.readLvar("LeftPropDeice")        if SWvar == 0 then        val = 1         end        ipc.writeLvar("LeftPropDeice", val)        ipc.writeLvar("RightPropDeice", val)        ipc.control(66587,8027)-- Prop deice offelseif ipcPARAM == 156 then        ipc.writeLvar("LeftPropDeice", 1)        ipc.writeLvar("RightPropDeice", 1)        ipc.control(66587,8028)-- Prop deice long onelseif ipcPARAM == 157 then        val = 0        SWvar = ipc.readLvar("LeftPropDeice")        if SWvar == 2 then        val = 1         end        ipc.writeLvar("LeftPropDeice", val)        ipc.writeLvar("RightPropDeice", val)        ipc.control(66587,8027)------------------------------------------------------------ Deice Auto cycle-- CCT Auto Cycle Switchelseif ipcPARAM == 158 then        ipc.writeLvar("L:AutoAnticeCycle", 2)        ipc.control(66587, 8028)        ipc.sleep(400)        ipc.writeLvar("L:AutoAnticeCycle", 1)        ipc.control(66587, 8027)------------------------------------------------------------ warning mute--warning mute switch toggleelseif ipcPARAM == 160 then        LVarSet = "L:CapMuted"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8031)        ipc.sleep(100)        ipc.writeLvar("L:CapMuteSwitch", val)        ipc.control(66587, 8031)------------------------------------------------------------ TOCW test switch-- TOCW Testswitch ONelseif ipcPARAM == 165 then        ipc.control(66587, 8021)                ipc.writeLvar("L:TocwTestSwitch", 1)-- TOCW Testswitch OFFelseif ipcPARAM == 166 then        ipc.control(66587, 8021)                ipc.writeLvar("L:TocwTestSwitch", 0)------------------------------------------------------------ signs-- Seatbelt onelseif ipcPARAM == 170 then        ipc.writeLvar("L:FastenSeatbeltSigns", 1)        ipc.control(66587, 8028)        ipc.sleep(10)        ipc.control(66587, 74)-- Seatbelt offelseif ipcPARAM == 171 then        ipc.writeLvar("L:FastenSeatbeltSigns", 0)        ipc.control(66587, 8027)        ipc.sleep(10)        ipc.control(66587, 74)-- no smoking onelseif ipcPARAM == 172 then        ipc.writeLvar("L:NoSmokingSigns", 1)        ipc.control(66587, 8028)        ipc.sleep(10)        ipc.control(66587, 74)-- no skmoking offelseif ipcPARAM == 173 then        ipc.writeLvar("L:NoSmokingSigns", 0)        ipc.control(66587, 8027)        ipc.sleep(10)        ipc.control(66587, 74)------------------------------------------------------------ feathering-- engine 1 (LEFT)elseif ipcPARAM == 176 then                   ipc.writeLvar("L:UnFeather", -1)                ipc.control(66587, 1420)        ipc.control(66587, 8029) -- knob sound-- no engine elseif ipcPARAM == 177 then                   ipc.writeLvar("L:UnFeather", 0)        ipc.control(66587, 8029) -- knob sound-- engine 2 (RIGHT)elseif ipcPARAM == 178 then                   ipc.writeLvar("L:UnFeather", 1)                ipc.control(66587, 1421)        ipc.control(66587, 8029) -- knob sound------------------------------------------------------------ engine starting-- select engine 1 (LEFT)elseif ipcPARAM == 180 then           if ipc.readLvar("L:StartMasterKnob") == 2  then                ipc.writeLvar("L:StartMasterKnob", 1)        ipc.display("no engine selected...")        ipc.sleep(1000)        elseif ipc.readLvar("L:StartMasterKnob") == 1  then                ipc.writeLvar("L:StartMasterKnob", 0)        ipc.display("left engine selected...")        ipc.sleep(1000)        end-- select engine 2 (RIGHT)elseif ipcPARAM == 181 then           if ipc.readLvar("L:StartMasterKnob") == 0  then                ipc.writeLvar("L:StartMasterKnob", 1)        ipc.display("no engine selected...")        ipc.sleep(1000)        elseif ipc.readLvar("L:StartMasterKnob") == 1  then                ipc.writeLvar("L:StartMasterKnob", 2)        ipc.display("right engine selected...")        ipc.sleep(1000)        end-- unselect engineselseif ipcPARAM == 182 then                   ipc.writeLvar("L:StartMasterKnob", 1)        ipc.display("no engine selected...")        ipc.sleep(1000)-- Feathering and starting selected engine -----------------elseif ipcPARAM == 185 then   -- Feathering and starting left engine                if ipc.readLvar("L:StartMasterKnob") == 0  then                ipc.control(66587, 1420)        ipc.control(66587, 8029) -- knob sound        ipc.display("feathering left engine...")        ipc.sleep(8000) -- waiting for feathering        ipc.display("feathering left engine...\n Starting left engine")        ipc.writeLvar("L:LeftStart", 1)        ipc.writeLvar("L:StartOneToggle", 1)        ipc.writeLvar("L:LeftStartCheck", 1)        ipc.writeLvar("L:LeftStartTimer", 1)        end-- Feathering and starting right engine         if ipc.readLvar("L:StartMasterKnob") == 2  then        ipc.control(66587, 1421)        ipc.control(66587, 8029) -- knob sound        ipc.display("feathering right engine...")        ipc.sleep(8000) -- waiting for feathering        ipc.display("feathering right engine...\n Starting right engine")        ipc.writeLvar("L:RightStart", 1)        ipc.writeLvar("L:StartTwoToggle", 1)        ipc.writeLvar("L:RightStartCheck", 1)        ipc.writeLvar("L:RightStartTimer", 1)        endipc.display("")-- abort starting sequence (stop) for selected engine -----------------elseif ipcPARAM == 186 then -- right engine stop        if ipc.readLvar("L:StartMasterKnob") == 2  then        -- Open the stop switch guard        RSG = ipc.readLvar("L:RightEngStopSwitchGuard")        if RSG == 0 then        ipc.writeLvar("L:RightEngStopSwitchGuard", 1)        ipc.control(66587, 8010)        end        -- Press the stop switch        ipc.sleep(700)        ipc.writeLvar("L:StopTwoToggle", 1)        ipc.control(66587, 100001)        ipc.control(66587, 8042)        ipc.control(66587, 16)        ipc.control(66301)        ipc.control(66587, 100002)        ipc.sleep(200)        ipc.writeLvar("L:StopTwoToggle", 0)        ipc.control(66587, 8042)        -- Close the stop switch guard        ipc.sleep(200)        ipc.writeLvar ("L:RightEngStopSwitchGuard", 0)        ipc.control (66587, 8010)        end-- left engine stop        if ipc.readLvar("L:StartMasterKnob") == 0  then -- Open the stop switch guard        LSG = ipc.readLvar("L:LeftEngStopSwitchGuard")        if LSG == 0 then        ipc.writeLvar("L:LeftEngStopSwitchGuard", 1)        ipc.control(66587, 8010)        end        -- Press the stop switch        ipc.sleep(700)        ipc.writeLvar("L:StopOneToggle", 1)        ipc.control(66587, 100001)        ipc.control(66587, 8042)        ipc.control(66587, 15)        ipc.control(66300)        ipc.control(66587, 100002)        ipc.sleep(200)        ipc.writeLvar("L:StopOneToggle", 0)        ipc.control(66587, 8042)        -- Close the stop switch guard        ipc.sleep(200)        ipc.writeLvar ("L:LeftEngStopSwitchGuard", 0)        ipc.control (66587, 8010)        endipc.display("engine starting sequence stopped") ipc.sleep(1000)ipc.display("")---------------------------------------------------------------- starting selected engine -----------------elseif ipcPARAM == 187 then   -- starting left engine                if ipc.readLvar("L:StartMasterKnob") == 0  then        ipc.writeLvar("L:LeftStart", 1)        ipc.writeLvar("L:StartOneToggle", 1)        ipc.writeLvar("L:LeftStartCheck", 1)        ipc.writeLvar("L:LeftStartTimer", 1)        end-- starting right engine         if ipc.readLvar("L:StartMasterKnob") == 2  then        ipc.writeLvar("L:RightStart", 1)        ipc.writeLvar("L:StartTwoToggle", 1)        ipc.writeLvar("L:RightStartCheck", 1)        ipc.writeLvar("L:RightStartTimer", 1)        end-- toggle gust lockselseif ipcPARAM == 190 then           LVarSet = "L:GustLocks"        val = 0        if ipc.readLvar(LVarSet) == 0  then        val = 1        end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 141)--Ground power switch toggle elseif ipcPARAM == 195 then        LVarSet = "L:GndPowerSwitch"        LVar2Set = "L:PowerCartVis"        val = 0        val2 = 1        if ipc.readLvar(LVarSet) == 0  then        val = 1        val2 = 0        end        ipc.writeLvar(LVar2Set, val2)        ipc.sleep (300)        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8027)---------------------------------------------------------------- yellow attention get switchelseif ipcPARAM == 198 then        ipc.writeLvar("L:LeftAmberAtgetSwitch", 1)        ipc.control(66587,2090)        ipc.control(66587,8044)        ipc.sleep(400)        ipc.writeLvar("L:LeftAmberAtgetSwitch", 0)        ipc.control(66587,2091)        ipc.control(66587,8045)----------------------------------------------------------------  Anti Skid onelseif ipcPARAM == 200 then                ipc.writeLvar("L:AntiSkid", 1)                ipc.control(66587,8029)--  Anti Skid offelseif ipcPARAM == 201 then                ipc.writeLvar("L:AntiSkid", 0)                ipc.control(66587,8029)--  Anti Skid  toggleelseif ipcPARAM == 202 then        LVarSet = "L:AntiSkid"        val = 0        if ipc.readLvar(LVarSet) == 0 then        val = 1                end        ipc.writeLvar(LVarSet, val)        ipc.control(66587, 8029)---------------------------------------------------------------------end


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

Thanks!Works great now.*edit*Does anyone know if it's possible to map the "A/P Out" soft disconnect red button on the yoke in the sim?or the TA/GO button on the throttle levers?

Share this post


Link to post

Sorry to resurrect this thread, but has anyone noticed that when utilizing the STBY function from the script, that the FD disappears, but all of the auto panel lights (in the virtual cockpit) light up and remain on until the virtual standby button in the VC is pressed?Going back and re-enabling other autopilot modes like HDG, ALTSEL etc, continue to work, but all the AP panel lights remain illuminated until pressing the virtual cockpit STBY button and starting over.

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...