• 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.

3 way switch

Messages
42
Country
us-iowa
I am trying to make a simple 3 way switch, off-on-start for an APU. Does anyone have a simple 3 way switch I can use. I tried:
<Cursor Type="Hand"/>
<Click>(L:APU_SWITCH, enum) if{ (L:APU_SWITCH, enum) 1 - (>L:APU_SWITCH, enum)
(&gt;K:APU_OFF_SWITCH)}</Click>
<Click>(L:APU_SWITCH, enum) if{ (L:APU_SWITCH, enum) 0 (> L:APU_SWITCH, enum)
(L:APU_GENERATOR_ACTIVE, Bool) ! (>L:APU_GENERATOR_ACTIVE, Bool)}</Click>
<Click>(L:APU_SWITCH, enum) if{ (L:APU_SWITCH, enum) 1 + (>L:APU_SWITCH, enum)
(&gt;K:APU_STARTER)}</Click>
and
<Area Right="30">
<Cursor Type="DownArrow"/>
<Click>(L:APU_SWITCH, enum) -1 != if{ (L:APU_SWITCH, enum) 1 - (>L:APU_SWITCH, enum) }</Click>
</Area>
<Area Left="30">
<Cursor Type="UpArrow"/>
<Click>(L:APU_SWITCH, enum) 1 != if{ (L:APU_SWITCH, enum) 1 + (> L:APU_SWITCH, enum) }</Click>
</Area>
with a seperate gauge
But neither one works.
 
Well the switch may be working. Still get 0 for the RPM and EGT. Must be in defining the APU. Have entered it in aircraft.cfg,
[Auxiliary Power Unit]
available = 1

Any help would be appreciated.
 
I am no XML expert... but your code makes no sense.

First you test to see if L:APU_SWITCH is 'true' then in one click you subtract 1 from it and then place the value back into L:APU_SWITCH. In the next click you test to see if L:APU_SWITCH is 'true' and if it is you push it on the stack, then put 0 into it. In the next click you do yet the same test of whether L:APU_SWITCH is 'true', at which point you add 1 to it and then push that result back into L:APU_SWITCH.

And that's just the top 3 click sections you've posted. In the bottom two click areas you're adding and subtracting from the L:APU_SWITCH variable.

I think your top part is totally doing nothing you intend.
 
Here is a four way switch. It works a bit like a joystick with the centre position being neutral. One position click and stay, two positions click and hold.
It controls one of the spill valves. The position of the valve itself is sent to the cabin pressurisation gauges as when open above 10,000feet the spill valves would constitute a slow depressurisation.
Code:
<Gauge Name="LEFT SPILL VALVE" Version="1.0">
<Update>
(L:SetSpill,bool) 0 ==
   if{
      2 (>L:SPILL, number) 100 (>L:spill_segment,enum)
      1 (>L:SetSpill, bool)
   }
</Update>

   <Element>
      <Select>
         <Value>(L:SPILLSWITCH,number)</Value>
         <Case Value="0">
            <Image Name="L_spill_off.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="L_spill_shut.bmp"/>
         </Case>
         <Case Value="2">
            <Image Name="L_spill_norm.bmp"/>
         </Case>
         <Case Value="3">
            <Image Name="L_spill_spill.bmp"/>
         </Case>
      </Select>
   </Element>

  <Mouse>
<Tooltip>Left Spill Valve %((L:spill_segment,enum) near)%!d!%%</Tooltip>
      <Area Left="0" Top="22" Right="13" Bottom="39">
         <Cursor Type="Hand"/>
         <Click Kind="LeftSingle+LeftRelease" Repeat="Yes">
            (M:Event) 'LeftSingle' scmp 0 == if{ 0 (>L:SPILL,number) 1 (>L:SPILLSWITCH,number) (L:spill_segment,enum) 0 &gt;
if{ (L:spill_segment,enum) -- (>L:spill_segment,enum) } }
         (M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:SPILL,number) 0 (>L:SPILLSWITCH,number) (L:spill_segment,enum) 0 &gt;
if{ (L:spill_segment,enum) -- (>L:spill_segment,enum) } }
        </Click>
      </Area>

Code:
<Gauge Name="Left Spill Indicator" Version="1.0">
   <Image Name="spillmask.bmp" Luminous="1"/>

   <Element>
      <Position X="200" Y="206"/>
      <Image Name="L_SPILL_IND.bmp" PointsTo="North" Luminous="1">
         <Axis X="146" Y="146"/>
      </Image>
      <Rotate>
          <Value Minimum="0" Maximum="100">(L:spill_segment,enum)</Value>
         <Nonlinearity>
            <Item Value="0" X="200" Y="344"/>
            <Item Value="25" X="146" Y="339"/>
            <Item Value="100" X="60" Y="240"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="30"/>
      </Rotate>
   </Element>

<Element>
      <Position X="0" Y="0"/>
      <Image Name="L_Spill Indicator.bmp"/>
   </Element>

   <Element>
      <Position X="188" Y="188"/>
      <Image Name="bar_1.bmp" PointsTo="North" Luminous="1">
         <Axis X="188" Y="188"/>
      </Image>
      <Rotate>
         <Value>(L:spill_segment,enum) 0 &gt;
if{ 1 } els{ 0 }</Value>
         <Nonlinearity>
            <Item Value="0" X="17" Y="188"/>
            <Item Value="1" X="171" Y="33"/>          
         </Nonlinearity>
         <Delay DegreesPerSecond="160"/>
      </Rotate>
   </Element>

   <Mouse>
      <Tooltip>Left Spill Indicator-%( (L:spill_segment,enum) )%{if}In-Line%{else}Cross_Lined%{end}</Tooltip>
   </Mouse>
</Gauge>
 
Here is my 3 way switch:

Code:
<Gauge Name="Select" Version="1.0">
  <Image Name="select_back.bmp" />
  <Size X="236" Y="86"/>

<Element> <!--  Selector Switch -->
   <Position X="86" Y="15"/>
      <Select>
         <Value> (G:Var3) </Value>
     <Case Value="0">
             <Image Name="switch_mid.bmp"/>
         </Case>
         <Case Value="1">
             <Image Name="switch_on.bmp"/>
         </Case>
         <Case Value="2">
             <Image Name="switch_off.bmp"/>
         </Case>
      </Select>
   </Element>

  <Mouse>
  <Area Left="71" Right="117" Top="0" Bottom="44">
  <Tooltip>Selector Switch</Tooltip>
  <Cursor Type="UpArrow"/>
  <Click>02 (&gt;L:km_xml_sound_id, number) (G:Var3) 0 == if{ 1 (&gt;G:Var3) } els{ 0 (&gt;G:Var3) }
  </Click>
  </Area>
  <Area Left="71" Right="117" Top="45" Bottom="90">
  <Tooltip>Selector Switch</Tooltip>
  <Cursor Type="DownArrow"/>
  <Click>02 (&gt;L:km_xml_sound_id, number) (G:Var3) 0 == if{ 2 (&gt;G:Var3) } els{ 0 (&gt;G:Var3) }
  </Click>
  </Area>
  </Mouse>
  <copyright>(c)2010 Tom Gibson</copyright>
</Gauge>

This code is set up so the middle position is the default. The km_xml_sound_id variables are used to create the click sounds.
 
Back
Top