Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I am having quite limited success with assigning presets on the iFly, for example the Park Brake preset doesn't work, neither does APU start, and I can only get one of the runway turnoff lights to work. I have no issues with any other aircraft using Mobiflight presets. Has anyone else run into problems with this aircraft and any advice? I am not a FSUIPC technical expert but I have managed to use aircraft specific presets for years with no trouble and this one is bugging me!

Thanks

Posted

Sorry but I don't have the iFly so cannot look into this. But looking at the parking brake presets, they simply set an lvar value:
  Parking Brake ON: 7 (>L:VC_Gear_trigger_VAL)
  Parking Brake OFF: 8 (>L:VC_Gear_trigger_VAL)

You can check if they are valid by using FSUIPC's logging facilities. List the lvars (Addons->WASM->List Lvars) and note the value of that lvar with the parking brake on and off - does it match those values (7 for on, 8 for off)? Are there any other lvars that look related to the Parking Brake?
If you open the logging  console (Log->Open Console), set logging for Events and Input Events, what do you see logged when you engage/disengage the parking brake? If you see any relevant events or Input Events, you can try using them.

Otherwise, the following tutorials explains how to determine what to use for any given switch/button: 
    MSFS2020: https://www.badcasserole.com/uncovering-input-events-using-the-msfs2020-model-behavior-dialog/
    MSFS2024: https://www.badcasserole.com/uncovering-input-events-using-the-msfs2024-model-behavior-dialog/

Also, please note that ALL provided presets are provided by the community driven effort led by MobiFlight (see https://hubhop.mobiflight.com/presets/), and any issues with presets should be addressed to MF via their Discord server, on the msfs2020 or msfs2024 channel, depending on the  version you are using.

John

Posted

Thanks as usual John for the time taken to explain! I’ll have a look when I next sneak in some sim time, sadly I used up all my weekend sim credit already! 

Posted

Hi John, I am really struggling to work out how to identify and use these LVARs in FSUIPC. I have followed your instructions and can see the preset  does nothing to do with Park Brake, no values change.

I did see one that does change the physical lever and park brake light but they seem to be separate two variables.

OFF

VC_Parking_Brake_LIGHT_VAL = 0.000000
VC_Parking_Brake_Light_Display_VAL = 0.000000
VC_Parking_Brake_SW_VAL = 0.000000

ON

VC_Parking_Brake_LIGHT_VAL = 5.000000
VC_Parking_Brake_Light_Display_VAL = 0.000000
VC_Parking_Brake_SW_VAL = 10.000000

How would I programme these into a Button?

Event logging shows no different entries amongst the masses of 'noise' when I try logging. And the MSFS2020 tutorial doesn't  work, I read on the Mobiflight Discord that the iFly doesn't use the InputEvents in the usual way so you only see 3 basic sets (Flaps, Spoilers and one other).

Sorry I am not so well versed in all this code, I just want my buttons to work like they do on the Fenix and PMDG!!

David

Posted
18 hours ago, BAW242 said:

I did see one that does change the physical lever and park brake light but they seem to be separate two variables.

OFF

VC_Parking_Brake_LIGHT_VAL = 0.000000
VC_Parking_Brake_Light_Display_VAL = 0.000000
VC_Parking_Brake_SW_VAL = 0.000000

ON

VC_Parking_Brake_LIGHT_VAL = 5.000000
VC_Parking_Brake_Light_Display_VAL = 0.000000
VC_Parking_Brake_SW_VAL = 10.000000

How would I programme these into a Button?

Before defining a preset, check that setting these actually works, using the Add-ons->WASM->Execute Calc. code menu item.
To turn on, try:
    5 (>L:VC_Parking_Brake_LIGHT_VAL) 10 (>L:VC_Parking_Brake_SW_VAL)
and off:
    0 (>L:VC_Parking_Brake_LIGHT_VAL) 0 (>L:VC_Parking_Brake_SW_VAL)

If that works, you can then define your own presets (using the myEvents.txt file) and then assign to those presets.

  • 1 month later...
Posted

Hi again John.

I got the Park Brake working, it turned out the Preset was set up the wrong way round, so I swapped 7 and 8 and it worked.

I am now trying to get the rwy turnoff lights mapped to one button but the Preset for both only activates the right hand light.

image.png.819a812a2c0f1419135088fde24a5dc7.png

If I  manually enter each line in the Execute Calculator Code box they all work fine, left and right on and off, but when combined in the Preset only the R goes on/off. Is there some kind of tweak to the code I need to do to add a delay in between or something? I tried setting up a myEvents.txt and adding something I saw in another thread [(SLEEP:100) 1] in between the two L/R commands but even the R light doesn't work with this.

image.png.87c28a2ba0ed9ae065848c207c80853c.png

Thanks

Posted

I am not sure how to embed a pause/wait in a calculator code string and that sleep syntax is not familiar to me.
There are a couple of other ways you could do this:

1. Use lua instead, e.g.

ipc.execCalcCode("23 (>L:VC_Miscellaneous_trigger_VAL, number)")
ipc.sleep(100)
ipc.execCalcCode("25 (>L:VC_Miscellaneous_trigger_VAL, number)")

2.Define two separate presets:
    IFLY_RWY_ONa#23 (>L:VC_Miscellaneous_trigger_VAL, number)
    IFLY_RWY_ONb#25 (>L:VC_Miscellaneous_trigger_VAL, number)
and then create a macro to call the first one, then pause (using the FSUIPC-added pause control), then call the second preset.
You can also overload the assignments instead of using a macro if you prefer.

  • Thanks 1
  • 2 weeks later...
Posted

Just a quick note to say thanks again John, I learned how to do the LUA scripts today and it works for the two runway turnoff lights on one button, I will now use for various other combos I want to do on the iFly!!

For the benefit any newbies wanting to do iFly RWY TURNOFF on/off on one button, I am attaching the files, you just put them in the FSUIPC main install folder and instead of selecting Preset for the buttons, select "FS Control" and look for the commands "LuaIflyRFWYON or ...OFF.,

iFlyRwyOFF.lua iFlyRwyON.lua

  • Like 1
Posted
On 6/7/2025 at 7:57 AM, BAW242 said:

Just a quick note to say thanks again John, I learned how to do the LUA scripts today and it works for the two runway turnoff lights on one button, I will now use for various other combos I want to do on the iFly!!

For the benefit any newbies wanting to do iFly RWY TURNOFF on/off on one button, I am attaching the files, you just put them in the FSUIPC main install folder and instead of selecting Preset for the buttons, select "FS Control" and look for the commands "LuaIflyRFWYON or ...OFF.,

iFlyRwyOFF.lua 149 B · 1 download iFlyRwyON.lua 149 B · 2 downloads

I want to thank you for sharing this, it works amazingly, even the slight delay of one switch to make the sound work. Would you be so kind to create a .lua for the AUTOBRAKE OFF button, it's the only switch I couldn't be able to map. Thanks a lot again buddy.

Posted
1 hour ago, Cuantreau said:

Would you be so kind to create a .lua for the AUTOBRAKE OFF button, it's the only switch I couldn't be able to map.

Why not just use the provided preset Autbrake Off?

That uses the following calculator code: 10 (>L:VC_Autobrake_SW_VAL)

If you really want to do this via lua, then a simple script just containing
    ipc.execCalcCode("10 (>L:VC_Autobrake_SW_VAL)")
should do the trick.

I see you just replied...

21 minutes ago, Cuantreau said:

I've just created one, if anyone was on the same boat as me, here is the file. Thanks guys for the knowledge.

Yes, thats fine. But there are presets available for this - the following presets are available for the Autobrake:

image.thumb.png.27736ec383a134a5037043361b5ab177.png

There are two presets for 'autobrake off', but if you look at the descriptions the first is incorrect and switches to max, and the 2nd one is the correct one. I don't know or understand why they did not just correct the first one rather than leaving it and adding another preset.
This 2nd preset was also added after the current release of FSUPC7, and so is not available in the current version. In fact, as there is also other presets with the same name, it won't be loaded as preset names must be unique in FSUIPC.

Therefore, I would advise that the best way to do this would be to define your own preset in the myevents.txt file:

//iFly/737-Max8/Gear
IFLY_737Max_Autobrake_Off#10 (>L:VC_Autobrake_SW_VAL)

Then assign to that preset.

John

 

Posted
39 minutes ago, John Dowson said:

Why not just use the provided preset Autbrake Off?

That uses the following calculator code: 10 (>L:VC_Autobrake_SW_VAL)

If you really want to do this via lua, then a simple script just containing
    ipc.execCalcCode("10 (>L:VC_Autobrake_SW_VAL)")
should do the trick.

I see you just replied...

Yes, thats fine. But there are presets available for this - the following presets are available for the Autobrake:

image.thumb.png.27736ec383a134a5037043361b5ab177.png

There are two presets for 'autobrake off', but if you look at the descriptions the first is incorrect and switches to max, and the 2nd one is the correct one. I don't know or understand why they did not just correct the first one rather than leaving it and adding another preset.
This 2nd preset was also added after the current release of FSUPC7, and so is not available in the current version. In fact, as there is also other presets with the same name, it won't be loaded as preset names must be unique in FSUIPC.

Therefore, I would advise that the best way to do this would be to define your own preset in the myevents.txt file:

//iFly/737-Max8/Gear
IFLY_737Max_Autobrake_Off#10 (>L:VC_Autobrake_SW_VAL)

Then assign to that preset.

John

 

Thanks very much John, as always, just done what you explained, works perfect.

  • Like 1
Posted

Hi all, veteran user of FSUIPC, but new in this forum. Thanks for BAW242 for already supporting me on the scripts for the iFly's RWY turnoff lights, I thought it must be easy to create more LUA scripts for other buttons.

Here's me task:

  • MSFS2020 iFly 737MAX 3-way dome light switch
  • single push button (Logitech Wingman Extreme 3D) to toggle through the 3 dome light positions OFF-BRIGHT-DIM

I have tried through MobiFlight and I could only get dome light switch button to

move down 

39 (>L:VC_Miscellaneous_trigger_VAL,number)

or up

38 (>L:VC_Miscellaneous_trigger_VAL,number)

Further variables are:

VC_Dome_Light_Display_VAL

This can be 0 (OFF), 1 (DIM) or 2 (BRIGHT). I cannot seem to set this value directly, but I can read it in Developer Mode under Behaviors => LocalVariables

 

Whenever I tried to create a logic with "IF", it would not recognize it.

 

Therefore I am now trying to create an "if" and "elseif" logic to toggle through those positions in the order OFF-BRIGHT-DIM (and then OFF again). So far, nothing is happening in the SIM and that's why I am here. Forgive me my novice errors in coding, I am sure I am making really basic mistakes.

 

When my LUA script says

ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)")

it is all fine: when I push the assigned joystick-button, then the dome light switch gets moved one position down.

But when I try to implement a logic, nothing happens:

if (L:VC_Dome_Light_Display_VAL, number) == 0 then ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)") end

 

Can you spot my mistake? Or is it an issue of the iFly 737MAX?

 

Posted
41 minutes ago, TheAviationFox said:

But when I try to implement a logic, nothing happens:

if (L:VC_Dome_Light_Display_VAL, number) == 0 then ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)") end

You cannot read the value of an lvar directly like that, as it only exists in the simulator, not in FSUIPC or the lua thread. To read an lvar value, use the ipc.readLvar function, e.g

if ipc.readLvar("L:VC_Dome_Light_Display_VAL") == 0 then
    ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)")
end

You could also define a preset with the following calc code:
    (L:VC_Dome_Light_Display_VAL, number) == 0 if{ 39 (>L:VC_Miscellaneous_trigger_VAL,number)}
then assign to that preset - no lua needed (more efficient!).

John

Posted

Alright, I got it to work!

The code I used is:

if ipc.readLvar("L:VC_Dome_Light_Display_VAL") == 0 then
	ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)")
elseif ipc.readLvar("L:VC_Dome_Light_Display_VAL") == 1 then
	ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)")
elseif ipc.readLvar("L:VC_Dome_Light_Display_VAL") == 2 then
	ipc.execCalcCode("38 (>L:VC_Miscellaneous_trigger_VAL,number)")
	ipc.sleep(100)
	ipc.execCalcCode("38 (>L:VC_Miscellaneous_trigger_VAL,number)")
end

You will probably will see it as less efficient.

 

When you wrote

On 6/12/2025 at 2:58 PM, John Dowson said:

You could also define a preset with the following calc code:
    (L:VC_Dome_Light_Display_VAL, number) == 0 if{ 39 (>L:VC_Miscellaneous_trigger_VAL,number)}
then assign to that preset - no lua needed (more efficient!).

I'm trying to figure out how this would work. So, if I define a preset as suggested by you, how do I then proceed? Where do I define such a preset? Can you point me to the right support document or some kind of tutorial? Sorry, I'm pretty new to this part of coding and appreciate some hints.

Posted
12 hours ago, TheAviationFox said:

You will probably will see it as less efficient.

As any lua lvar function using the lvar name is quite expensive in turns of performance (as it has to scan all lvars and do string matching to find the id), you could improve that by just reding the lvar value once::

domeLightDisplay = ipc.readLvar("L:VC_Dome_Light_Display_VAL")
if  domeLightDisplay == 0 then
	ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)")
elseif domeLightDisplay == 1 then
	ipc.execCalcCode("39 (>L:VC_Miscellaneous_trigger_VAL,number)")
elseif domeLightDisplay == 2 then
	ipc.execCalcCode("38 (>L:VC_Miscellaneous_trigger_VAL,number)")
	ipc.sleep(100)
	ipc.execCalcCode("38 (>L:VC_Miscellaneous_trigger_VAL,number)")
end

 

12 hours ago, TheAviationFox said:

When you wrote

On 6/12/2025 at 2:58 PM, John Dowson said:

You could also define a preset with the following calc code:
    (L:VC_Dome_Light_Display_VAL, number) == 0 if{ 39 (>L:VC_Miscellaneous_trigger_VAL,number)}
then assign to that preset - no lua needed (more efficient!).

I'm trying to figure out how this would work. So, if I define a preset as suggested by you, how do I then proceed? Where do I define such a preset? Can you point me to the right support document or some kind of tutorial? Sorry, I'm pretty new to this part of coding and appreciate some hints.

You define presets in a file called myevents.txt (you have to create this) - see the section Using Calculator Code Presets on page 50 of the Advanced User guide.

If you wanted to replicate that lua script using presets and direct assignments, you would need to:
   1. define 2 presets in the myevents.txt file, e.g.

//iFl/737MAX/Lights
Dome_Light_Up#39 (>L:VC_Miscellaneous_trigger_VAL,number)
Dome_Light_Down#38 (>L:VC_Miscellaneous_trigger_VAL,number)

  2, Add the lvar VC_Dome_Light_Display_VAL to an FSUIPC offset. Best to do this in your profile, e.g. if your profile is called xxx, the following would add this lvar to offset 0xA000 as a single byte value:

[LvarOffsets.xxx]
1=L:VC_Dome_Light_Display_VAL=UB0xA000

   See the section Adding Lvars to Offsets on page 47 of the Advanced User guide.

  3.  Assign your button to one of the presets. This will result in an entry in your FSUIPC7.ini like the following (the index, joystick letter and button number will differ):

73=PS,3,CPDome_Light_Up,0 	-{Preset Control}-


  4. Open the button assignments panel in FSUIPC7, and also open the FSUIPC7.ini file in an editor and locate the button assignment line. You then need to duplicate that 4 times, changing the index number and the preset used:

73=PS,3,CPDome_Light_Up,0 	-{Preset Control}-
74=PS,3,CPDome_Light_Up,0 	-{Preset Control}-
75=PS,3,CPDome_Light_Down,0 	-{Preset Control}-
76=PS,3,CPDome_Light_Down,0 	-{Preset Control}-

  5. You then need to add the delay between the two down presets, and add an offset condition to the offset holding the value of the  lvar VC_Dome_Light_Display_VAL:

73=BA000=0 PS,3,CPDome_Light_Up,0 	-{Preset Control}-
74=BA000=1 PS,3,CPDome_Light_Up,0 	-{Preset Control}-
75=BA000=2 PS,3,CPDome_Light_Down,0 	-{Preset Control}-
76=BA000=2 PS,3,C1152,100 	-{pause (ms)}-
77=BA000=2 PS,3,CPDome_Light_Down,0 	-{Preset Control}-

     See the section Adding offset conditions on page 24 of the Advanced User guide

6. Save the changes to the FSUIPC7.ini file, and then click the Reload all buttons button in FSUIPC7 to reload the updated ini.

The one doubt I have on this is whether the last preset (with index 77 above) will be sent or not: it could be that the lvar is updated, and thus the offset value, before that assignment is considered for execution, and if that is the case it will not be executed as the offset value will no longer be 2 but 1. If this is the case, reduce the delay - 10 or 20ms should be enough really.

John
   - :

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.