guenseli Posted November 23, 2009 Report Posted November 23, 2009 I have made some little LUA and MACRO files for different aircrafts the last weeks and d'like to share them here. -- upd 15 Mar: supports now Mustang version 1.03 added Master Caution with help of AndyDigital...thanks! LUA commands Here's a very short tutorial how to "install" LUA files 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 into the FSX - Modules Folder 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) (this example picture is for the J41. For the F1 Mustang you have to name the file of course F1_Mustang.LUA or whatever. Them the name in the dropdown (red field) will be Lua F1_Mustang) -- 1 = BATT toggle -- 2 = both Generators toggle -- 3 = Avionics etc... -- 4 = Taxi Lights ON -- 5 = Landing Lights ON -- 6 = Taxi and Landing lights OFF -- 7= Panel light toggle -- 8 = toggle starter 1 -- 9 = toggle starter 2 -- 10 = Master Warn -- 11 = Master Caution -- BATT toggle if ipcPARAM == 1 then LVarSet = "L:Masterbatt" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.control(66241) ipc.sleep(50) ipc.control(65823, 2) -- knob sound end -- both generators toggle if ipcPARAM == 2 then LVarSet = "L:LEFTGEN" LVar2Set = "L:RIGHTGEN" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.writeLvar(LVar2Set, val) ipc.control(66364) ipc.sleep(50) ipc.control(65823, 1) -- knob sound ipc.control(66363) ipc.sleep(50) ipc.control(65823, 1) -- knob sound end -- Avionics, STb Instruments and Anti Skid toggle if ipcPARAM == 3 then ipc.control(66293) ipc.sleep(50) ipc.control(65823, 2) -- knob sound LVarSet = "L:ANTISKID" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 ipc.control(65823, 329) end ipc.writeLvar(LVarSet, val) ipc.sleep(50) ipc.control(65823, 2) -- knob sound LVarSet = "L:STBYAVIONICS" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.sleep(50) ipc.control(65823, 2) -- knob sound end -- Taxi Lights ON if ipcPARAM == 4 then ipc.writeLvar("L:LANDRECTAXI", 1) ipc.control(65823, 1) -- knob sound end -- Landing Lights ON if ipcPARAM == 5 then ipc.writeLvar("L:LANDRECTAXI", 2) ipc.control(66059, 1) ipc.control(65823, 1) -- knob sound end -- Taxi and Landing Lights OFF if ipcPARAM == 6 then ipc.writeLvar("L:LANDRECTAXI", 0) ipc.control(66060, 1) ipc.control(65823, 1) -- knob sound end -- Panel light toggle if ipcPARAM == 7 then LVarSet = "L:panel_lights" LVar1Set = "L:InstLt" LVar2Set = "L:MustangInstrLt" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.writeLvar(LVar1Set, val) ipc.writeLvar(LVar2Set, val) ipc.sleep(50) ipc.control(65823, 3) -- knob sound end -- Starter 1 ON if ipcPARAM == 8 then ipc.control(66300) ipc.writeLvar("L:MustangLeftStarter", 1) ipc.writeLvar("L:LEStartTimer", 63401433820.394) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end -- Starter 2 ON if ipcPARAM == 9 then ipc.control(66301) ipc.writeLvar("L:MustangRightStarter", 1) ipc.writeLvar("L:REStartTimer", 63401433820.394) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end -- Master Warn if ipcPARAM == 10 then ipc.control(65823, 32) end -- Master Caution if ipcPARAM == 11 then ipc.control(65823, 33) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end MACROS Note: unfortunately the Mustang developer is the only developer who I know which is changing his gauges numbers with every update. So this macros just work for the current version 1.03(!) This Macro is now shorter as thet from Version 1.02b because many commands are now possible with LUA and now independet from changed gauge numbers. [Macros] Module="Flight1_GarminG1000_510.GAU" 1=L:G1000DimBright=INC 2=L:G1000DimBright=DEC 3=APPR=RX926f0*X5590 4=NAV=RX92830*X5590 5=ALT press=RX92b50*X5590 6=VS press=RX92c40*X5590 7=FLC=RX92d30*X5590 8=ALT plus=RX93e70*X5590 9=ALT minus=RX93db0*X5590 10=SPD=RX933a0*X5590 11=HDG Knob Press=RX93930*X5590 12=CRS Knob Press=RX93b70*X5590 LUA Mustang Initialisation code With this codelines assigned to a key or button ar in use with FSUIPC [AUTO] function (read FSUIPC manual for it) you have lowered the yokeswith one click. ipc.writeLvar("L:Yoke_Pilot", 1) ipc.writeLvar("L:Yoke_CoPilot", 1) 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!
Walt Posted November 23, 2009 Report Posted November 23, 2009 Hi, Thank you for sharing. Why does the developer change numbers with each update? Is this deliberate to make it difficult for you to control the gauges?
guenseli Posted November 23, 2009 Author Report Posted November 23, 2009 Why does the developer change numbers with each update? Is this deliberate to make it difficult for you to control the gauges? don't know, but don't think thats deliberate... I have asked him many times but he said he couldn't do it in an other way... We have to live with...
Andydigital Posted March 14, 2010 Report Posted March 14, 2010 Hi Guenter thanks for the work you put into lua package is there a reason why you made the "master warn" L:var but not the "master caution" one as well?
guenseli Posted March 14, 2010 Author Report Posted March 14, 2010 is there a reason why you made the "master warn" L:var but not the "master caution" one as well? yes, I have with my countless hardwareswitches just one left and this I use normally for the master warn :lol: All my LuaVars are just for my personal needs and my personal hardware. I know that there several functions left... but as I don't need them for my hardware I don't have too much motivation to gather them :oops:
Andydigital Posted March 14, 2010 Report Posted March 14, 2010 OK fair enough, I just thought it was odd that you made one and not the other and thought there was a technical reason for not doing it, especially when the caution one is the one that is used most often. Can you remind me how you go about finding these L:Var parameters as I'm not having any luck so far, its not something I have had to do yet myself as everything I have ever wanted to use has worked fine with macros. I plan to use the two TOGA buttons on the MCP Combi with these master buttons as they are in approximately the same position as on the real Mustang panel :D . Thanks in advance.
Pete Dowson Posted March 14, 2010 Report Posted March 14, 2010 Can you remind me how you go about finding these L:Var parameters as I'm not having any luck so far There are two ways. The most useful is to use the Log Lvars lua plug-in, which will give you a real-time display on screen as they change, like those we used to test VRInsight switches. The other is simply to assign a keypress or button the the List local panel variables control in FSUIPC's assignments -- then you have to refer to the list produced in the FSUIPC Log. Pete
guenseli Posted March 15, 2010 Author Report Posted March 15, 2010 Or have a look here: http://forums.simflight.com/viewtopic.php?f=54&t=78335
Andydigital Posted March 15, 2010 Report Posted March 15, 2010 I figured it out with a bit of dumb hamfistedness, simply changing the parameter from 32 to 33; -- Master Warn if ipcPARAM == 10 then ipc.control(65823, 32) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end to -- Master Warn if ipcPARAM == 10 then ipc.control(65823, 33) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end That did the trick so anyone else who wants to add the Master Caution button please just add the below to the end of your mustang lua script file. -- Master Caution if ipcPARAM == 11 then ipc.control(65823, 33) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end
guenseli Posted March 15, 2010 Author Report Posted March 15, 2010 Thanks Andy! updated original thread and code!
gooo Posted December 23, 2010 Report Posted December 23, 2010 I have made some little LUA and MACRO files for different aircrafts the last weeks and d'like to share them here. -- upd 15 Mar: supports now Mustang version 1.03 added Master Caution with help of AndyDigital...thanks! LUA commands Here's a very short tutorial how to "install" LUA files 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 into the FSX - Modules Folder 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) (this example picture is for the J41. For the F1 Mustang you have to name the file of course F1_Mustang.LUA or whatever. Them the name in the dropdown (red field) will be Lua F1_Mustang) -- 1 = BATT toggle -- 2 = both Generators toggle -- 3 = Avionics etc... -- 4 = Taxi Lights ON -- 5 = Landing Lights ON -- 6 = Taxi and Landing lights OFF -- 7= Panel light toggle -- 8 = toggle starter 1 -- 9 = toggle starter 2 -- 10 = Master Warn -- 11 = Master Caution -- BATT toggle if ipcPARAM == 1 then LVarSet = "L:Masterbatt" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.control(66241) ipc.sleep(50) ipc.control(65823, 2) -- knob sound end -- both generators toggle if ipcPARAM == 2 then LVarSet = "L:LEFTGEN" LVar2Set = "L:RIGHTGEN" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.writeLvar(LVar2Set, val) ipc.control(66364) ipc.sleep(50) ipc.control(65823, 1) -- knob sound ipc.control(66363) ipc.sleep(50) ipc.control(65823, 1) -- knob sound end -- Avionics, STb Instruments and Anti Skid toggle if ipcPARAM == 3 then ipc.control(66293) ipc.sleep(50) ipc.control(65823, 2) -- knob sound LVarSet = "L:ANTISKID" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 ipc.control(65823, 329) end ipc.writeLvar(LVarSet, val) ipc.sleep(50) ipc.control(65823, 2) -- knob sound LVarSet = "L:STBYAVIONICS" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.sleep(50) ipc.control(65823, 2) -- knob sound end -- Taxi Lights ON if ipcPARAM == 4 then ipc.writeLvar("L:LANDRECTAXI", 1) ipc.control(65823, 1) -- knob sound end -- Landing Lights ON if ipcPARAM == 5 then ipc.writeLvar("L:LANDRECTAXI", 2) ipc.control(66059, 1) ipc.control(65823, 1) -- knob sound end -- Taxi and Landing Lights OFF if ipcPARAM == 6 then ipc.writeLvar("L:LANDRECTAXI", 0) ipc.control(66060, 1) ipc.control(65823, 1) -- knob sound end -- Panel light toggle if ipcPARAM == 7 then LVarSet = "L:panel_lights" LVar1Set = "L:InstLt" LVar2Set = "L:MustangInstrLt" val = 0 if ipc.readLvar(LVarSet) == 0 then val = 1 end ipc.writeLvar(LVarSet, val) ipc.writeLvar(LVar1Set, val) ipc.writeLvar(LVar2Set, val) ipc.sleep(50) ipc.control(65823, 3) -- knob sound end -- Starter 1 ON if ipcPARAM == 8 then ipc.control(66300) ipc.writeLvar("L:MustangLeftStarter", 1) ipc.writeLvar("L:LEStartTimer", 63401433820.394) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end -- Starter 2 ON if ipcPARAM == 9 then ipc.control(66301) ipc.writeLvar("L:MustangRightStarter", 1) ipc.writeLvar("L:REStartTimer", 63401433820.394) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end -- Master Warn if ipcPARAM == 10 then ipc.control(65823, 32) end -- Master Caution if ipcPARAM == 11 then ipc.control(65823, 33) ipc.sleep(50) ipc.control(65823, 4) -- knob sound end MACROS Note: unfortunately the Mustang developer is the only developer who I know which is changing his gauges numbers with every update. So this macros just work for the current version 1.03(!) This Macro is now shorter as thet from Version 1.02b because many commands are now possible with LUA and now independet from changed gauge numbers. [Macros] Module="Flight1_GarminG1000_510.GAU" 1=L:G1000DimBright=INC 2=L:G1000DimBright=DEC 3=APPR=RX926f0*X5590 4=NAV=RX92830*X5590 5=ALT press=RX92b50*X5590 6=VS press=RX92c40*X5590 7=FLC=RX92d30*X5590 8=ALT plus=RX93e70*X5590 9=ALT minus=RX93db0*X5590 10=SPD=RX933a0*X5590 11=HDG Knob Press=RX93930*X5590 12=CRS Knob Press=RX93b70*X5590 LUA Mustang Initialisation code With this codelines assigned to a key or button ar in use with FSUIPC [AUTO] function (read FSUIPC manual for it) you have lowered the yokeswith one click. ipc.writeLvar("L:Yoke_Pilot", 1) ipc.writeLvar("L:Yoke_CoPilot", 1) 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! Hi, I've done step 1 and 2 but when I start fsx and I go into fsuipc but there is nothing in the drop down menu. Do I have to do anything eelse? Thank you
Pete Dowson Posted December 24, 2010 Report Posted December 24, 2010 Hi, I've done step 1 and 2 but when I start fsx and I go into fsuipc but there is nothing in the drop down menu. Do I have to do anything eelse? I don't know what "steps 1 and 2" are, but if there are ANY files at all with filetype Lua stored in your FS Modules folder, then any recent version of FSUIPC will most certainly be listing them in all the possible assignment dropdowns there are! In fact it will list them with a Lua prefix, a LuaKill prefix, a LuaSet prefix, a LuaClear prefix a LuaToggle prefix and a LuaDebug prefix! So, for every Lua file you will have 6 extra entries in the drop-downs! The entries are sorted alphabetically, and once the drop-down has dropped you can get to the #lua entries quickly by typing LU quickly enough. Regards Pete
gooo Posted December 25, 2010 Report Posted December 25, 2010 I don't know what "steps 1 and 2" are, but if there are ANY files at all with filetype Lua stored in your FS Modules folder, then any recent version of FSUIPC will most certainly be listing them in all the possible assignment dropdowns there are! In fact it will list them with a Lua prefix, a LuaKill prefix, a LuaSet prefix, a LuaClear prefix a LuaToggle prefix and a LuaDebug prefix! So, for every Lua file you will have 6 extra entries in the drop-downs! The entries are sorted alphabetically, and once the drop-down has dropped you can get to the #lua entries quickly by typing LU quickly enough. Regards Pete Steps 1 and 2 are at the begin of this page, you just need to scroll up the page and you'll see them. On the drop down I've got only Luakill all prefix and that's it.
Andydigital Posted December 25, 2010 Report Posted December 25, 2010 In Windows Explorer look for "folder options" (you can also type "folder options" in the Windows 7/Vista Start button search box) and scroll down the list of available options, look for an option called "hide extensions of known file types" or some similar name and make sure that there is no tick mark next to it. Next go back to the FSX/modules folder and make sure that the LUA file you created as instructed is actually called "example.LUA" and not something like "example.LUA.txt" instead, I think this may be why you aren't seeing anything in the drop down list in FSUIPC.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now