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

Another... Is this possible? Multi-Clicks

Messages
10,163
Country
us-arizona
Hey all,

I would like to know if it is possible to have a single click code (mouse click zone) that would;

* Start a system (power up)
* Click through 5 Enum's
* On the 5th Enum, have it start its timer scan thing
* Turn off on the 7th click (power down)


Powering up brings the HUD display out of the top of the dash (animation, 3D object) and starts the system.

What I do not know, is how to manage this in a click zone. I have my Font strings all setup and running with the timer, but I would like to expand/improve the system to have this multi-click feature, all on one button.


Is that possible? If so, can you give me a clue as to how it is done?


Here is the 2D display system code;
Note, no clickzone as it is only a display code, riding on the animated part holding the display polygon. The 'button' clickzone is a simple button in the VC that relays the 'startup' code which powers the animation AND the display code system.

Code:
<Macro Name="HUD_POWER_ON">(A:Electrical Master Battery,bool) (A:Avionics master switch,bool) (L:AVE POPUP HUD,bool) and</Macro>

<!--  DISENGAGED
<Element>
      <Visible> (A:Avionics master switch,bool) ! (A:Electrical Master Battery,bool) ! || </Visible>
      <Position X="0" Y="0"/>
      <Image Name="Infoscreen_OFF.bmp" Bright="Yes" ImageSizes="1000,691,1000,691"/>
</Element>
DISENGAGED  -->

<!--  =====================MAIN POWER SUPPLY ELEMENT================  -->
<Element>  
<Visible>@HUD_POWER_ON</Visible>

<!--  ===========================================================  SYSTEM CONTROLLER -->

    <Element>
      <Select>
         <Value>
                    (L:AVE POPUP HUD, bool) 1 ==
                    (L:T_HUD_START_TIME,enum) 0 == and
                             if{ 
                                (P:LOCAL TIME, enum) (>L:T_HUD_START_TIME,enum) 
                                1 (>L:T_HUD_START,enum) 
                                0 (>L:AVE POPUP ENUM1,enum)
                                } 
                           els{ }
					
                     (L:AVE POPUP HUD, bool) 0 ==					
                     (L:T_HUD_START_TIME,enum) 0 &gt; and
                           if{  
                              0 (>L:T_HUD_START,enum) 
                              0 (>L:T_HUD_START_TIME,enum)					
                             }
                        els{ }			
         </Value>
      </Select>
   </Element>
	

    <Element>
      <Select>
         <Value>
                       (L:T_HUD_START, enum) 1 == 
                       (P:LOCAL TIME, enum) (L:T_HUD_START_TIME,enum) - 5 &gt; and
                            if{ 
                              1 (>L:AVE POPUP ENUM1,enum)
                              } 
                         els{ }
         </Value>
      </Select>
   </Element>
	

    <Element>
      <Select>
         <Value>
                          (L:T_HUD_START, enum) 1 == 
                          (P:LOCAL TIME, enum) (L:T_HUD_START_TIME,enum) - 10 &gt; and
                                 if{ 	
                                    2 (>L:AVE POPUP ENUM1,enum)
                                    } 
                                els{ }
         </Value>
      </Select>
   </Element>

    <Element>
      <Select>
         <Value>
                         (L:T_HUD_START, enum) 1 == 
                         (P:LOCAL TIME, enum) (L:T_HUD_START_TIME,enum) - 15 &gt; and
                                 if{ 
                                   3 (>L:AVE POPUP ENUM1,enum)
                                   } 
                               els{ }
         </Value>
      </Select>
   </Element>
	
	
    <Element>
      <Select>
         <Value>
                  (L:T_HUD_START, enum) 1 == 
                  (P:LOCAL TIME, enum) (L:T_HUD_START_TIME,enum) - 20 &gt; and
                       if{ 
                         0 (>L:T_HUD_START_TIME,enum)
                         } 
                      els{ }
         </Value>
      </Select>
   </Element>

<!--  ===========================================================PAGE SYSTEM STARTS HERE  -->

<!--  =======================================HEADING  -->

	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 0 ==  
                                </Visible>
		<Position X="20" Y="0"/>
         <FormattedText X="380" Y="90" Bright="Yes" Length="3" Font="Nasalization" FontSize="110" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" WidthFit="Yes">
                  <String>%(360 (A:Plane heading degrees gyro, degrees) dnor near d 0 == ?)%!03d!</String>
         </FormattedText>
	</Element>


            <Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 0 ==  
                                </Visible>
		<Position X="20" Y="76"/>
         <FormattedText X="365" Y="40" Bright="Yes" Length="3" Font="Nasalization" FontSize="50" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" WidthFit="Yes">
                  <String>HEADING</String>
         </FormattedText>
            </Element>


<!--  ========================================ALTITUDE  -->
	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 1 ==  
                                </Visible>
		<Position X="10" Y="0"/>
         <FormattedText X="380" Y="90" Bright="Yes" Length="3" Font="Nasalization" FontSize="110" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" FixedWidth="Yes">
                            <String>%((A:Plane Altitude, feet) 20000 min 0 max)%!5.0f!</String>
         </FormattedText>
	</Element>

	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 1 ==  
                                </Visible>
		<Position X="20" Y="76"/>
         <FormattedText X="365" Y="40" Bright="Yes" Length="5" Font="Nasalization" FontSize="50" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" FixedWidth="Yes">
                  <String>ALTITUDE</String>
         </FormattedText>
	</Element>


<!--  ===================================AIRSPEED GROUNDSPEED  -->

	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 2 ==  
                                </Visible>
		<Position X="20" Y="0"/>
         <FormattedText X="380" Y="90" Bright="Yes" Length="3" Font="Nasalization" FontSize="110" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" FixedWidth="Yes">
        <String>%((A:AIRSPEED TRUE, knots) 9999 min 0 max)%!3d!</String>
         </FormattedText>
	</Element>


	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 2 ==  
                                </Visible>
		<Position X="20" Y="76"/>
         <FormattedText X="365" Y="40" Bright="Yes" Length="3" Font="Nasalization" FontSize="50" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" FixedWidth="Yes">
                  <String>AIRSPEED</String>
         </FormattedText>
	</Element>

<!--  ====================================OUTSIDE AIR TEMPERATURE  -->

	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 3 ==  
                                </Visible>
		<Position X="3" Y="0"/>
         <FormattedText X="380" Y="90" Bright="Yes" Length="3" Font="Nasalization" FontSize="110" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" FixedWidth="Yes">
        <String>%((A:ambient temperature, celsius) 999 min)%!+4d!C</String>
         </FormattedText>
	</Element>


	<Element>
		<Visible>
                                     (L:AVE POPUP ENUM1,enum) 3 ==  
                                </Visible>
		<Position X="6" Y="76"/>
         <FormattedText X="385" Y="40" Bright="Yes" Length="3" Font="Nasalization" FontSize="50" Color="White" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="Yes" FixedWidth="Yes">
                  <String>OUTSIDE AIR TEMP</String>
         </FormattedText>
	</Element>



<!--  ===========================================================END OF POWER RELATED SECTIONS  -->

  </Element>
 
Mainly, all I need is an expample of a multi-switch click zone code that would show how something like this would work.


Click, turns on system, enum 0 appears, animation rises out of dash
click, enum 1, turns off 0
click, enum 2, turns off 1
click, enum 3, turns off 2
click, enum 4, turns off 3, activates timed scan
click, turns off system.
 
That is simple, Bill. Use a variable to keep track of the clicks, then branch the action commands accordingly. Although you might like to be able to go backwards, just in case!

Code:
<Click>
  (M:Event) 'LeftSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) ++ 6 min (>L:MyClickCount, enum) }

  (M:Event) 'RightSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) -- 0 max (>L:MyClickCount, enum) }

  (L:MyClickCount,enum) 0 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 1 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 2 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 3 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 4 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 5 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 6 == if{ (* do what you need here *) }
</Click>
 
Sweeeeet!

Thanks Bill.

I figured there 'might' be a way, but didnt know the capabilities of a single click zone, other then 'visibility'.



Bill
 
Bill, if "it" is logical and consistent, there's a way to do "it."
 
Oh my, I love it when you stumble upon a gem when you were not even looking.

Code:
(L:MyClickCount, enum) ++ 6 min (>L:MyClickCount, enum)

(L:MyClickCount, enum) -- 0 max (>L:MyClickCount, enum)

Limiting the incrementing and decrementing of a variable. Much easier and cleaner then how I have been doing it.

Code:
(L:G500_MFDCursorPosition, number) 18 < 
   if{ (L:G500_MFDCursorPosition, number) ++ (>L:G500_MFDCursorPosition, number) } 

(L:G500_MFDCursorPosition, number) 1 >
   if{ (L:G500_MFDCursorPosition, number) -- (>L:G500_MFDCursorPosition, number) }

If I kept a notebook like Bill, that would definitely be in there. It might even be wiki worthy.
 
I'm delighted you like it, Daniel. I have to admit though that at first glance the use of min and max appear to make no sense at all...

...until you remember that in XML damn near everything is bass-ackwards, including normal, forward thinking logic! :rotfl:

The neat part is that this form is easily "templatable," meaning that you can quickly and easily create any min/max range for your switch or knob.
 
Another case of being able to write the same thing in more then one way of code. The simpler version seems to be the hardest, from what I have seen, or as Bill Leaming puts it, perhaps thinking overly complex leads to complex solutions, and simplistic thinking could be a direction towards simplistic solutions.


I have one for you, as I look at this. Is there a way to loop this? Could one have the code simply restart back at 0 again?
 
I have one for you, as I look at this. Is there a way to loop this? Could one have the code simply restart back at 0 again?

Code:
<Click>
  (M:Event) 'LeftSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) ++ (>L:MyClickCount, enum) }

  (M:Event) 'RightSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) -- (>L:MyClickCount, enum) }

  (L:MyClickCount,enum) 7 == if{ 0 (>L:MyClickCount,enum) } (* reset to zero *)
  (L:MyClickCount,enum) -1 == if{ 6 (>L:MyClickCount,enum) } (* reset to six *)

  (L:MyClickCount,enum) 0 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 1 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 2 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 3 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 4 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 5 == if{ (* do what you need here *) }
  (L:MyClickCount,enum) 6 == if{ (* do what you need here *) }
</Click>
 
Last edited:
Nice.... I was trying to think complex again, and the answer was a simple 'if' then go to 0 again.

Simplicity again shows its sophistication in design.
 
Code:
  (M:Event) 'LeftSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) ++ 6 min (>L:MyClickCount, enum) }

  (M:Event) 'RightSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) -- 0 max (>L:MyClickCount, enum) }

  (L:MyClickCount,enum) 7 == if{ 0 (>L:MyClickCount,enum) } (* reset to zero *)
  (L:MyClickCount,enum) -1 == if{ 6 (>L:MyClickCount,enum) } (* reset to six *)

I don't think this would work, since you are limiting the variable, then checking to see if it is above that limit.

Say (L:MyClickCount, enum) is already 6, and you left click. The desired result would be to reset to zero. However, the "limiter" in the LeftSingle will keep the variable at 6, therefor never meeting the later condition to reset to zero. The code prevents the variable from ever being set to anything greater than 6.

Try this instead.

Code:
  (M:Event) 'LeftSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) 6 ==
           if{ 0 (>L:MyClickCount, enum) }
           els{ (L:MyClickCount, enum) ++ (>L:MyClickCount, enum) }
      }

  (M:Event) 'RightSingle' scmp 0 ==
      if{ (L:MyClickCount, enum) 0 ==
           if{ 6 (>L:MyClickCount, enum) }
           els{ (L:MyClickCount, enum) -- (>L:MyClickCount, enum) }
      }
 
I don't think this would work, since you are limiting the variable, then checking to see if it is above that limit.

You are correct. I forgot to remove the min and max limiters... I've corrected my post accordingly, since I don't want to leave "bad script" around... :(
 
Back
Top