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

Make VC gauge (p3d)

I'm afraid I am a little bit lost in this case, and probably of little use to you, because I have no idea what a texture sheet is or where it comes into this - I have never used one.

Do you not have a number of bmps depicting the Agent switch options, one each for DISCH DARK, SQUIB LIGHT UPPER and DISCH LIGHT?

If you do, then why not simply rotate them in an editor?

Or is this all to do with the fact that this appears in a VC?

Wow, life gets complicated, don't it?

(Looking at the A340 Panel in Google and how the Fire Protection System works:

DISCH DARK is the background bmp, nothing illuminated

SQUIB LIGHT UPPER, with a white SQUIB illuminated, shows when the Fire Button for that engine is pressed

DISCH LIGHT, with DISCH illuminated, would show when the Agent button has been pressed.

Without the texture sheet complication, this switch would probably be an easy one to implement - though I probably would never have thought or dared to use the complicated formula in the Value clause. )
"Rotate the bmps" - don't know why I didn't think of that! That works, thanks again! :)
 
If in doubt - Rotate the bmps!

My motto!

The SQUIB and DISCH lights illuminate when the test button in the middle of the Fire Protection Panel is pressed - that function will probably (hopefully!) get more action than experiencing an engine fire. That functionality will have to be built into the eight Agent switches.

Walter
 
Alright sir, I got another one for you;

How do I make a gauge with rotating .bmp

For example I want to make a course knob, but have the bmp rotate as I click on it

Thanks!

1695760802782.png
 
Hi Adrian,

I am sure there are many ways of doing what you require but this is how I achieve it, at the moment

Code:
<Gauge Name="Course Knob" Version="1.0">
<Image Name="Course Gauge BG.bmp"/>

<Element>
<Position X="60" Y="60"/>
<Image Name="Course Knob.bmp" Luminous="No" PointsTo="East">
<Axis X="55" Y="55"/>
</Image>
   <Rotate>
      <Value Minimum="0" Maximum="7">(L:CourseWheelCount,number)</Value>
      <Nonlinearity>
         <Item Value="0" Degrees="0"/>
         <Item Value="1" Degrees="45"/>
         <Item Value="2" Degrees="90"/>
         <Item Value="3" Degrees="135"/>
         <Item Value="4" Degrees="180"/>
         <Item Value="5" Degrees="225"/>
         <Item Value="6" Degrees="270"/>
         <Item Value="7" Degrees="315"/>
       </Nonlinearity>
   </Rotate>
</Element>

<Element>
    <Position X="10" Y="115"/>
  <Text X="60" Y="38" Bright="Yes" Length="3" Font="Arial" Color="Blue" BackgroundColor="Black"
  Adjust="Left" VerticalAdjust="Center">
  <String>%((A:NAV1 OBS, degrees))%!03d!</String>
  </Text>
</Element>



<Mouse>

<Tooltip>Course</Tooltip>
<Area Left="5" Right="115" Top="5" Bottom="115">
     <Cursor Type="Grab"/>
      <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">
        (M:Event) 'LeftSingle' scmp 0 ==
             (M:Event) 'WheelUp' scmp 0 == or
              if{ 0 (&gt;K:VOR1_OBI_INC)
                  (L:CourseWheelCount,number) ++ 8 % (&gt;L:CourseWheelCount,number) }
        (M:Event) 'RightSingle' scmp 0 ==
            (M:Event) 'WheelDown' scmp 0 == or
              if{ 0 (&gt;K:VOR1_OBI_DEC)
                    (L:CourseWheelCount,number) -- d 0 &lt; 8 * + (&gt;L:CourseWheelCount,number) }
      </Click>
</Area>

</Mouse>


</Gauge>

I attach the files I used to test it. Once again I had difficulty using the .png you attached, I had to convert it to .bmp.

I show the course resulting from the knob twisting.

I have very limited testing facilities.

Try it out and let me know.

Walter
 

Attachments

  • CourseKnob.zip
    2.6 KB · Views: 95
Sorry to trouble you again, but I have one hopefully last ask. I'm trying to make a switch that has three positions. Down is OFF, middle is NAV lights and up is NAV+LOGO lights. how should I do this?

Edit: I guess this is not a gauge, but rather xml animation code for a 3D switch in the VC.. if you have any input-thanks!

<PartInfo>
<Name>switch_nav_logo_330</Name>
<Animation>
<Parameter>
<Code> (l:switch_nav_logo_330, bool) 50 * </Code>
<Lag>400</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Three-Way Light Switch (NAV & LOGO)</TooltipText>
<MouseFlags>LeftSingle+RightSingle</MouseFlags>
<CallbackCode>
(l:switch_nav_logo_330, bool) 1 == if{
0 (>a:TOGGLE_NAV_LIGHTS, bool) 0 (>a:TOGGLE_LOGO_LIGHTS, bool)
} els if{
1 (>a:TOGGLE_NAV_LIGHTS, bool) 0 (>a:TOGGLE_LOGO_LIGHTS, bool)
} els{
1 (>a:TOGGLE_NAV_LIGHTS, bool) 1 (>a:TOGGLE_LOGO_LIGHTS, bool)
}
</CallbackCode>
</MouseRect>
</PartInfo>
 
Last edited:
Hi Adrian,

Here is one of the many way this is achievable, a bit clunky perhaps.

Code:
<Gauge Name="NavLogo XML" Version="1.0">
<Image Name="NavLogo Gauge BG.bmp"/>

<Element>
    <Position X="0" Y="0"/>
   <Element>
      <Select>
         <Value>(L:NavLogo Switch Pos,number)</Value>
         <Case Value="0">
            <Image Name="NavLogo Switch 0.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="NavLogo Switch 1.bmp"/>
         </Case>
         <Case Value="2">
            <Image Name="NavLogo Switch 2.bmp"/>
         </Case>
      </Select>
   </Element>
</Element>


<Mouse>

<Tooltip>NavLogo</Tooltip>
     <Cursor Type="Grab"/>
      <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">
        (M:Event) 'LeftSingle' scmp 0 ==
             (M:Event) 'WheelUp' scmp 0 == or
              if{ (L:NavLogo Switch Pos,number) 2 &lt;
                  if{ (L:NavLogo Switch Pos,number) ++ (&gt;L:NavLogo Switch Pos,number)
                      (L:NavLogo Switch Pos,number) 0 ==
                          if{ (A:LIGHT NAV,bool) 1 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 1 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 2 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 0 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } } } }

        (M:Event) 'RightSingle' scmp 0 ==
            (M:Event) 'WheelDown' scmp 0 == or
              if{ (L:NavLogo Switch Pos,number) 0 &gt;
                  if{ (L:NavLogo Switch Pos,number) -- (&gt;L:NavLogo Switch Pos,number)
                      (L:NavLogo Switch Pos,number) 0 ==
                          if{ (A:LIGHT NAV,bool) 1 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 1 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 2 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 0 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } } } }
      </Click>

</Mouse>


</Gauge>

You need your three .bmps for OFF, Nav only and Nav + LOGO.

I cannot guarantee it will work because the aircraft I am using controls the lights in its own way and won't let me turn them on using this switch.

Also I know nothing about VC, I only use my gauges in a 2D situation.

Try it out and let me know.


Walter
 

Attachments

  • NavLogo.zip
    2.1 KB · Views: 86
Last edited:
You continue to impress! That gauge is perfect. I'm still trying to piece together how to combine it 3D switch in the VC, but you're code certainly helps bring me closer to that

Many thanks again for your help and time!!
 
I'm still trying to piece together how to combine it 3D switch in the VC
You just need to create a switch in 3D and animate it three positions in, say, 5 frames, 0-5-10.

Then bind it to the code written in modeldef.xml.

For example.
XML:
  <Animation name="NavLogo Switch Pos" guid="xxxxxxxxxxxxxxxxx-xxxxxxxx-xxxxxxxxxxxx" typeParam2="NavLogo Switch Pos" length="10" type="Sim" typeParam="AutoPlay" />
  <PartInfo>
    <Name>NavLogo Switch Pos</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:NavLogo Switch Pos,number) 5 *</Code>
      </Parameter>
    </Animation>
  </PartInfo>
  <!--  NavLogo Switch Pos MouseRect     -->
  <PartInfo>
    <Name>NavLogo Switch Pos_0</Name>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle+RightSingle+WheelDown+WheelUp</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
             (M:Event) 'WheelUp' scmp 0 == or
              if{ (L:NavLogo Switch Pos,number) 2 &lt;
                  if{ (L:NavLogo Switch Pos,number) ++ (&gt;L:NavLogo Switch Pos,number)
                      (L:NavLogo Switch Pos,number) 0 ==
                          if{ (A:LIGHT NAV,bool) 1 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 1 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 2 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 0 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } } } }
        (M:Event) 'RightSingle' scmp 0 ==
            (M:Event) 'WheelDown' scmp 0 == or
              if{ (L:NavLogo Switch Pos,number) 0 &gt;
                  if{ (L:NavLogo Switch Pos,number) -- (&gt;L:NavLogo Switch Pos,number)
                      (L:NavLogo Switch Pos,number) 0 ==
                          if{ (A:LIGHT NAV,bool) 1 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 1 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }
                      (L:NavLogo Switch Pos,number) 2 ==
                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }
                              (A:LIGHT LOGO,bool) 0 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } } } }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

It is desirable to exclude NavLogo Switch Pos from the spaces and write NavLogo_Switch_Pos. This makes it easier to use in code, search, and compiler interpretation, and is more reliable.

You can also simplify the code in the animation and write it more compactly.

For example.
XML:
  <Animation name="NavLogo_Switch_Pos" guid="xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" typeParam2="NavLogo_Switch_Pos" length="10" type="Sim" typeParam="AutoPlay" />
  <PartInfo>
    <Name>NavLogo_Switch_Pos</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:NavLogo_Switch_Pos, number) 5 *</Code>
      </Parameter>
    </Animation>
  </PartInfo>
  <!--  NavLogo_Switch_Pos MouseRect     -->
  <PartInfo>
    <Name>NavLogo_Switch_Pos_0</Name>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle+RightSingle+WheelDown+WheelUp</MouseFlags>
      <CallbackCode>
          (M:Event) 'WheelUp' scmp 0 == if{ 0 (&gt;L:NavLogo_Switch_Pos, number) }
          (M:Event) 'WheelDown' scmp 0 == if{ 0 (&gt;L:NavLogo_Switch_Pos, number) }
          (M:Event) 'RightSingle'   scmi 0 == (L:NavLogo_Switch_Pos, number) 2 != and if{ 2 (&gt;L:NavLogo_Switch_Pos, number) }
          (M:Event) 'LeftSingle'   scmi 0 == (L:NavLogo_Switch_Pos, number) 1 != and if{ 1 (&gt;L:NavLogo_Switch_Pos, number) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

And the very logic of the work of K: variables should be written to XML or C++ by separately creating a stub device and creating its initialization in Panel.cfg when loading the model. But that's up to you.

For example.
XML:
<Gauge Name="Main_Processor" Version="1.0">

<!-- ======== SYSTEM INIT ============ -->
(L:ES1, enum) 24 &lt; if{ (L:ES1, enum) ++ (&gt;L:ES1, enum) 120473 (&gt;K:PANEL_ID_OPEN) } els{ (L:ES1, enum) 36 &lt; if{ (L:ES1, enum) ++ (&gt;L:ES1, enum) 120473 (&gt;K:PANEL_ID_CLOSE) } }

   <Element>
      <Select>
         <Value>

                      (L:NavLogo_Switch_Pos,number) 0 ==

                          if{ (A:LIGHT NAV,bool) 1 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }

                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }

                      (L:NavLogo_Switch_Pos,number) 1 ==

                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }

                              (A:LIGHT LOGO,bool) 1 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }

                      (L:NavLogo_Switch_Pos,number) 2 ==

                          if{ (A:LIGHT NAV,bool) 0 == if{ 0 (&gt;K:TOGGLE_NAV_LIGHTS) }

                              (A:LIGHT LOGO,bool) 0 == if{ 0 (&gt;K:TOGGLE_LOGO_LIGHTS) } }

    </Value>
      </Select>
   </Element>

 </Gauge>
 
The entry above from KAI31 just reinforces my aversion to 3D and the VC - wow, that seems to involve a lot of brain power and careful planning!

I am all for the easy 2D life - although at times there is this longing...

Walter
 
that seems to involve a lot of brain power and careful planning!
No problem at all. In addition to the fact that it is much easier to interact with variables and devices directly, it also allows you to greatly expand your capabilities. And the stubs that I wrote are needed precisely in order for outdated 2D instrument scripts to work and be initialized in 2D views; you can do without them, for a long time already without 2D at all, and many people have initialization cameras in 3D. In 20 there is no 2D at all and everything is ok.

To taste and color as you please. There are always more opportunities than one might imagine.
 
No problem at all. In addition to the fact that it is much easier to interact with variables and devices directly, it also allows you to greatly expand your capabilities. And the stubs that I wrote are needed precisely in order for outdated 2D instrument scripts to work and be initialized in 2D views; you can do without them, for a long time already without 2D at all, and many people have initialization cameras in 3D. In 20 there is no 2D at all and everything is ok.

To taste and color as you please. There are always more opportunities than one might imagine.
Ok I have to ask one more thing. I used the template for another combination of lights to have the same function but with the taxi and takeoff lights instead. The taxi light is the default variable, whereas the takeoff light is a custom variable by me. Problem is the takeoff lights aren't going on in sim. I don't know if it's the EventIds or something to do with the "&gt:" part but any advice your be much appreciated:

This is animation and below that is the custom takeoff light variable
<PartInfo> <Name>switch_taxi_takeoff</Name> <AnimLength>50</AnimLength> <Animation> <Parameter> <Code>(L:switch_taxi_takeoff,number) 25 *</Code> </Parameter> </Animation> </PartInfo> <!-- NavLogo Switch Pos MouseRect --> <PartInfo> <Name>switch_taxi_takeoff_0</Name> <MouseRect> <Cursor>Hand</Cursor> <TooltipText>Taxi and Takeoff Light Switch</TooltipText> <MouseFlags>LeftSingle+RightSingle+WheelDown+WheelUp</MouseFlags> <CallbackCode> (M:Event) 'LeftSingle' scmp 0 == (M:Event) 'WheelUp' scmp 0 == or if{ (L:switch_taxi_takeoff,number) 2 &lt; if{ (L:switch_taxi_takeoff,number) ++ (&gt;L:switch_taxi_takeoff,number) (L:switch_taxi_takeoff,number) 0 == if{ (A:LIGHT TAXI,bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 1 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 2 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 0 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } } } (M:Event) 'RightSingle' scmp 0 == (M:Event) 'WheelDown' scmp 0 == or if{ (L:switch_taxi_takeoff,number) 0 &gt; if{ (L:switch_taxi_takeoff,number) -- (&gt;L:switch_taxi_takeoff,number) (L:switch_taxi_takeoff,number) 0 == if{ (A:LIGHT TAXI,bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 1 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 2 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 0 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } } } </CallbackCode> </MouseRect> </PartInfo>

<PartInfo> <Name>switch_takeoff_light</Name> <Animation> <Parameter> <Code> (L:LIGHT_TAKEOFF,bool) 50 * </Code> <Lag>400</Lag> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <TooltipText>Takeoff Light Switch</TooltipText> <MouseFlags>LeftSingle+RightSingle</MouseFlags> <CallbackCode> (L:LIGHT_TAKEOFF, bool) ! (>L:LIGHT_TAKEOFF, bool) </CallbackCode> </MouseRect> </PartInfo>

I have made a visibility condition for this takeoff light variable and it works as an independent switch, but not combined with the taxi light there.
 
Last edited:
Hi!
Initially, you confuse the triggering of events K: . 0 (&gt;K:TOGGLE_TAXI_LIGHTS) will be triggered every time it is used to change the values between TRUE and FALSE and (A:LIGHT TAXI, bool) 0 == is an additional check condition for the dependence of the setting of the required settings on the event K: which sets it to 1 or 0. 0 (&gt;K:TOGGLE_TAXI_LIGHTS) in this application the digit is not assigned as a value, and in any case, if the dependency logic allows, switching between TRUE(1) and FALSE(0) works

Event IDs Prepar3D are described here http://www.prepar3d.com/SDKv3/LearningCenter/utilities/variables/event_ids.html

Simulation Variables here http://www.prepar3d.com/SDKv3/LearningCenter/utilities/variables/simulation_variables.html

With L: Variables, you must set the value to be assigned to the variable depending on the conditions. 0 (&gt;L:LIGHT_TAKEOFF,bool) or 1 (&gt;L:LIGHT_TAKEOFF,bool). (L:LIGHT_TAKEOFF, bool) ! ( L:LIGHT_TAKEOFF, bool) changes the values when subbating (acting on a variable) similar to K:event, switching between TRUE - FALSE

0 (>L:LIGHT_TAKEOFF, bool) is always set to zero in your code.

Also, if you want to interact with variables to switch TAXI_LIGHTS and LANDING_LIGHTS you need to include them in the logic of your code using event variables (K:LANDING_LIGHTS_TOGGLE) or (K:LANDING_LIGHTS_OFF), (K:LANDING_LIGHTS_ON) and (A:LIGHT LANDING, bool).

If you want to add a dependency on another radio button to your logic, you need to create another variable for it.

And finally, in order for the animation to work and the code to work, you need the conditions for clicking the mouse buttons ( (M:Event) 'XxxxXxx' scmp 0 ==) at least.

The assignment sign (>) in the Prepar3D code logic is read in the same way as &gt;

Think about it, and if that doesn't work, I'll write you an example of logic for your conditions.
 
Last edited:
Thanks for getting back to me. I've tried altering some of the code to my understanding of what you wrote, but I'm still getting lost 😅. If you could provide an example that would be much appreciated.
 
Thanks for getting back to me. I've tried altering some of the code to my understanding of what you wrote, but I'm still getting lost 😅. If you could provide an example that would be much appreciated.
XML:
<PartInfo>
    <Name>switch_taxi_takeoff</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:switch_taxi_takeoff,number) 25 *</Code>
      </Parameter>
    </Animation>
  </PartInfo>
  <!--  NavLogo Switch Pos MouseRect     -->
  <PartInfo>
    <Name>switch_taxi_takeoff_0</Name>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>Taxi and Takeoff Light Switch</TooltipText>
      <MouseFlags>LeftSingle+RightSingle+WheelDown+WheelUp</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==

             (M:Event) 'WheelUp' scmp 0 == or

              if{ (L:switch_taxi_takeoff,number) 2 &lt;

                  if{ (L:switch_taxi_takeoff, number) ++ (&gt;L:switch_taxi_takeoff, number)
  <!-- Turn off taxi and landing lights  -->
                      (L:switch_taxi_takeoff,number) 0 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn on taxi lights and turn off landing lights  -->
                      (L:switch_taxi_takeoff,number) 1 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn off taxi lights and turn on landing lights  -->
                      (L:switch_taxi_takeoff,number) 2 ==
                          if{ (A:LIGHT TAXI, bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON) } } } }

        (M:Event) 'RightSingle' scmp 0 ==
            (M:Event) 'WheelDown' scmp 0 == or
              if{ (L:switch_taxi_takeoff,number) 0 &gt;
                  if{ (L:switch_taxi_takeoff,number) -- (&gt;L:switch_taxi_takeoff,number)
  <!-- Turn off taxi and landing lights  -->
                      (L:switch_taxi_takeoff,number) 0 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn on taxi lights and turn off landing lights  -->
                      (L:switch_taxi_takeoff,number) 1 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn off taxi lights and turn on landing lights  -->
                      (L:switch_taxi_takeoff,number) 2 ==
                          if{ (A:LIGHT TAXI, bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON) } } } }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

<PartInfo>
    <Name>switch_takeoff_light</Name>
    <Animation>
       <Parameter>
       <Code> (L:LIGHT_TAKEOFF,bool) 50 * </Code>
        <Lag>400</Lag>
       </Parameter>
    </Animation>
<MouseRect>
       <Cursor>Hand</Cursor>
       <TooltipText>Takeoff Light Switch</TooltipText>
        <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
                           (M:Event) 'RightSingle' scmp 0 == (L:LIGHT_TAKEOFF, bool) ! (&gt;L:LIGHT_TAKEOFF, bool)
               (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON)
                           (L:LIGHT_TAKEOFF, bool) 0 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF)
                           (M:Event) 'LeftSingle' scmp 0 == (L:LIGHT_TAKEOFF, bool) ! (&gt;L:LIGHT_TAKEOFF, bool)
               (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON)
                           (L:LIGHT_TAKEOFF, bool) 0 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF)
          </CallbackCode>
    </MouseRect>
</PartInfo>

Here's an example! doing what you want. You can specify everything more clearly and add dependencies between switches, checking for power supply in the network and other conditions.

Please note that the animation code and related parameters in the model itself are executed only during initialization with the mouse. The rest of the time is uncontrolled and the switches do not check each other all the time.

In order for everything to work more clearly and harmoniously, and also to be able to change and control the logic at any time without compiling the model every time, I recommend writing all additional code in separate C++ or XML devices in the model panel.
 
Last edited:
XML:
<PartInfo>
    <Name>switch_taxi_takeoff</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:switch_taxi_takeoff,number) 25 *</Code>
      </Parameter>
    </Animation>
  </PartInfo>
  <!--  NavLogo Switch Pos MouseRect     -->
  <PartInfo>
    <Name>switch_taxi_takeoff_0</Name>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipText>Taxi and Takeoff Light Switch</TooltipText>
      <MouseFlags>LeftSingle+RightSingle+WheelDown+WheelUp</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==

             (M:Event) 'WheelUp' scmp 0 == or

              if{ (L:switch_taxi_takeoff,number) 2 &lt;

                  if{ (L:switch_taxi_takeoff, number) ++ (&gt;L:switch_taxi_takeoff, number)
  <!-- Turn off taxi and landing lights  -->
                      (L:switch_taxi_takeoff,number) 0 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn on taxi lights and turn off landing lights  -->
                      (L:switch_taxi_takeoff,number) 1 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn off taxi lights and turn on landing lights  -->
                      (L:switch_taxi_takeoff,number) 2 ==
                          if{ (A:LIGHT TAXI, bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON) } } } }

        (M:Event) 'RightSingle' scmp 0 ==
            (M:Event) 'WheelDown' scmp 0 == or
              if{ (L:switch_taxi_takeoff,number) 0 &gt;
                  if{ (L:switch_taxi_takeoff,number) -- (&gt;L:switch_taxi_takeoff,number)
  <!-- Turn off taxi and landing lights  -->
                      (L:switch_taxi_takeoff,number) 0 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn on taxi lights and turn off landing lights  -->
                      (L:switch_taxi_takeoff,number) 1 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn off taxi lights and turn on landing lights  -->
                      (L:switch_taxi_takeoff,number) 2 ==
                          if{ (A:LIGHT TAXI, bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON) } } } }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

<PartInfo>
    <Name>switch_takeoff_light</Name>
    <Animation>
       <Parameter>
       <Code> (L:LIGHT_TAKEOFF,bool) 50 * </Code>
        <Lag>400</Lag>
       </Parameter>
    </Animation>
<MouseRect>
       <Cursor>Hand</Cursor>
       <TooltipText>Takeoff Light Switch</TooltipText>
        <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
                           (M:Event) 'RightSingle' scmp 0 == (L:LIGHT_TAKEOFF, bool) ! (&gt;L:LIGHT_TAKEOFF, bool)
               (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON)
                           (L:LIGHT_TAKEOFF, bool) 0 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF)
                           (M:Event) 'LeftSingle' scmp 0 == (L:LIGHT_TAKEOFF, bool) ! (&gt;L:LIGHT_TAKEOFF, bool)
               (L:LIGHT_TAKEOFF, bool) 1 == (A:LIGHT LANDING, bool) 0 == and if{ 0 (&gt;K:LANDING_LIGHTS_ON)
                           (L:LIGHT_TAKEOFF, bool) 0 == (A:LIGHT LANDING, bool) 1 == and if{ 0 (&gt;K:LANDING_LIGHTS_OFF)
          </CallbackCode>
    </MouseRect>
</PartInfo>

Here's an example! doing what you want. You can specify everything more clearly and add dependencies between switches, checking for power supply in the network and other conditions.

Please note that the animation code and related parameters in the model itself are executed only during initialization with the mouse. The rest of the time is uncontrolled and the switches do not check each other all the time.

In order for everything to work more clearly and harmoniously, and also to be able to change and control the logic at any time without compiling the model every time, I recommend writing all additional code in separate C++ or XML devices in the model panel.
Thanks for that. Unfortunately that didn't seem to work. If possible can you do 0(down) is both Taxi and Takeoff Lights Off, 25(middle) Taxi lights on, and 50(up) both taxi and takeoff lights on.
I'm also a bit confused about the landing lights and takeoff lights. The takeoff light is a custom variable, so does it need to be associated with a sim defined K: variable (ex. K:LANDING_LIGHTS_ON)? .. if that makes sense

Everything about this code works fine (down: both off, middle: taxi on), except in the up position the custom takeoff lights are off - so I'm guessing theres a missing link to the animation

<PartInfo> <Name>switch_taxi_takeoff</Name> <AnimLength>50</AnimLength> <Animation> <Parameter> <Code>(L:switch_taxi_takeoff,number) 25 *</Code> </Parameter> </Animation> </PartInfo> <!-- NavLogo Switch Pos MouseRect --> <PartInfo> <Name>switch_taxi_takeoff_330_0</Name> <MouseRect> <Cursor>Hand</Cursor> <TooltipText>Taxi and Takeoff Light Switch</TooltipText> <MouseFlags>LeftSingle+RightSingle+WheelDown+WheelUp</MouseFlags> <CallbackCode> (M:Event) 'LeftSingle' scmp 0 == (M:Event) 'WheelUp' scmp 0 == or if{ (L:switch_taxi_takeoff,number) 2 &lt; if{ (L:switch_taxi_takeoff,number) ++ (&gt;L:switch_taxi_takeoff,number) (L:switch_taxi_takeoff,number) 0 == if{ (A:LIGHT TAXI,bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 1 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 2 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 0 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } } } (M:Event) 'RightSingle' scmp 0 == (M:Event) 'WheelDown' scmp 0 == or if{ (L:switch_taxi_takeoff0,number) 0 &gt; if{ (L:switch_taxi_takeoff0,number) -- (&gt;L:switch_taxi_takeoff,number) (L:switch_taxi_takeoff,number) 0 == if{ (A:LIGHT TAXI,bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 1 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 1 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } (L:switch_taxi_takeoff,number) 2 == if{ (A:LIGHT TAXI,bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) } (L:LIGHT_TAKEOFF,bool) 0 == if{ 0 (&gt;L:LIGHT_TAKEOFF,bool) } } } } </CallbackCode> </MouseRect> </PartInfo>
 
Last edited:
If possible can you do 0(down) is both Taxi and Takeoff Lights Off, 25(middle) Taxi lights on, and 50(up) both taxi and takeoff lights on.
You can easily do this yourself by changing the values directly in the code.

XML:
  <!-- Turn off taxi and landing lights  -->
                      (L:switch_taxi_takeoff,number) 0 ==
                          if{ (A:LIGHT TAXI, bool) 1 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (A:LIGHT LANDING, bool) 1 == if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn on taxi lights and turn off landing lights  -->
                      (L:switch_taxi_takeoff,number) 1 ==
                          if{ (A:LIGHT TAXI, bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (A:LIGHT LANDING, bool) 1 == if{ 0 (&gt;K:LANDING_LIGHTS_OFF) } }
  <!-- Turn on taxi lights and turn on landing lights  -->
                      (L:switch_taxi_takeoff,number) 2 ==
                          if{ (A:LIGHT TAXI, bool) 0 == if{ 0 (&gt;K:TOGGLE_TAXI_LIGHTS) }
                              (A:LIGHT LANDING, bool) 0 == if{ 0 (&gt;K:LANDING_LIGHTS_ON) } } } }


I didn't check this particular code in my models, since all the logic of events and dependencies is stored in separate modules of the dashboard system code.

K: events in such code logic as you have are mandatory because you can set changes to the values in the variable (A: LIGHT LANDING, bool), which is responsible for the posdochny light, in this case, without using external C++ code, you can only do this and the sim will not interact with the device in any other way.

Make sure that you have exactly what you have in the model, assigned in 3D to an auxiliary object, and correctly installed (expanded and registered effect) landing light, custom or default.
 
Thanks! So basically, I can't use my custom takeoff light without the landing light (or whichever sim defined event I link it to)?

<PartInfo> <Name>switch_takeoff_light</Name> <Animation> <Parameter> <Code> (L:LIGHT_TAKEOFF,bool) 50 * </Code> <Lag>400</Lag> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <TooltipText>Takeoff Light Switch</TooltipText> <MouseFlags>LeftSingle+RightSingle</MouseFlags> <CallbackCode> (L:LIGHT_TAKEOFF, bool) ! (>:L:LIGHT_TAKEOFF, bool) </CallbackCode> </MouseRect> </PartInfo>

When It's on it's own like this, my take off light switch works no problem controlling because I've defined a visibility condition and whatnot. Its just when I try to combine it with the default taxi light I have the problem
 
So to make up this code. It is basically perfect for what I want except, at position 2, even though taxi and takeoff lights have a 1 in front of them, only the takeoff light is on. So it goes from both off, to taxi on, to taxi off takeoff on

<PartInfo> <Name>switch_taxi_takeoff_330</Name> <AnimLength>50</AnimLength> <Animation> <Parameter> <Code> (L:switch_taxi_takeoff_330, enum) 0 == if{ 0 } (L:switch_taxi_takeoff_330, enum) 1 == if{ 25 } (L:switch_taxi_takeoff_330, enum) 2 == if{ 50 } </Code> <Lag>400</Lag> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <TooltipText>TAxi Takeoff Light Switch</TooltipText> <MouseFlags>WheelDown+WheelUp+LeftSingle+RightSingle</MouseFlags> <CallbackCode> (M:Event) 'LeftSingle' scmp 0 == (M:Event) 'WheelDown' scmp 0 == or if{ (L:switch_taxi_takeoff_330, enum) ++ s0 2 &gt; if{ 0 } els{ l0 } (&gt;L:switch_taxi_takeoff_330, enum) (L:switch_taxi_takeoff_330, enum) (L:switch_taxi_takeoff_330, enum) 1 == if{ 1 (&gt;K:TOGGLE_TAXI_LIGHTS) 0 (&gt;L:LIGHT_TAKEOFF) } (L:switch_taxi_takeoff_330, enum) 2 == if{ 1 (&gt;K:TOGGLE_TAXI_LIGHTS) 1 (&gt;L:LIGHT_TAKEOFF) } } (M:Event) 'RightSingle' scmp 0 == (M:Event) 'WheelUp' scmp 0 == or if{ (L:switch_taxi_takeoff_330, enum) -- s0 0 &lt; if{ 2 } els{ l0 } (&gt;L:switch_taxi_takeoff_330, enum) (L:switch_taxi_takeoff_330, enum) (L:switch_taxi_takeoff_330, enum) 1 == if{ 1 (&gt;K:TOGGLE_TAXI_LIGHTS) 0 (&gt;L:LIGHT_TAKEOFF) } (L:switch_taxi_takeoff_330, enum) 2 == if{ 1 (&gt;K:TOGGLE_TAXI_LIGHTS) 1 (&gt;L:LIGHT_TAKEOFF) } } </CallbackCode> </MouseRect> </PartInfo>
 
Back
Top