SliderCDN Posted September 18 Report Share Posted September 18 I am just starting to learn how to various variables and events to be able to assign aircraft controls to my HOTAS instead of clicking in the cockpit, however I am completely lost. I was able to assign mixture axis for BS Beech Piston Duke, but then I deleted the file by mistake and forgot how I did it. Duke manual just gives me a table of variables with decription, variable (L:BKSQ_MixtureLeverPosition_1) and range, but I am completely confused as to how to add that to myevents.txt file so I can assign a hotas control to it in the UI. If someone could write some examples and what is what in the line, I would greatly appreciate it as it'll give me a starting point. I am also trying to assign Left/right ignition switch (mags) which is L:BKSQ_IgnitionPosition_1 with range 0-5, and Cowl flaps L:var_cowlFlapSwitch_L, where 1=open and 2=close. events.txt came with presets for various other aircraft, so I'd like to do the same for the Duke, unless there is a already a file somewhere with all the controls in it. Thank you very much Link to comment Share on other sites More sharing options...
John Dowson Posted September 19 Report Share Posted September 19 First, check for existing presets. There are currently 38 presets available for the BS Duke - they are under MobiFlight->Black Square->Duke (in the Find Presets panel). If the presets toy are looking for don't exist, then look into adding them. 13 hours ago, SliderCDN said: Duke manual just gives me a table of variables with decription, variable (L:BKSQ_MixtureLeverPosition_1) and range, but I am completely confused as to how to add that to myevents.txt file so I can assign a hotas control to it in the UI. What is the range of the lvar? You need to know this to calibrate the axis value to the lvar range, If the range is 0-100, the preset would be: //Black Square//Duke BKSQ_Duke_Muxture1#$Param 16384 + 327.68 / near 0 max 100 min (>L:BKSQ_MixtureLeverPosition_1) The would convert your axis range (-16384 to +16384) to the lvar range (0-100) and set the value to the lvar. To use RPN (reverse polish notation) in calculator code, see https://docs.flightsimulator.com/flighting/html/Additional_Information/Reverse_Polish_Notation.htm. 14 hours ago, SliderCDN said: I am also trying to assign Left/right ignition switch (mags) which is L:BKSQ_IgnitionPosition_1 with range 0-5, and Cowl flaps L:var_cowlFlapSwitch_L, where 1=open and 2=close. The preset calculator code to set an lvar value (without any calibration) is just "$Param (>L:lvarname)", and you give the parameter value in the assignment. Alternatively, you can hard-code the value into the preset and just use that. Link to comment Share on other sites More sharing options...
SliderCDN Posted September 19 Author Report Share Posted September 19 4 hours ago, John Dowson said: First, check for existing presets. There are currently 38 presets available for the BS Duke - they are under MobiFlight->Black Square->Duke (in the Find Presets panel). If the presets toy are looking for don't exist, then look into adding them. What is the range of the lvar? You need to know this to calibrate the axis value to the lvar range, If the range is 0-100, the preset would be: //Black Square//Duke BKSQ_Duke_Muxture1#$Param 16384 + 327.68 / near 0 max 100 min (>L:BKSQ_MixtureLeverPosition_1) The would convert your axis range (-16384 to +16384) to the lvar range (0-100) and set the value to the lvar. To use RPN (reverse polish notation) in calculator code, see https://docs.flightsimulator.com/flighting/html/Additional_Information/Reverse_Polish_Notation.htm. The preset calculator code to set an lvar value (without any calibration) is just "$Param (>L:lvarname)", and you give the parameter value in the assignment. Alternatively, you can hard-code the value into the preset and just use that. That worked, however I still don't fully understand what does what in that line of code, but thank you nonetheless. As for cowl flaps, "The preset calculator code to set an lvar value (without any calibration) is just "$Param (>L:lvarname)", and you give the parameter value in the assignment. Alternatively, you can hard-code the value into the preset and just use that." That is alien language to me, which I would like to learn 🙂 What I am trying to achieve: I have 3-way switch on my HOTAS, up and down positions has separate input, while middle is just off, so up should be Cowl flaps L:var_cowlFlapSwitch_L with value 1, down is value 2 and when I release the switch, value is 0. What do I write in the file for event to appear in IU to bind the switch? I checked existing presets, Duke has lots of them, but almost all are tertiary system controls not used often and many variables listed in the manual are missing. Link to comment Share on other sites More sharing options...
John Dowson Posted September 19 Report Share Posted September 19 (edited) 2 hours ago, SliderCDN said: I still don't fully understand what does what in that line of code, but thank you nonetheless. Read that link on RPN! $Param 16384 + : adds 16384 to the axis input value ($Param) to give a value between 0 and 32768 327.68 / : divides the result by 327.68 to give a value between 0 and 100 near 0 max 100 min: I think near just converrs the result to an integer, and the rest ensures the value is between 0 and 100 (>L:BKSQ_MixtureLeverPosition_1) : sends the result to set the name lvar' value 2 hours ago, SliderCDN said: What I am trying to achieve: I have 3-way switch on my HOTAS, up and down positions has separate input, while middle is just off, so up should be Cowl flaps L:var_cowlFlapSwitch_L with value 1, down is value 2 and when I release the switch, value is 0. What do I write in the file for event to appear in IU to bind the switch? So up is one button, (as seen by FSUIPC), and down another? You can do this in 2 ways: 1. Create one preset: BKSQ_Duke_CowlFlapSwitch_L#$Param (>L:var_cowlFlapSwitch_L) Then assign the press on your up button to that preset with a parameter of 1 and also assign to it with a parameter of 0 for the release, and your down button with a parameter of 2 on press and also a parameter of 0 for release. This is what I mean by 'you give the parameter value in the assignment' 2. Create 3 distinct presets: BKSQ_Duke_CowlFlapSwitch_Up_L#1 (>L:var_cowlFlapSwitch_L) BKSQ_Duke_CowlFlapSwitch_Down_L#2 (>L:var_cowlFlapSwitch_L) BKSQ_Duke_CowlFlapSwitch_Off_L#0 (>L:var_cowlFlapSwitch_L) and assign to those in a similar manner. This is what I mean when I say 'Alternatively, you can hard-code the value into the preset and just use that'. Edited September 19 by John Dowson Typos corrected 1 Link to comment Share on other sites More sharing options...
SliderCDN Posted September 19 Author Report Share Posted September 19 Thank you for breaking it down like I'm two years old 😄 Much obliged! Link to comment Share on other sites More sharing options...
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