• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX Autopilot Coding Question

Messages
76
Country
unitedkingdom
Hi all,

Just wondered if anyone new the answer to this one. I am creating a 2D Panel for Carenado Commander 500 on the VC the auto pilot has a master on switch prior to turning on the panel auto on switch.
The code for on button is below and the full gauge below that. So wondered if anyone new the terminology for element Value and click to create master on switch separate to this gauge.
Many thanks
Matt

Element Value <Value>(L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) 0 !=</Value>

Mouse area click <Click> 1 (>L:BUFFER_CLICK1_PLASTIC,number) (L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) 0 == if{ 1 (>L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) } els{ 0 (>L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) } </Click>



Code:
<Gauge Name="Autopilot" Version="1.2">
 <Image Name="AP_background.bmp"/>
<Element>
 <Position X="412" Y="46"/>
<Select>
 <Value>(L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) 0 !=</Value>
<Case Value="0">
 <Image Name="AP_Off.bmp"/>
 </Case>
<Case Value="1">
 <Image Name="AP_On.bmp"/>
 </Case>
 </Select>
 </Element>
<Element>
 <Position X="493" Y="46"/>
<Select>
 <Value>(A:Autopilot Heading Lock,bool)</Value>
<Case Value="0">
 <Image Name="AP_HDG_Off.bmp"/>
 </Case>
<Case Value="1">
 <Image Name="AP_HDG_On.bmp"/>
 </Case>
 </Select>
 </Element>
<Element>
 <Position X="495" Y="230"/>
<Image Name="Roll_Knob.bmp">
 <Axis X="63.5" Y="63.5"/>
 </Image>
<Rotate>
 <Value> (L:RK,number)</Value>
<Nonlinearity>
 <Item Value="-3" Degrees="-36"/>
 <Item Value="-2" Degrees="-24"/>
 <Item Value="-1" Degrees="-12"/>
 <Item Value="0" Degrees="0"/>
 <Item Value="1" Degrees="12"/>
 <Item Value="2" Degrees="24"/>
 <Item Value="3" Degrees="36"/>
 </Nonlinearity>
 </Rotate>
 </Element>
<Element>
 <Position X="574" Y="46"/>
<Select>
 <Value>(A:Autopilot Altitude Lock,bool)</Value>
<Case Value="0">
 <Image Name="AP_ALT_Off.bmp"/>
 </Case>
<Case Value="1">
 <Image Name="AP_ALT_On.bmp"/>
 </Case>
 </Select>
 </Element>
<Element>
 <Position X="654" Y="46"/>
<Select>
 <Value>(A:AUTOPILOT ATTITUDE HOLD,bool)</Value>
<Case Value="0">
 <Image Name="AP_ROLL_Off.bmp"/>
 </Case>
<Case Value="1">
 <Image Name="AP_ROLL_On.bmp"/>
 </Case>
 </Select>
 </Element>
<Element>
 <Position X="828" Y="46"/>
<Select>
 <Value>(L:WHEEL,bool)</Value>
<Case Value="0">
 <Image Name="AP_WHEEL_2.bmp"/>
 </Case>
<Case Value="1">
 <Image Name="AP_WHEEL_1.bmp"/>
 </Case>
 </Select>
 </Element>
<Element>
 <Position X="0" Y="0"/>
<Select>
 <Value>(A:Autopilot Master,bool) (A:AUTOPILOT ATTITUDE HOLD,bool) 0 == and if{ (L:RK,number) -0.2 2048 * * (>K:AILERON_SET) } </Value>
 </Select>
 </Element>
<Element>
 <Position X="0" Y="0"/>
<Select>
<Value>
  (L:APSELWheelDN, number) 0 > (L:APSELWheelUP, number) 0 > or if{ 0 (>L:APSELWheelDN, number) 0 (>L:APSELWheelUP, number) (L:AP2SEL,number) -2 == if{ (A:AUTOPILOT NAV1 LOCK,BOOL) 0 == if{ (>K:AP_NAV1_HOLD_ON) } } (L:AP2SEL,number) -1 == if{ (A:AUTOPILOT NAV1 LOCK,BOOL) 0 == if{ (>K:AP_NAV1_HOLD_ON) } } (L:AP2SEL,number) 0 == if{ (A:AUTOPILOT APPROACH HOLD,BOOL) 0 != if{ (>K:AP_APR_HOLD_OFF) } (A:AUTOPILOT BACKCOURSE HOLD,BOOL) 0 != if{ (>K:AP_BC_HOLD_OFF) } (A:AUTOPILOT NAV1 LOCK,BOOL) 0 != if{ (>K:AP_NAV1_HOLD_OFF) } } (L:AP2SEL,number) 1 == if{
<!--         1 (>K:AP_BC_HOLD_OFF)
 -->
  (A:AUTOPILOT BACKCOURSE HOLD,BOOL) 0 == if{ (A:AUTOPILOT APPROACH HOLD,BOOL) 0 == if{ (>K:AP_APR_HOLD_ON) } } els{ (A:AUTOPILOT BACKCOURSE HOLD,BOOL) 0 != if{ (>K:AP_BC_HOLD_OFF) } }
<!--     1 (>K:AP_NAV1_HOLD_ON)
 -->
  } (L:AP2SEL,number) 2 == if{ (A:AUTOPILOT BACKCOURSE HOLD,BOOL) 0 == if{ (>K:AP_BC_HOLD_ON) } } }
 </Value>
 </Select>
 </Element>
<Mouse>
<Area Left="412" Top="46" Width="80" Height="90">
 <Cursor Type="Hand"/>
 <Click> 1 (>L:BUFFER_CLICK1_PLASTIC,number) (L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) 0 == if{ 1 (>L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) } els{ 0 (>L:ASD_SWITCH_A500S_AUTOPILOT_MASTER_DUMMY,number) } </Click>
 <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_MASTER"/>
 </Area>
<Area Left="493" Top="46" Width="80" Height="90">
 <Cursor Type="Hand"/>
 <Click> 1 (>L:BUFFER_CLICK1_PLASTIC,number) (>K:AP_PANEL_HEADING_HOLD) </Click>
 <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_HEADING_HOLD"/>
 </Area>
<Area Left="574" Top="46" Width="80" Height="90">
 <Cursor Type="Hand"/>
 <Click> 1 (>L:BUFFER_CLICK1_PLASTIC,number) (>K:AP_ALT_HOLD) </Click>
 <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_ALTITUDE_HOLD"/>
 </Area>
<Area Left="655" Top="46" Width="80" Height="90">
 <Cursor Type="Hand"/>
 <Click> 1 (>L:BUFFER_CLICK1_PLASTIC,number) (A:Autopilot Heading Lock,bool) (>L:HDG,bool) (>K:AP_ATT_HOLD) (L:HDG,bool) 0 != if{ (>K:AP_HDG_HOLD_ON) } </Click>
 <Tooltip>%Attitude hold (%((A:AUTOPILOT ATTITUDE HOLD,bool) 0 >)%{if}On%{else}Off%{end})%{end}</Tooltip>
 </Area>
<Area Left="425" Top="165" Width="126" Height="126">
<Area Left="0" Right="63">
 <Cursor Type="DownArrow" Repeat="Yes"/>
 <Click Repeat="Yes" MouseWheelFlip="Yes"> (L:RK,number) 3 < if{ (L:RK,number) 1 + (>L:RK,number) } </Click>
 </Area>
<Area Left="64" Right="126">
 <Cursor Type="UpArrow" Repeat="Yes"/>
 <Click Repeat="Yes" MouseWheelFlip="Yes"> (L:RK,number) -3 > if{ (L:RK,number) 1 - (>L:RK,number) } </Click>
 <Tooltip>%Autopilot Turn (%( (L:RK,number) )%!d!)</Tooltip>
 </Area>
 </Area>
<Area Left="818" Top="46" Width="42" Height="86">
 <Cursor Type="DownArrow"/>
 <Click Kind="LeftSingle + LeftRelease"> (M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:WHEEL,bool) 1 (>L:BUFFER_BTN_DIM, number) } (M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:WHEEL,bool) } (L:WHEEL,bool) 1 == if{ (>K:AP_PITCH_REF_INC_UP) } </Click>
 <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_PITCH_REF"/>
 </Area>
<Area Left="818" Top="132" Width="42" Height="86">
 <Cursor Type="UpArrow"/>
 <Click Kind="LeftSingle + LeftRelease"> (M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:WHEEL,bool) 1 (>L:BUFFER_BTN_DIM, number) } (M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:WHEEL,bool) } (L:WHEEL,bool) 1 == if{ (>K:AP_PITCH_REF_INC_DN) } </Click>
 <Tooltip ID="TOOLTIPTEXT_AUTOPILOT_PITCH_REF"/>
 </Area>
<!--
  <Area Left="700" Top="9" Width="72" Height="63">
        <Cursor Type="Hand" />
        <Click>755 (>K:PANEL_ID_TOGGLE)</Click>
       </Area>

 -->
 </Mouse>
 </Gauge>
 
Last edited:
Thanks Bob I Have saved those for future reference. Looking at the those the obvious answer would a standard autopilot master on however that did not work.

I just wondered if anyone had come across something similar where it seems the VC gauge has total control over seem. EG even my Saitek Auto master wont turn on unless the master auto pilot is on in VC.
 
Some people (me anyway) have all the work done in the 2D gauge, The VC gauge is just for display. If you have identical gauge code in both the VC and the 2D version there will be problems.
 
Many times one has to look at the interior visual .mdl with a hex editor to get what is going on with systems as they are coded within the click.
As usual, this (name withheld) designer is doing some very weird stuff and it looks like there is some logic gauge that takes care of the human commands to interface with the simulator commands.
The following code from the AS500 should get you going though. (gives me a headache looking at it :banghead: )

EDIT - Looked at it again. In a nutshell for (L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_DIR,number)
-1 = Test
0 = OFF
1 = ON

XML:
<!-- THE TOOLTIP -->
Switch autopilot master (%((L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_DIR,number) 1 +)%{case}%{:0}Test%{:1}OFF%{:2}On%{end})

<!-- THE CLICK SPOT -->
<!-- VARS WITH "BUFFER" ARE SOUND COMMANDS -->

1 (>L:BUFFER_PC12_Switch_metal,number)

(M:Event) 'LeftSingle'   scmi 0 ==  if{
    1 (>L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_DIR,number)
}

(M:Event) 'RightSingle'  scmi 0 == if{
    (L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_DIR,number) 1 == if{
        0 (>L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_DIR,number)
        }
     
        els{
            (A:ELECTRICAL MASTER BATTERY,BOOL) (A:CIRCUIT GENERAL PANEL ON,bool) and
                if{ 1 (>L:BUFFER_APDISCONNECT, number) }
            (P:local time,seconds) 2.0 + (>L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_TIMER) -1 (>L:ASD_A500S_SWITCH_MASTER_AUTOPILOT_DIR,number)
            }      
}
 
Last edited:
Wow thanks Spokes I will give it a whirl tomorrow

cute-kid-point-at-you-awesome-meme.jpg
 
Back
Top