Jump to content
The simFlight Network Forums

JS41 LUA commands ned help


Recommended Posts

hello, i tried to install the JS41.LUA commands without success.

as descriped in article:

1.) i copied the code into a wordpad file and saved it as JS41.LUA (see below the saved code)

2.) i saved it into the microsoft FSX "modules" folder

3.) i reload all buttons. but there is no entry in the list (right site, buttons and switches, control send when button pressed).

it would be very helpful if someone could help me.

there are also some macro code in the list. do i have this also to save in the JS41.LUA file?

thanks for your help.

here the saved code:

-----

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

Link to comment
Share on other sites

1.) i copied the code into a wordpad file and saved it as JS41.LUA (see below the saved code)

If it a VERY VERY bad idea to use WordPad for any configuration or program files. Use NotePad, not Wordpad! Wordpad assumes you are dealing with documents, not text files.

2.) i saved it into the microsoft FSX "modules" folder

3.) i reload all buttons. but there is no entry in the list (right site, buttons and switches, control send when button pressed).

If there are ANY files with type 'lua' in the FS Modules folder then FSUIPC lists them in the drop-down lists for Buttons, Keys and Axes. This is completely unrelated to what is actually IN the file. So, one of three things must be true:

1. You didn't actually save it with the name JS41.lua. Possible Wordpad saved it as "JS41.lua.doc" or similar, OR

2. You aren't looking for the correct entry. For JS41.lua the entry will say "Lua js41", OR

3. You are using an old usupported version of FSUIPC which pre-dates Lua support.

Regards

Pete

Link to comment
Share on other sites

Thanks Mr. Pete,

i will try it today night. i think the problem is the point with the wordpad doc file.

i am not sure about the code. on the page there are 3 parts of code

a.) LUA commands

b.) Macro

c.) Cold and dark LUA

must i copie all 3 code sections in one file or in 3 different files?

thanks für great help! Jan

If it a VERY VERY bad idea to use WordPad for any configuration or program files. Use NotePad, not Wordpad! Wordpad assumes you are dealing with documents, not text files.

If there are ANY files with type 'lua' in the FS Modules folder then FSUIPC lists them in the drop-down lists for Buttons, Keys and Axes. This is completely unrelated to what is actually IN the file. So, one of three things must be true:

1. You didn't actually save it with the name JS41.lua. Possible Wordpad saved it as "JS41.lua.doc" or similar, OR

2. You aren't looking for the correct entry. For JS41.lua the entry will say "Lua js41", OR

3. You are using an old usupported version of FSUIPC which pre-dates Lua support.

Regards

Pete

Link to comment
Share on other sites

i am not sure about the code. on the page there are 3 parts of code

a.) LUA commands

b.) Macro

c.) Cold and dark LUA

must i copie all 3 code sections in one file or in 3 different files?

Sorry, what 'page' is this? What Lua file? The one you are saving? Surely if you have downloaded it or copied it, as a file for saving, it is a file, a single file. If it was multiple files, it will be multiple files. I don't know because I don't think you are referring to noe of mine?

Pete

Link to comment
Share on other sites

now, it works fine. thanks jan

Sorry, what 'page' is this? What Lua file? The one you are saving? Surely if you have downloaded it or copied it, as a file for saving, it is a file, a single file. If it was multiple files, it will be multiple files. I don't know because I don't think you are referring to noe of mine?

Pete

Link to comment
Share on other sites

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
×
×
  • 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.