Jump to content
The simFlight Network Forums

PMDG J41 commands (upd 5th Aug 2010)


guenseli
 Share

Recommended Posts

I have made some little LUA and MACRO files for different aircrafts the last weeks and d'like to share them here.

-- update 05th Aug 2010

reworked cold&dark LUA code so that you get a question at the beginning if you want to go cold and dark

-- update 19th Feb 2010:

Key commands:

One new item is the possibility to start the engines now via a button.

A feature is, that the feathering of the selected engine is included!

Of course you have to select an engine before to let them start (via my LUA or by "hand")

added gust locks, prop sync switch

cold and dark file: completely reworked!

-- update 15th Feb 2010: AS I have learned a little about LUA the last months, I have reworked my original LUA code and have it simplified a lot. Also I added some commands, too (see parameter list).

So, everybody who is interested in this new code have to reassign his parameternumbers!

The Macro and the LUA from Richard Cooke below is unchanged!

--

LUA commands

To get acces to the single commands you have to do the following:

1) copy the code below

2) insert it into an empty editor or Notepad file and save it as e.g. J41.LUA

3) open FSUIPC menu and choose LUA J41 from the drop down

4) insert different parameter numbers depending on the action you want (green field)

fr6tcbg5.jpg

parameter numbers for the J41:

-- 1 Left Battery toggle

-- 2 Right Battery toggle

-- 3 both batteries on

-- 4 both batteries Off

-- 5 left avionics toggle

-- 6 right avionics toggle

-- 7 both avionics on

-- 8 both avionics off

-- 9 left generator toggle

-- 10 right generator toggle

-- 11 left gen on

-- 12 left gen off

-- 13 right gen on

-- 14 right gen off

-- 15 LEFT Bearing CIRCLE Knob Minus

-- 16 LEFT Bearing CIRLCE Knob Plus

-- 17 LEFT Bearing DIAMOND Knob Plus

-- 18 LEFT Bearing DIAMOND Knob Minus

-- 19 CCT Auto Cycle Switch

-- 20 Pilot analog ADFVOR 1 Toggle

-- 21 Pilot analog ADFVOR 2 Toggle

-- 22 Pilot ADF1

-- 23 Pilot VOR1

-- 24 Pilot VOR2

-- 25 Pilot ADF2

-- 26 Left fuel Pump on

-- 27 Left fuel Pump off

-- 28 right fuel Pump on

-- 29 right fuel Pump off

-- 30 ground power switch toggle

-- 31 warning mute switch toggle

-- 32 NAV Lights ON

-- 33 NAV Lights OFF

-- 34 Console lights ON

-- 35 Console lights OFF

-- 36 TOCW Testswitch ON

-- 37 TOCW Testswitch OFF

-- 38 seat belt ON

-- 39 seat belt off

-- 40 no smoking on

-- 41 no smoking off

-- 42 toggle flood light

-- 43 select engine 1 (LEFT)

-- 44 select engine 2 (RIGHT)

-- 45 unselect engines

-- 46 Feathering and starting selected engine

-- 47 toggle gust locks

-- 48 toggle prop sync switch

-- 1 Left Battery toggle
-- 2 Right Battery toggle
-- 3 both batteries on
-- 4 both batteries Off
-- 5 left avionics toggle
-- 6 right avionics toggle
-- 7 both avionics on
-- 8 both avionics off
-- 9 left generator toggle
-- 10 right generator toggle
-- 11 left gen on
-- 12 left gen off
-- 13 right gen on
-- 14 right gen off
-- 15 LEFT Bearing CIRCLE Knob Minus
-- 16 LEFT Bearing CIRLCE Knob Plus
-- 17 LEFT Bearing DIAMOND Knob Plus
-- 18 LEFT Bearing DIAMOND Knob Minus
-- 19 CCT Auto Cycle Switch
-- 20 Pilot analog ADFVOR 1 Toggle
-- 21 Pilot analog ADFVOR 2 Toggle
-- 22 Pilot ADF1
-- 23 Pilot VOR1
-- 24 Pilot VOR2
-- 25 Pilot ADF2
-- 26 Left fuel Pump on
-- 27 Left fuel Pump off
-- 28 right fuel Pump on
-- 29 right fuel Pump off
-- 30 ground power switch toggle
-- 31 warning mute switch toggle
-- 32 NAV Lights ON
-- 33 NAV Lights OFF
-- 34 Console lights ON
-- 35 Console lights OFF
-- 36 TOCW Testswitch ON
-- 37 TOCW Testswitch OFF
-- 38 seat belt ON
-- 39 seat belt off
-- 40 no smoking on
-- 41 no smoking off
-- 42 toggle flood light
-- 43 select engine 1 (LEFT)
-- 44 select engine 2 (RIGHT)
-- 45 unselect engines
-- 46 Feathering and starting selected engine
-- 47 toggle gust locks
-- 48 toggle prop sync switch



-- LEFT Battery switch TOGGLE
if ipcPARAM == 1 then


LVarSet = "L:LeftBatSwitch"
val = 0

if ipc.readLvar(LVarSet) == 0 then
val = 1
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8028)
end



-- RIGHT Battery switch TOGGLE
if ipcPARAM == 2 then


LVarSet = "L:RightBatSwitch"
val = 0

if ipc.readLvar(LVarSet) == 0 then
val = 1
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8028)
end


-- BOTH Battery switch on
if ipcPARAM == 3 then


ipc.writeLvar("L:RightBatSwitch", 1)
ipc.control(66587, 8028)
ipc.sleep(250)
ipc.writeLvar("L:LeftBatSwitch", 1)
ipc.control(66587, 8028)
end


-- BOTH Battery switch off
if ipcPARAM == 4 then


ipc.writeLvar("L:RightBatSwitch", 0)
ipc.control(66587, 8028)
ipc.sleep(250)
ipc.writeLvar("L:LeftBatSwitch", 0)
ipc.control(66587, 8028)
end




-- Left AVIONICS SWITCh TOGGLE
if ipcPARAM == 5 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)

end



-- RIGHT AVIONICS SWITCh TOGGLE
if ipcPARAM == 6 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)

end




-- both AVIONICS SWITCh on
if ipcPARAM == 7 then


ipc.writeLvar("L:RightAvionicsMasterGuard", 1)
ipc.control(66587, 8026)
ipc.sleep(400)
ipc.writeLvar("L:RightAvionicsMaster", 1)
ipc.control(66587, 8027)
ipc.sleep(100)


ipc.writeLvar("L:LeftAvionicsMasterGuard", 1)
ipc.control(66587, 8026)
ipc.sleep(400)
ipc.writeLvar("L:LeftAvionicsMaster", 1)
ipc.control(66587, 8027)

end


-- both AVIONICS SWITCh off
if ipcPARAM == 8 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)

end



-- LEFT Generator SWITCH TOGGLE
if ipcPARAM == 9 then


LVarSet = "L:LeftGenSwitch"
val = 1

if ipc.readLvar(LVarSet) == 1 then
val = 2
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8027)

end


-- right Generator SWITCH TOGGLE
if ipcPARAM == 10 then


LVarSet = "L:RightGenSwitch"
val = 1

if ipc.readLvar(LVarSet) == 1 then
val = 2
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8027)

end


-- left Generator SWITCH on
if ipcPARAM == 11 then


ipc.writeLvar("L:LeftGenSwitch", 2)
ipc.control(66587, 8027)

end

-- left Generator SWITCH off
if ipcPARAM == 12 then


ipc.writeLvar("L:LeftGenSwitch", 1)
ipc.control(66587, 8027)

end



-- right Generator SWITCH on
if ipcPARAM == 13 then


ipc.writeLvar("L:RightGenSwitch", 2)
ipc.control(66587, 8027)

end

-- right Generator SWITCH off
if ipcPARAM == 14 then


ipc.writeLvar("L:RightGenSwitch", 1)
ipc.control(66587, 8027)

end






-- LEFT Bearing CIRCLE Knob Minus
if ipcPARAM == 15 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
end

-- LEFT Bearing CIRLCE Knob Plus
if ipcPARAM == 16 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
end

-- LEFT Bearing DIAMOND Knob Plus
if ipcPARAM == 17 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
end


-- LEFT Bearing DIAMOND Knob Minus
if ipcPARAM == 18 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

end


-- CCT Auto Cycle Switch
if ipcPARAM == 19 then

ipc.writeLvar("L:AutoAnticeCycle", 2)
ipc.control(66587, 8028)

ipc.sleep(200)
ipc.writeLvar("L:AutoAnticeCycle", 1)
ipc.control(66587, 8027)


end


-- Pilot analog ADFVOR 1 Toggle
if ipcPARAM == 20 then


LVarSet = "L:LeftAdfVorSwitch"
val = 1

if ipc.readLvar(LVarSet) == 1 then
val = 2
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8024)

end



-- Pilot analog ADFVOR 2 Toggle
if ipcPARAM == 21 then

LVarSet = "L:LeftVorAdfSwitch"
val = 1

if ipc.readLvar(LVarSet) == 1 then
val = 2
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8024)

end



-- Pilot ADF1
if ipcPARAM == 22 then

ipc.writeLvar("L:LeftAdfVorSwitch", 0)
ipc.control(66587, 8024)
end




-- Pilot VOR1
if ipcPARAM == 23 then

ipc.writeLvar("L:LeftAdfVorSwitch", 1)
ipc.control(66587, 8024)

end



-- Pilot ADF2
if ipcPARAM == 24 then

ipc.writeLvar("L:LeftVorAdfSwitch", 0)
ipc.control(66587, 8024)

end



-- Pilot VOR2
if ipcPARAM == 25 then

ipc.writeLvar("L:LeftVorAdfSwitch", 1)
ipc.control(66587, 8024)
end




-- Left fuel Pump on
if ipcPARAM == 26 then

ipc.writeLvar("L:LeftStbyFuelPump", 1)
ipc.control(66587, 8028)
end

-- Left fuel Pump off
if ipcPARAM == 27 then

ipc.writeLvar("L:LeftStbyFuelPump", 0)
ipc.control(66587, 8027)
end

-- right fuel Pump on
if ipcPARAM == 28 then

ipc.writeLvar("L:RightStbyFuelPump", 1)
ipc.control(66587, 8028)
end

-- right fuel Pump off
if ipcPARAM == 29 then

ipc.writeLvar("L:RightStbyFuelPump", 0)
ipc.control(66587, 8027)
end


--Ground power switch toggle
if ipcPARAM == 30 then

LVarSet = "L:GndPowerSwitch"
val = 0

if ipc.readLvar(LVarSet) == 0 then
val = 1
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 8027)

end


--warning mute switch toggle
if ipcPARAM == 31 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)

end


-- NAV Lights ON
if ipcPARAM == 32 then

ipc.writeLvar("L:NavLightSwitch", 2)
ipc.control(66587, 8028)

end


-- NAV Lights OFF
if ipcPARAM == 33 then

ipc.writeLvar("L:NavLightSwitch", 1)
ipc.control(66587, 8028)

end


-- Console lights ON
if ipcPARAM == 34 then

ipc.control(66056)
ipc.writeLvar("L:InstrConsolesLightSwitch", 1)
ipc.writeLvar("L:InstrRoofLightSwitch", 1)
ipc.writeLvar("L:InstrGlareshieldLightSwitch", 1)
ipc.control(66587, 8031)
end


-- Console lights OFF
if ipcPARAM == 35 then

ipc.control(66057)
ipc.writeLvar("L:InstrConsolesLightSwitch", 0)
ipc.writeLvar("L:InstrRoofLightSwitch", 0)
ipc.writeLvar("L:InstrGlareshieldLightSwitch", 0)
ipc.control(66587, 8031)

end

-- TOCW Testswitch ON
if ipcPARAM == 36 then

ipc.control(66587, 8021)
ipc.writeLvar("L:TocwTestSwitch", 1)

end

-- TOCW Testswitch OFF
if ipcPARAM == 37 then

ipc.control(66587, 8021)
ipc.writeLvar("L:TocwTestSwitch", 0)
end

-- Seatbelt on
if ipcPARAM == 38 then

ipc.writeLvar("L:FastenSeatbeltSigns", 1)
ipc.control(66587, 8028)
ipc.sleep(10)
ipc.control(66587, 74)

end


-- Seatbelt off
if ipcPARAM == 39 then

ipc.writeLvar("L:FastenSeatbeltSigns", 0)
ipc.control(66587, 8028)
ipc.sleep(10)
ipc.control(66587, 74)

end


-- no smoking on
if ipcPARAM == 40 then

ipc.writeLvar("L:NoSmokingSigns", 1)
ipc.control(66587, 8028)
ipc.sleep(10)
ipc.control(66587, 74)

end


-- no skmoking off
if ipcPARAM == 41 then

ipc.writeLvar("L:NoSmokingSigns", 0)
ipc.control(66587, 8028)
ipc.sleep(10)
ipc.control(66587, 74)

end


-- toggle flood light
if ipcPARAM == 42 then


ipc.control(66587, 8028)
ipc.sleep(10)
ipc.control(66376)

end








-- select engine 1 (LEFT)
if ipcPARAM == 43 then
ipc.sleep(10)

ipc.writeLvar("L:StartMasterKnob", 0)
end



-- select engine 2 (RIGHT)
if ipcPARAM == 44 then
ipc.sleep(10)

ipc.writeLvar("L:StartMasterKnob", 2)

end




-- unselect engines
if ipcPARAM == 45 then
ipc.sleep(10)

ipc.writeLvar("L:StartMasterKnob", 1)

end



-- Feathering and starting selected engine -----------------
if ipcPARAM == 46 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

ipc.display("")



-- 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)

end

ipc.display("")

end
--------------------------------------------------------------


-- toggle gust locks
if ipcPARAM == 47 then

LVarSet = "L:GustLocks"
val = 0

if ipc.readLvar(LVarSet) == 0 then
val = 1
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, 141)

end


-- toggle prop sync switch
if ipcPARAM == 48 then

LVarSet = "L:PropSync"
val = 0
sval = 8027

if ipc.readLvar(LVarSet) == 0 then
val = 1
sval = 8028
end

ipc.writeLvar(LVarSet, val)
ipc.control(66587, sval)

end


MACRO

[Macros]



1=L:GrndSpoilersSwitch=TOG


2=Left feather
2.1=C66587, 1420
2.2=C66587, 8029

3=right feather
3.1=C66587, 1421
3.2=C66587, 8029

4=LNAV Zoom +
4.1=C66587, 4940
4.2=C66587, 8031

5=LNAV Zoom -
5.1=C66587, 4930
5.2=C66587, 8031


6=AP_HDG plus
6.1=C66587, 26902
6.2=C66587, 8031

7=AP_HDG minus
7.1=C66587, 26901
7.2=C66587, 8031

8=AP_HDG press
8.1=C66587, 2691
8.2=C66587, 8031


9=AP_Alt plus
9.1=C66587, 3921
9.2=C66587, 8031

10=AP_Alt minus
10.1=C66587, 3920
10.2=C66587, 8031



11=AP_CRS plus
11.1=C66587, 26702
11.2=C66587, 8031

12=AP_CRS minus
12.1=C66587, 26701
12.2=C66587, 8031

13=AP_CRS press
13.1=C66587, 2672
13.2=C66587, 8031


14=AP_IAS plus
14.1=C66587, 26802
14.2=C66587, 8031

15=AP_IAS minus
15.1=C66587, 26801
15.2=C66587, 8031

16=AP_IAS press
16.1=C66587, 2681
16.2=C66587, 8031

17=AP_ALT
17.1=C66587, 281
17.2=C66587, 8031

18=AP_ALTarm
18.1=C66587, 282
18.2=C66587, 8031

19=AP_VS
19.1=C66587, 283
19.2=C66587, 8031

20=AP_IAS
20.1=C66587, 284
20.2=C66587, 8031

21=AP_HDG
21.1=C66587, 277
21.2=C66587, 8031

22=AP_NAV
22.1=C66587, 278
22.2=C66587, 8031

23=AP_APPR
23.1=C66587, 279
23.2=C66587, 8031

24=AP_BC
24.1=C66587, 280
24.2=C66587, 8031

25=EFIS1_Full/Map
25.1=C66587, 214
25.2=C66587, 8038

26=EFIS1_TCAS
26.1=C66587, 215
26.2=C66587, 8038

27=EFIS1_GSPD/TTG
27.1=C66587, 217
27.2=C66587, 8038

28=EFIS1_ET
28.1=C66587, 218
28.2=C66587, 8038

29=EFIS1_V/L
29.1=C66587, 21901
29.2=C66587, 8038

30=EFIS1_LNAV
30.1=C66587, 21910
30.2=C66587, 8038

31=FMS_Enter
31.1=C66587, 3610
31.2=C66587, 8030

32=FMS_DirectTo
32.1=C66587, 3220
32.2=C66587, 8030

33=FMS_Prev
33.1=C66587, 3200
33.2=C66587, 8030

34=FMS_Next
34.1=C66587, 3210
34.2=C66587, 8030

35=FMS_NAV
35.1=C66587, 3470
35.2=C66587, 8030

36=FMS_VNAV
36.1=C66587, 3480
36.2=C66587, 8030

37=FMS_FPL
37.1=C66587, 3500
37.2=C66587, 8030

38=FMS_Plan
38.1=C66587, 3540
38.2=C66587, 8030

39=FMS_HDG
39.1=C66587, 3550
39.2=C66587, 8030

40=FMS_Tune
40.1=C66587, 3560
40.2=C66587, 8030

41=FMS_Back
41.1=C66587, 3460
41.2=C66587, 8030

J41 cold and dark LUA

Assign this LUA to a key or button.

Pressing this button will set the J41 to cold and dark

(don't use it during flight :lol: )

This cold and dark file was initially from William Ruppel, reworked by me and also with codes from Tom Risager, and Richard Cooke

(A worldwide project - far better then airbus isn't it :D )

--
-- FSUIPC4 Lua Script: PMDG JS4100 Cold and Dark
--
--
-- AUTHOR
--  William Ruppel, Guenter Steiner
--  wcruppel@rogers.com
--
-- VERSION
--   1.2 
--
-- INSTALLATION INSTRUCTIONS
--   1) Must have a resistered copy of FSUIPC4
--   2) Copy this file to the FSX Modules directory
--   3) Open FSUIPC4.INI
--   4) Add a line to the [LuaFiles] section. Example:
--        [LuaFiles]
--        1=PMDG_JS41_CD
--   5) Start FSX, go to FSUIPC, and assign the script to a keypress or mouse button
--
-- CHANGE HISTORY
--
--   Name            Date         What
--   ----            -----------  ----
--   William Ruppel  10-Dec-2009  Collected scripts by Guenter Steiner, Tom Risager, and Richard Cooke. Thanks boys!
--   William Ruppel  14-Feb-2010  Add mute button and start latches on engine shutdown
--
--   Guenter Steiner  18-Feb-2010 Added Dialog window, added prop sync switch, added gust lock, fixed engine-won't-start-at-first-time-error
--   Guenter Steiner  05-Aug-2010 Added LUA question dialog



ipc.sleep(100)

ipc.display("Cold&Dark Sequence initiated...")
ipc.sleep(3000)





	questvar = ipc.ask("Captain, do you want to go cold&dark? (y / n)")

	if questvar == "y" then





ipc.display ("Please wait, going Cold and Dark!")
ipc.sleep(1000)
ipc.display ("Please wait, going Cold and Dark!n Mute Button:")

-- MUTE button ON

    if ipc.readLvar("L:CapMuted") == 0 then
       ipc.writeLvar("L:CapMuteSwitch", 1)
       ipc.control(66587,8031)
       ipc.writeLvar("L:CapMuted", 1)
       ipc.sleep(200)
       ipc.writeLvar("L:CapMuteSwitch", 0)
       ipc.control(66587,8031)
    end

ipc.display ("Please wait, going Cold and Dark!n Mute Button: set")

ipc.sleep(200)



-- RIGHT Engine OFF

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF:")

    -- 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)

    -- Move the throttle to full reverse for start latch
    ipc.control (65972)
    for i = 1, 50 do
       ipc.control (65971)
    end
    ipc.sleep(5000)
    ipc.control (65972)

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: set")

ipc.sleep(200)

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF:")


-- LEFT Engine OFF

    -- 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)

    -- Move the throttle to full reverse for start latch
    ipc.control (65967)
    for i = 1, 50 do
       ipc.control (65966)
    end
    ipc.sleep(5000)
    ipc.control (65967)


ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: set")

ipc.sleep(200)

-- LEFT Generator Switch OFF

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches:")


    LGen = ipc.readLvar("L:LeftGenSwitch")
    if LGen == 2 then
       ipc.writeLvar("L:LeftGenSwitch", 1)
       ipc.control(66587, 8027)
    end


ipc.sleep(200)

-- RIGHT Generator Switch OFF


    RGen = ipc.readLvar("L:RightGenSwitch")
    if RGen == 2 then
       ipc.writeLvar("L:RightGenSwitch", 1)
       ipc.control(66587, 8027)
    end

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: set")

ipc.sleep(200)

-- LEFT Battery Switch OFF

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches:")

    LBat = ipc.readLvar("L:LeftBatSwitch")
    if LBat == 1 then
       ipc.writeLvar("L:LeftBatSwitch", 0)
       ipc.control(66587, 8028)
    end

ipc.sleep(200)

-- Right Battery Switch OFF

    RBat = ipc.readLvar("L:RightBatSwitch")
    if RBat == 1 then
       ipc.writeLvar("L:RightBatSwitch", 0)
       ipc.control(66587, 8028)
    end

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: set")

ipc.sleep(200)

-- Left Avionics Switch OFF

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches:")

    LAvM = ipc.readLvar("L:LeftAvionicsMaster")
    if LAvM == 1 then
       ipc.writeLvar("L:LeftAvionicsMasterGuard", 0)
       ipc.control(66587, 8026)
       ipc.sleep(500)
       ipc.writeLvar("L:LeftAvionicsMaster", 0)
       ipc.control(66587, 8027)
    end

ipc.sleep(200)

-- RIGHT Avionics Switch OFF

    RAvM = ipc.readLvar("L:RightAvionicsMaster")
    if RAvM == 1 then
       ipc.writeLvar("L:RightAvionicsMasterGuard", 0)
       ipc.control(66587, 8026)
       ipc.sleep(500)
       ipc.writeLvar("L:RightAvionicsMaster", 0)
       ipc.control(66587, 8027)
    end

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: set")

ipc.sleep(100)

-- LEFT Fuel Pump Switch OFF

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches:")

    LFuel = ipc.readLvar("L:LeftStbyFuelPump")
    if LFuel == 1 then
       ipc.writeLvar("L:LeftStbyFuelPump", 0)
       ipc.control(66587, 8027)
    end

ipc.sleep(250)

-- RIGHT Fuel Pump Switch OFF

    RFuel = ipc.readLvar("L:RightStbyFuelPump")
    if RFuel == 1 then
       ipc.writeLvar("L:RightStbyFuelPump", 0)
       ipc.control(66587, 8027)
    end

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: set")


ipc.sleep(200)



-- DC Power Source Knob OFF

    DCP = ipc.readLvar("L:DCPowerSourceKnob")
    if DCP >= 1 then
       ipc.writeLvar("L:DCPowerSourceKnob", 0)
       ipc.control(66587, 8039)
    end

ipc.sleep(200)


-- Beacon OFF

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs:")

   BCN = logic.And(ipc.readUW(0x0D0C), 0x2)
   if BCN ~= 0 then
      ipc.control(66239)
      ipc.control(66587,8027)
   end

ipc.sleep(200)


-- NAV Lights OFF

	ipc.writeLvar("L:NavLightSwitch", 1)
	ipc.control(66587, 8028)



ipc.sleep(300)


-- Console lights OFF

	ipc.control(66057)
	ipc.writeLvar("L:InstrConsolesLightSwitch", 0)
	ipc.writeLvar("L:InstrRoofLightSwitch", 0)
	ipc.writeLvar("L:InstrGlareshieldLightSwitch", 0)
	ipc.control(66587, 8031)



ipc.sleep(200)


-- Seatbelt off

ipc.writeLvar("L:FastenSeatbeltSigns", 0)
        ipc.control(66587, 8028)
	ipc.sleep(10)
        ipc.control(66587, 74)


ipc.sleep(200)


-- no skmoking off

ipc.writeLvar("L:NoSmokingSigns", 0)
        ipc.control(66587, 8028)
	ipc.sleep(10)
        ipc.control(66587, 74)



ipc.sleep(250)


-- Left Windshield Antiice OFF

   LWS = ipc.readLvar("L:LeftWSAntice")
   if (LWS == 2 or LWS == 0) then
      ipc.writeLvar("L:LeftWSAntice",1)
      ipc.control(66587,8027)
   end

ipc.sleep(200)


-- Right Windshield Antiice OFF

   RWS = ipc.readLvar("L:RightWSAntice")
   if RWS == 1 then
      ipc.writeLvar("L:RightWSAntice",0)
      ipc.control(66587,8027)
   end

ipc.sleep(200)


-- Left Air Data OFF

   LAD = ipc.readLvar("L:LeftAirData")

   if LAD == 1 then
      ipc.writeLvar("L:LeftAirData",0)
      ipc.control(66587,8027)
   end

ipc.sleep(150)



-- Right Air Data OFF

   RAD = ipc.readLvar("L:RightAirData")

   if RAD == 1 then
      ipc.writeLvar("L:RightAirData",0)
      ipc.control(66587,8027)
   end

ipc.sleep(200)


-- prop sync switch OFF

    ipc.writeLvar("L:PropSync", 0)
	ipc.control(66587, 8027)


ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: set")

ipc.sleep(200)




-- Move Yokes to Lower Position

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: setn Move Yokes:")

   ipc.writeLvar("L:CPYokeUpDown", 1)
   ipc.writeLvar("L:PICYokeUpDown", 1)

ipc.sleep(200)

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: setn Move Yokes: set")

ipc.sleep(200)


ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: setn Move Yokes: setn Gust Locks:")

-- Gust Locks
ipc.writeLvar("L:GustLocks", 1)
ipc.control(66587, 141)

ipc.sleep(200)


ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: setn Move Yokes: setn Gust Locks: set")

ipc.sleep(200)


ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: setn Move Yokes: setn Gust Locks: setn Condition levers:")

-- Condition levers taxi
ipc.control(66291, -16384)

ipc.sleep(200)

ipc.display ("Please wait, going Cold and Dark!n Mute Button: setn RIGHT engine OFF: setn LEFT Engine OFF: setn Generator Switches: setn Battery Switches: setn Avionic Switches: setn Fuel Pump Switches: setn Lights and signs: setn Move Yokes: setn Gust Locks: setn Condition levers: taxi")

ipc.sleep(500)


ipc.display("cold & dark READY!n Thanks for your patience, Captain!")
ipc.sleep(2500)
ipc.display ("")





	elseif questvar ~= "y" then

	ipc.display("Ok, was just a question, Sir!nHave a nice day...")

	ipc.sleep(3000)

	end


ipc.display("")


The following is from Richard Cooke:

(many thanks for this)

--------------

I first posted this on the PMDG/Turboprops forum. Guenter suggested I post it here as well - so here goes.

Inspired by the excellent work of Guenter Steiner I have written another Lua file for the PMDG J41. See Guenter's post here for instructions on how to use this. (Of course it only works with a registered copy of FSUIPC)

<!-- l --><a class="postlink-local" href="http://forums.simflight.com/viewtopic.php?f=54&t=78339">viewtopic.php?f=54&t=78339</a><!-- l -->

You need to call this something different to Guenter's file. I called mine J41_Add.lua. It should give you the following commands:

1 Left Fuel Pump

2 Right Fuel Pump

3 Ground Power

4 Warning Panel mute

5 Left Air Cabin Flow*

6 Right Air Cabin Flow*

7 Start Master Knob Left

8 Start Master Knob Right

9 Nav Lights

10 Nav/Tail Flood lights

11Seat Belt Signs

12 No Smoking Signs

13 Left Windshield Anti Ice

14 Right Windshield Anti Ice

15 Left Air Data Anti Ice

16 Right Air Data Anti Ice

17 DC Power Knob up

18 DC Power knob down

19 Prop Synchro Knob

20 CCT Auto Cycle Switch

*I programmed the cabin air switches so they only work if they are set to 5 or off so they toggle between these two values.

Here is the lua file

    -- LEFT Fuel Pump SWITCH TOGGLE
    if ipcPARAM == 1 then


    LFuel = ipc.readLvar("L:LeftStbyFuelPump")

    if LFuel == 1 then
    ipc.writeLvar("L:LeftStbyFuelPump", 0)
    ipc.control(66587, 8027)

    elseif LFuel == 0 then
    ipc.writeLvar("L:LeftStbyFuelPump", 1)
    ipc.control(66587, 8028)

    end


    -- RIGHT Fuel Pump SWITCH TOGGLE
    elseif ipcPARAM == 2 then

    RFuel = ipc.readLvar("L:RightStbyFuelPump")

    if RFuel == 1 then
    ipc.writeLvar("L:RightStbyFuelPump",0)
    ipc.control(66587, 8027)

    elseif RFuel == 0 then
    ipc.writeLvar("L:RightStbyFuelPump", 1)
    ipc.control(66587, 8028)

    end

    -- GROUND POWER SWITCH TOGGLE
    elseif ipcPARAM == 3 then

    GPwr = ipc.readLvar("L:GndPowerSwitch")

    if GPwr == 1 then
    ipc.writeLvar("L:GndPowerSwitch", 0)
    ipc.control(66587, 8028)

    elseif GPwr == 0 then
    ipc.writeLvar("L:GndPowerSwitch", 1)
    ipc.control(66587, 8027)

    end

    -- Warning Panel Mute SWITCH TOGGLE
    elseif ipcPARAM == 4 then

    WarnMute = ipc.readLvar("L:CapMuted")

    if WarnMute  == 1 then
    ipc.writeLvar("L:CapMuted", 0)
    ipc.control(66587, 8027)
    ipc.writeLvar("L:CapMuteSwitch", 0)
    ipc.control(66587, 8027)


    elseif WarnMute  == 0 then
    ipc.writeLvar("L:CapMuted", 1)
    ipc.writeLvar("L:CapMuteSwitch", 1)
    ipc.control(66587, 8027)
    end

    -- LEFT CABIN FLOW SWITCH TOGGLE
    elseif ipcPARAM == 5 then

    LCabFlw = ipc.readLvar("L:CabinFlowControl")

    if LCabFlw== 6 then
    ipc.writeLvar("L:CabinFlowControl", 0)
    ipc.control(66587, 8027)


    elseif LCabFlw == 0 then
    ipc.writeLvar("L:CabinFlowControl", 6)
    ipc.control(66587, 8027)
    end

    -- RIGHT CABIN FLOW SWITCH TOGGLE
    elseif ipcPARAM == 6 then

    RCabFlw = ipc.readLvar("L:FDeckFlowControl")

    if RCabFlw== 6 then
    ipc.writeLvar("L:FDeckFlowControl", 0)
    ipc.control(66587, 8027)


    elseif RCabFlw == 0 then
    ipc.writeLvar("L:FDeckFlowControl", 6)
    ipc.control(66587, 8027)
    end

    -- START MASTER KNOB LEFT GROUND
    elseif ipcPARAM == 7 then

    LStart = ipc.readLvar("L:StartMasterKnob")

    if LStart &gt; 0 then
    ipc.writeLvar("L:StartMasterKnob",0)
    ipc.control(66587, 8028)

    elseif LStart == 0 then
    end

    -- START MASTER KNOB RIGHT GROUND
    elseif ipcPARAM == 8 then

    LStart = ipc.readLvar("L:StartMasterKnob")

    if LStart &lt; 2 then
    ipc.writeLvar("L:StartMasterKnob",2)
    ipc.control(66587, 8028)

    elseif LStart == 2 then
    end

    -- NAV LIGHTS TOGGLE
    elseif ipcPARAM == 9 then

    NavLt = ipc.readLvar("L:NavLightSwitch")

    if NavLt &lt; 2 then
    ipc.writeLvar("L:NavLightSwitch", 2)
    ipc.control(66587, 8027)

    elseif NavLt  == 2 then
    ipc.writeLvar("L:NavLightSwitch", 1)
    ipc.control(66587, 8028)
    end

    -- NAV LIGHTS/TAIL FLOODS TOGGLE
    elseif ipcPARAM == 10 then

    NavLt = ipc.readLvar("L:NavLightSwitch")

    if NavLt &gt; 0 then
    ipc.writeLvar("L:NavLightSwitch", 0)
    ipc.control(66587, 8027)

    elseif NavLt  == 0 then
    ipc.writeLvar("L:NavLightSwitch", 1)
    ipc.control(66587, 8028)
    end

    -- SEAT BELT switch TOGGLE
    elseif ipcPARAM == 11 then
    sblt = ipc.readLvar("L:FastenSeatbeltSigns")

    if sblt == 1 then
    ipc.writeLvar("L:FastenSeatbeltSigns", 0)
    ipc.control(66587, 8028)
    ipc.control(66587, 74)

    elseif sblt == 0 then
    ipc.writeLvar("L:FastenSeatbeltSigns", 1)
    ipc.control(66587, 8027)
    ipc.control(66587, 74)

    end

    -- NO SMOKING SWITCH TOGGLE
    elseif ipcPARAM == 12 then
    nsmk = ipc.readLvar("L:NoSmokingSigns")

    if nsmk == 1 then
    ipc.writeLvar("L:NoSmokingSigns", 0)
    ipc.control(66587, 8028)
    ipc.control(66587, 74)

    elseif nsmk == 0 then
    ipc.writeLvar("L:NoSmokingSigns", 1)
    ipc.control(66587, 8027)
    ipc.control(66587, 74)

    end

    -- Left Windshield Antiice off
    elseif ipcPARAM == 13 then

    LWS = ipc.readLvar("L:LeftWSAntice")

    if LWS == 2  then
    ipc.writeLvar("L:LeftWSAntice",1)
    ipc.control(66587,8027)

    elseif LWS == 1 then
    ipc.writeLvar("L:LeftWSAntice", 2)
    ipc.control(66587,8028)
    end

    -- Right Windshield Antiice off
    elseif ipcPARAM == 14 then

    RWS = ipc.readLvar("L:RightWSAntice")

    if RWS == 1 then
    ipc.writeLvar("L:RightWSAntice",0)
    ipc.control(66587,8027)

    elseif RWS == 0 then
    ipc.writeLvar("L:RightWSAntice", 1)
    ipc.control(66587,8028)
    end

    -- Left Air Data off
    elseif ipcPARAM == 15 then

    LAD = ipc.readLvar("L:LeftAirData")

    if LAD == 1 then
    ipc.writeLvar("L:LeftAirData",0)
    ipc.control(66587,8027)

    elseif LAD == 0 then
    ipc.writeLvar("L:LeftAirData", 1)
    ipc.control(66587,8028)
    end

    -- Right Air Data off
    elseif ipcPARAM == 16 then

    RAD = ipc.readLvar("L:RightAirData")

    if RAD == 1 then
    ipc.writeLvar("L:RightAirData",0)
    ipc.control(66587,8027)

    elseif RAD == 0 then
    ipc.writeLvar("L:RightAirData", 1)
    ipc.control(66587,8028)
    end

    -- DC PowersourceKnob UP
    elseif ipcPARAM == 17 then

    DCP = ipc.readLvar("L:DCPowerSourceKnob")

    if DCP &lt; 3 then
    ipc.writeLvar("L:DCPowerSourceKnob", DCP+1)
    ipc.control(66587, 8039)

    elseif DCP == 3 then
    end

    -- DC PowersourceKnob DOWN
    elseif ipcPARAM == 18 then

    DCP = ipc.readLvar("L:DCPowerSourceKnob")

    if DCP &gt; 0 then
    ipc.writeLvar("L:DCPowerSourceKnob", DCP-1)
    ipc.control(66587, 8039)

    elseif DCP ==0 then
    end

    -- PROP SYNC SWITCH TOGGLE
    if ipcPARAM == 19 then


    PSync = ipc.readLvar("L:PropSync")

    if PSync == 1 then
    ipc.writeLvar("L:PropSync", 0)
    ipc.control(66587, 8027)

    elseif PSync== 0 then
    ipc.writeLvar("L:PropSync", 1)
    ipc.control(66587, 8028)

    end

    -- CCT Auto Cycle Switch
    elseif ipcPARAM == 20 then

    ipc.writeLvar("L:AutoAnticeCycle", 2)
    ipc.control(66587, 8028)

    ipc.sleep(200)
    ipc.writeLvar("L:AutoAnticeCycle", 1)
    ipc.control(66587, 8027)

    end

I hope this helps you to get more "hardware" control of the brilliant J41.

Richard Cooke

-------------------------------

All files work at my system with latest FSUIPC version.

no guarantee that they will work for you (but they should, I'm sure - tested only at FSX Acceleration)

Do any codings at your own risk and just do things if you know what you do...

Be patient that I could not support any question. Please inform yourself how to handle MACROS and LUA files and the power of FSUIPC.

Have fun!

Link to comment
Share on other sites

HI guenseli

I've tried to load the LUA files as you described in your last message

but I can't find the file LUAj41 in the list of lua on right screen listin FSPUIC

I followed point by point your procedure with no results :(

I seems this list is already preloaded...

Logically, to be red, this file (lua j41) must be in modules folder? Isn't right?

but no way to find it in that right screen in FSUIPC.(page button and switches)

Could you help me please?

It will be so useful to only push a joystick button to load a dark and cold situation

for the excellent J41!!!

Thanks a lot by advance to take some time for me

Hope my message request is clear

sorry for my bad english :?

Phil

papalimabravo@wanadoo.fr

Link to comment
Share on other sites

no need to sorry about your english, mine isn't better :D

Have you pressed "relaod buttons" or/and "reload keys" in FSUIPC menu after making and saving a LUA file into modules folder?

Have you scrolled down to the section were the LUA files begin in FSUIPC key/button assigning pull down menu?

A file called example.lua is find as "LUA Example" in FSUIPC pull down menu...

Link to comment
Share on other sites

  • 2 weeks later...

Well...just my luck :cry:

I can't seem to get this to work. I own the PMDG JS4100. I have an official FSUIPC v 4.53(which is the latest). I use the VRinsight MCP-Combi with SerialFP2 v2.520 and a Goflight T8.

I can get the HDG, ALT bugs working, but none of the items listed here react in the SIM.

I used Richard Cooke's and your LUA an MACRO and linked it to my FSUIPC but nothing works.

Screenshot:

full.jpg

My J41.LUA file:

    -- LEFT Fuel Pump SWITCH TOGGLE
    if ipcPARAM == 1 then


    LFuel = ipc.readLvar("L:LeftStbyFuelPump")

    if LFuel == 1 then
    ipc.writeLvar("L:LeftStbyFuelPump", 0)
    ipc.control(66587, 8027)

    elseif LFuel == 0 then
    ipc.writeLvar("L:LeftStbyFuelPump", 1)
    ipc.control(66587, 8028)

    end


    -- RIGHT Fuel Pump SWITCH TOGGLE
    elseif ipcPARAM == 2 then

    RFuel = ipc.readLvar("L:RightStbyFuelPump")

    if RFuel == 1 then
    ipc.writeLvar("L:RightStbyFuelPump",0)
    ipc.control(66587, 8027)

    elseif RFuel == 0 then
    ipc.writeLvar("L:RightStbyFuelPump", 1)
    ipc.control(66587, 8028)

    end

    -- GROUND POWER SWITCH TOGGLE
    elseif ipcPARAM == 3 then

    GPwr = ipc.readLvar("L:GndPowerSwitch")

    if GPwr == 1 then
    ipc.writeLvar("L:GndPowerSwitch", 0)
    ipc.control(66587, 8028)

    elseif GPwr == 0 then
    ipc.writeLvar("L:GndPowerSwitch", 1)
    ipc.control(66587, 8027)

    end

    -- Warning Panel Mute SWITCH TOGGLE
    elseif ipcPARAM == 4 then

    WarnMute = ipc.readLvar("L:CapMuted")

    if WarnMute  == 1 then
    ipc.writeLvar("L:CapMuted", 0)
    ipc.control(66587, 8027)
    ipc.writeLvar("L:CapMuteSwitch", 0)
    ipc.control(66587, 8027)


    elseif WarnMute  == 0 then
    ipc.writeLvar("L:CapMuted", 1)
    ipc.writeLvar("L:CapMuteSwitch", 1)
    ipc.control(66587, 8027)
    end

    -- LEFT CABIN FLOW SWITCH TOGGLE
    elseif ipcPARAM == 5 then

    LCabFlw = ipc.readLvar("L:CabinFlowControl")

    if LCabFlw== 6 then
    ipc.writeLvar("L:CabinFlowControl", 0)
    ipc.control(66587, 8027)


    elseif LCabFlw == 0 then
    ipc.writeLvar("L:CabinFlowControl", 6)
    ipc.control(66587, 8027)
    end

    -- RIGHT CABIN FLOW SWITCH TOGGLE
    elseif ipcPARAM == 6 then

    RCabFlw = ipc.readLvar("L:FDeckFlowControl")

    if RCabFlw== 6 then
    ipc.writeLvar("L:FDeckFlowControl", 0)
    ipc.control(66587, 8027)


    elseif RCabFlw == 0 then
    ipc.writeLvar("L:FDeckFlowControl", 6)
    ipc.control(66587, 8027)
    end

    -- START MASTER KNOB LEFT GROUND
    elseif ipcPARAM == 7 then

    LStart = ipc.readLvar("L:StartMasterKnob")

    if LStart &gt; 0 then
    ipc.writeLvar("L:StartMasterKnob",0)
    ipc.control(66587, 8028)

    elseif LStart == 0 then
    end

    -- START MASTER KNOB RIGHT GROUND
    elseif ipcPARAM == 8 then

    LStart = ipc.readLvar("L:StartMasterKnob")

    if LStart &lt; 2 then
    ipc.writeLvar("L:StartMasterKnob",2)
    ipc.control(66587, 8028)

    elseif LStart == 2 then
    end

    -- NAV LIGHTS TOGGLE
    elseif ipcPARAM == 9 then

    NavLt = ipc.readLvar("L:NavLightSwitch")

    if NavLt &lt; 2 then
    ipc.writeLvar("L:NavLightSwitch", 2)
    ipc.control(66587, 8027)

    elseif NavLt  == 2 then
    ipc.writeLvar("L:NavLightSwitch", 1)
    ipc.control(66587, 8028)
    end

    -- NAV LIGHTS/TAIL FLOODS TOGGLE
    elseif ipcPARAM == 10 then

    NavLt = ipc.readLvar("L:NavLightSwitch")

    if NavLt &gt; 0 then
    ipc.writeLvar("L:NavLightSwitch", 0)
    ipc.control(66587, 8027)

    elseif NavLt  == 0 then
    ipc.writeLvar("L:NavLightSwitch", 1)
    ipc.control(66587, 8028)
    end

    -- SEAT BELT switch TOGGLE
    elseif ipcPARAM == 11 then
    sblt = ipc.readLvar("L:FastenSeatbeltSigns")

    if sblt == 1 then
    ipc.writeLvar("L:FastenSeatbeltSigns", 0)
    ipc.control(66587, 8028)
    ipc.control(66587, 74)

    elseif sblt == 0 then
    ipc.writeLvar("L:FastenSeatbeltSigns", 1)
    ipc.control(66587, 8027)
    ipc.control(66587, 74)

    end

    -- NO SMOKING SWITCH TOGGLE
    elseif ipcPARAM == 12 then
    nsmk = ipc.readLvar("L:NoSmokingSigns")

    if nsmk == 1 then
    ipc.writeLvar("L:NoSmokingSigns", 0)
    ipc.control(66587, 8028)
    ipc.control(66587, 74)

    elseif nsmk == 0 then
    ipc.writeLvar("L:NoSmokingSigns", 1)
    ipc.control(66587, 8027)
    ipc.control(66587, 74)

    end

    -- Left Windshield Antiice off
    elseif ipcPARAM == 13 then

    LWS = ipc.readLvar("L:LeftWSAntice")

    if LWS == 2  then
    ipc.writeLvar("L:LeftWSAntice",1)
    ipc.control(66587,8027)

    elseif LWS == 1 then
    ipc.writeLvar("L:LeftWSAntice", 2)
    ipc.control(66587,8028)
    end

    -- Right Windshield Antiice off
    elseif ipcPARAM == 14 then

    RWS = ipc.readLvar("L:RightWSAntice")

    if RWS == 1 then
    ipc.writeLvar("L:RightWSAntice",0)
    ipc.control(66587,8027)

    elseif RWS == 0 then
    ipc.writeLvar("L:RightWSAntice", 1)
    ipc.control(66587,8028)
    end

    -- Left Air Data off
    elseif ipcPARAM == 15 then

    LAD = ipc.readLvar("L:LeftAirData")

    if LAD == 1 then
    ipc.writeLvar("L:LeftAirData",0)
    ipc.control(66587,8027)

    elseif LAD == 0 then
    ipc.writeLvar("L:LeftAirData", 1)
    ipc.control(66587,8028)
    end

    -- Right Air Data off
    elseif ipcPARAM == 16 then

    RAD = ipc.readLvar("L:RightAirData")

    if RAD == 1 then
    ipc.writeLvar("L:RightAirData",0)
    ipc.control(66587,8027)

    elseif RAD == 0 then
    ipc.writeLvar("L:RightAirData", 1)
    ipc.control(66587,8028)
    end

    -- DC PowersourceKnob UP
    elseif ipcPARAM == 17 then

    DCP = ipc.readLvar("L:DCPowerSourceKnob")

    if DCP &lt; 3 then
    ipc.writeLvar("L:DCPowerSourceKnob", DCP+1)
    ipc.control(66587, 8039)

    elseif DCP == 3 then
    end

    -- DC PowersourceKnob DOWN
    elseif ipcPARAM == 18 then

    DCP = ipc.readLvar("L:DCPowerSourceKnob")

    if DCP &gt; 0 then
    ipc.writeLvar("L:DCPowerSourceKnob", DCP-1)
    ipc.control(66587, 8039)

    elseif DCP ==0 then
    end

    -- PROP SYNC SWITCH TOGGLE
    if ipcPARAM == 19 then


    PSync = ipc.readLvar("L:PropSync")

    if PSync == 1 then
    ipc.writeLvar("L:PropSync", 0)
    ipc.control(66587, 8027)

    elseif PSync== 0 then
    ipc.writeLvar("L:PropSync", 1)
    ipc.control(66587, 8028)

    end

    -- CCT Auto Cycle Switch
    elseif ipcPARAM == 20 then

    ipc.writeLvar("L:AutoAnticeCycle", 2)
    ipc.control(66587, 8028)

    ipc.sleep(200)
    ipc.writeLvar("L:AutoAnticeCycle", 1)
    ipc.control(66587, 8027)

    end

and my JS41 Macro:

[Macros]



1=L:GrndSpoilersSwitch=TOG


2=Left feather
2.1=C66587, 1420
2.2=C66587, 8029

3=right feather
3.1=C66587, 1421
3.2=C66587, 8029

4=LNAV Zoom +
4.1=C66587, 4940
4.2=C66587, 8031

5=LNAV Zoom -
5.1=C66587, 4930
5.2=C66587, 8031


6=AP_HDG plus
6.1=C66587, 26902
6.2=C66587, 8031

7=AP_HDG minus
7.1=C66587, 26901
7.2=C66587, 8031

8=AP_HDG press
8.1=C66587, 2691
8.2=C66587, 8031


9=AP_Alt plus
9.1=C66587, 3921
9.2=C66587, 8031

10=AP_Alt minus
10.1=C66587, 3920
10.2=C66587, 8031



11=AP_CRS plus
11.1=C66587, 26702
11.2=C66587, 8031

12=AP_CRS minus
12.1=C66587, 26701
12.2=C66587, 8031

13=AP_CRS press
13.1=C66587, 2672
13.2=C66587, 8031


14=AP_IAS plus
14.1=C66587, 26802
14.2=C66587, 8031

15=AP_IAS minus
15.1=C66587, 26801
15.2=C66587, 8031

16=AP_IAS press
16.1=C66587, 2681
16.2=C66587, 8031

17=AP_ALT
17.1=C66587, 281
17.2=C66587, 8031

18=AP_ALTarm
18.1=C66587, 282
18.2=C66587, 8031

19=AP_VS
19.1=C66587, 283
19.2=C66587, 8031

20=AP_IAS
20.1=C66587, 284
20.2=C66587, 8031

21=AP_HDG
21.1=C66587, 277
21.2=C66587, 8031

22=AP_NAV
22.1=C66587, 278
22.2=C66587, 8031

23=AP_APPR
23.1=C66587, 279
23.2=C66587, 8031

24=AP_BC
24.1=C66587, 280
24.2=C66587, 8031

25=EFIS1_Full/Map
25.1=C66587, 214
25.2=C66587, 8038

26=EFIS1_TCAS
26.1=C66587, 215
26.2=C66587, 8038

27=EFIS1_GSPD/TTG
27.1=C66587, 217
27.2=C66587, 8038

28=EFIS1_ET
28.1=C66587, 218
28.2=C66587, 8038

29=EFIS1_V/L
29.1=C66587, 21901
29.2=C66587, 8038

30=EFIS1_LNAV
30.1=C66587, 21910
30.2=C66587, 8038

31=FMS_Enter
31.1=C66587, 3610
31.2=C66587, 8030

32=FMS_DirectTo
32.1=C66587, 3220
32.2=C66587, 8030

33=FMS_Prev
33.1=C66587, 3200
33.2=C66587, 8030

34=FMS_Next
34.1=C66587, 3210
34.2=C66587, 8030

35=FMS_NAV
35.1=C66587, 3470
35.2=C66587, 8030

36=FMS_VNAV
36.1=C66587, 3480
36.2=C66587, 8030

37=FMS_FPL
37.1=C66587, 3500
37.2=C66587, 8030

38=FMS_Plan
38.1=C66587, 3540
38.2=C66587, 8030

39=FMS_HDG
39.1=C66587, 3550
39.2=C66587, 8030

40=FMS_Tune
40.1=C66587, 3560
40.2=C66587, 8030

41=FMS_Back
41.1=C66587, 3460
41.2=C66587, 8030

This switch should toggle the CCT, but i don't see nothing happening. What might be wrong here? Any help would be appreciated!

Link to comment
Share on other sites

Hi,

I don't understand your post, sorry...

Does nothing work, no LUA, no Macro?

then you have an other, essential problem, which I don't know.

Just for the LUA you inserted above:

in this line:

if ipcPARAM == 19 then

is maybe an error. I would change it to

elseif ipcPARAM == 19 then

I'm not sure if it helps, but try it....

If just one single point is wrong in the LUA file, then the whole script is not working!!!

Link to comment
Share on other sites

If just one single point is wrong in the LUA file, then the whole script is not working!!!

Yes, because it is compiled on loading, not interpreted line-by-line, and the compiler stops on the first error.

Best advice is -- always check the Log file, because that is where Lua error reports will be found. If you select Lua logging they will go to a separate Lua log file for each Lua program. Otherwise they'll be put into the FSUIPC log.

For FSX you can run in Windowed mode with the FSUIPC4 log console visible and see the results immediately on screen.

Regards

Pete

Link to comment
Share on other sites

  • 2 months later...

well guenseli you seems to know a lot of this lua programing but what about an tutorial on youtube as i know there is some ho needs a visual wiev on how to get startet as reading is good but not always the best way as there should just a littel stone on the road and it dosent work.

Best regards Lars

Link to comment
Share on other sites

well guenseli you seems to know a lot of this lua programing but what about an tutorial on youtube

Hi Lars,

A "no" to both :lol:

I don't know very much about LUA programming (Pete can confirm this :wink: ) I just gather the Lua variables and put them together for my own needs. And I have already written a little tutorial wich can be found here in this forum as sticky.

I get questions from time to time about that and I always find out that people haven't read this tutorial, but after that they don't have questions any more...

Second point is that I don't know how to make a youtube tutorial...

Link to comment
Share on other sites

  • 4 months later...

No, theres no other site...

The versions here in the first thread are updated...

But just copy and paste it from here into a new editior file and give it an other name...e.g. "ColdDark2.LUA"

So, you can use both files if you want.... if it makes sense for you

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 2 months later...

hello, i love the JS411 too ...

some questions about your post. i am not sure that i understand all correct.

1.) in wich folder shout i save the J41.LUA file?

2.) and the code in part 1 + macro + cold and dark?

thanks for helping me ... Jan

####

To get acces to the single commands you have to do the following:

1) copy the code below

2) insert it into an empty editor or wordpad file and save it as e.g. J41.LUA

3) open FSUIPC menu and choose LUA J41 from the drop down

4) insert different parameter numbers depending on the action you want (green field)

1.) in wich folder shout i save the J41.LUA file?

2.) and the code in part 1 + macro + cold and dark?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy 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.