December 23, 20223 yr I'm using the slider on the X-Touch Mini as a landing gear lever. I have set up 3 detents with the following outputs: Detent 1: Output 0 - Down position. Detent 2: Output 64 - Off position if required. Detent 3: Output 127 - Up position. The output of the slider (0 to 127) is assigned to a variable L:Gear_LV_Pos. I am then running the following script (just the UP and DOWN positions for the TBM) every 1000ms as an aircraft automated script: (L:Gear_LV_Pos)·0·==·if{1·(>K:GEAR_DOWN)} (L:Gear_LV_Pos)·127·==·if{1·(>K:GEAR_UP)} Is this the correct way to do this, or is there a better way? Thanks, Daz
December 25, 20223 yr On 12/23/2022 at 10:34 PM, Dazzlercee23 said: I'm using the slider on the X-Touch Mini as a landing gear lever. I have set up 3 detents with the following outputs: Detent 1: Output 0 - Down position. Detent 2: Output 64 - Off position if required. Detent 3: Output 127 - Up position. The output of the slider (0 to 127) is assigned to a variable L:Gear_LV_Pos. I am then running the following script (just the UP and DOWN positions for the TBM) every 1000ms as an aircraft automated script: (L:Gear_LV_Pos)·0·==·if{1·(>K:GEAR_DOWN)} (L:Gear_LV_Pos)·127·==·if{1·(>K:GEAR_UP)} Is this the correct way to do this, or is there a better way? Thanks, Daz Hi Daz, what you have done is not wrong - but far from "best practice" I recommend the following script: x 127 / near (>K:GEAR_SET) Save this script, then remove the "x" and instead press "Insert Script Var" - this will insert a variable that does contain the axis value (0..127). Dividing this value by 127 does give you a value between 0 and 1 - near is rounding to either 0 or 1. And then sending this value to the GEAR_SET event... Click on Update after inserting the script variable! Then in the Axis assignment select this script - and that's it. No need to create an aircraft automated script. You script will be triggered automatically on every axis level change... This was the "general purpose" approach. Especially for the "Gear Up/Down" you can do even easier: Change Axis Min to 0, Axis Max to 1. Select "GEAR_SET" as event - and you're done, not even required to create your own script... 🙂 Regards, Funatic
December 25, 20223 yr Author Thanks, that's great. I think I got hung up on the 'detents' thing. Regards, Daz
December 25, 20223 yr The important lesson here is to understand the role of the "Script Variable" - this is also available for events triggered from a button (the variable does reflect the number on the top right of the button assignment box). This allows you to remove the AutoScript for polling variable changes. How to deal with that number in the script is then easy to do. Regards, Funatic Edited December 25, 20223 yr by Funatic
Archived
This topic is now archived and is closed to further replies.