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

P3D v3 Timer Click Page; trying to locate the error

Messages
10,088
Country
us-arizona
Hey all,

Trying to make a page that appears on the PFD screen when you click on the screen. The page would appear for a moment, then disappear after a short while.

I cannot seem to find the issue? Hoping someone might spot it.


Code:
<!-- TIMER PAGE EXPERIMENT 1 -->
     <!-- Initialize all variables -->
    <Element>
       <Select>
        <Value>
        (L:PFD_PAGE_ONE_SELECT,bool) 0 == if{
        0 (>L:PFDaltPAGEoneScreen,enum)
        0 (>L:PFDaltPAGEoneTime,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Start timer and increment when click zone is ON -->
    <Element>
       <Select>
        <Value>
        (L:PFD_PAGE_ONE_SELECT,bool) 1 &gt;
        if{ (L:L:PFDaltPAGEoneTime,enum) ++ (>L:PFDaltPAGEoneTime,enum) 1 (>L:L:PFDaltPAGEoneScreen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Stop timer after 20 seconds -->
    <Element>
       <Select>
        <Value>
        (L:L:PFDaltPAGEoneTime,enum) 74 > if{ 0 (>L:L:PFDaltPAGEoneScreen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- While the "bootscreen" variable is ON, display the page bitmap -->
    <Element>
        <Visible>(L:L:PFDaltPAGEoneScreen,enum) 1 == </Visible>
         <Position X="0" Y="0"/>
        <Image Name="SYROS_PFD_PAGEONE.bmp" ImageSizes="1500,681" Bright="Yes">
        </Image>
    </Element>


Code:
<!--  PAGE ONE WITH TIMER -->
   <Area Left="1" Top="1" Right="512" Bottom="200">
        <Tooltip>Test Page ONE</Tooltip>
         <Cursor Type="Hand"/>
        <Click Kind="LeftSingle">
                  1 (&gt;L:PFD_PAGE_ONE_SELECT,bool)
        </Click>
      </Area>


This is based off of Bill Leamings boot up screen gauge code;


Code:
<!-- BOOT SCREEN -->
     <!-- Initialize all variables when power is OFF -->
    <Element>
       <Select>
        <Value>
        (A:Avionics Master Switch,bool) 0 == (A:Electrical Master Battery,bool) 0 == || if{
        0 (>L:3308BootScreen,enum)
        0 (>L:3308BootTime,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Start timer and increment when both battery and avionics are ON -->
    <Element>
       <Select>
        <Value>
        (A:Avionics Master Switch,bool) (A:Electrical Master Battery,bool) and (L:3308BootTime,enum) 250 &lt;= and
        if{ (L:3308BootTime,enum) ++ (>L:3308BootTime,enum) 1 (>L:3308BootScreen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Stop timer after 20 seconds -->
    <Element>
       <Select>
        <Value>
        (L:3308BootTime,enum) 250 > if{ 0 (>L:3308BootScreen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
        <Visible>(L:3308BootScreen,enum) 1 == </Visible>
         <Position X="96" Y="41"/>
        <Image Name="Garmin_PFD_Bootup_screen.bmp" ImageSizes="769,602" Bright="Yes">
        </Image>
    </Element>

The code immediately above (bottom code block) works perfectly, but runs off of conditions of 'power off', not a click zone.
 
Messages
542
Country
australia
I'm not sure if the following is of any help .

I have a Radar with 17 buttons , the following allows any of those buttons when clicked to glow green for 4 sixth of a second to show
that the button has been clicked .

In the first Macro the "4" represents " 4 sixth of a second " .
If you want a momentary display of 20 seconds , change the "4" to "120" , ( 20 x 6 = 120 ) .

The following example is in FSX syntax , and it shows an example applicable to 2 buttons .
Code:
        <Update>
        <Script>
        (L:Switch_Timer, number) 0 != if{ (L:Switch_Timer, number) -- (>L:Switch_Timer, number) }
        (L:Switch_Timer, number) 0 == if{ 0 (>L:Switch_Number, number) }
         </Script>      
        </Update>

       <Macro id="TIMER_ENG" Name="TIMER_ENG">
            <MacroValue>4 (&gt;L:Switch_Timer, number) @1 (&gt;L:Switch_Number, number)</MacroValue>
        </Macro>
        <Macro id="TIMER_EVAL" Name="TIMER_EVAL">
            <MacroValue>(L:Switch_Number, number) @1 == (L:Switch_Timer, number) 0 != and</MacroValue>
        </Macro>
     
     
        <Element id="RSE_1">
            <FloatPosition>5.000,19</FloatPosition>
            <Select id="Select">
                <Expression id="Expression">
                    <Script>@TIMER_EVAL(1)</Script>
                </Expression>
                 <Case id="Case">
                    <ExpressionResult>1</ExpressionResult>
                    <Image id="Image" Name="DATA_GLO.bmp">
                        <Transparent>True</Transparent>
                        <Bright>True</Bright>
                    </Image>
                </Case>
            </Select>
        </Element>
        <Element id="APT_2">
            <FloatPosition>5.000,77</FloatPosition>
            <Select id="Select">
                <Expression id="Expression">
                    <Script>@TIMER_EVAL(2)</Script>
                </Expression>
                 <Case id="Case">
                    <ExpressionResult>1</ExpressionResult>
                    <Image id="Image" Name="DATA_GLO.bmp">
                        <Transparent>True</Transparent>
                        <Bright>True</Bright>
                    </Image>
                </Case>
            </Select>
        </Element>

            <MouseArea id="COMP">
                <FloatPosition>7.000,23.000</FloatPosition>
                <Size>40,40</Size>
                <CursorType>Hand</CursorType>
                <HelpId>HELPID_GAUGE_RADAR_COMPASS_ROSE</HelpId>
            <MouseClick id="MouseClick">
                  <Script>(M:Event) 'LeftSingle' scmp 0 ==
                                 if{ (L:xLayerVehicles) 1 ==
                                    if{ @TIMER_ENG(1) 0 (>L:xLayerVehicles) } els{ @TIMER_ENG(1) 1 (>L:xLayerVehicles) } }
                          (M:Event) 'RightSingle' scmp 0 ==
                                 if{ @TIMER_ENG(1) (L:LayerCompass) ++ 2 % (&gt;L:LayerCompass) }</Script>                            
                    <ClickType>LeftSingle+RightSingle</ClickType>
                                 </MouseClick>
            </MouseArea>
            <MouseArea id="APT">
                <FloatPosition>7.000,81.000</FloatPosition>
                <Size>40,40</Size>
                <CursorType>Hand</CursorType>
                <HelpId>HELPID_GAUGE_RADAR_AIRPORTS</HelpId>
                <MouseClick id="MouseClick">
                    <Script>@TIMER_ENG(2) (L:LayerAirports) ++ 3 % (&gt;L:LayerAirports)</Script>
                </MouseClick>
            </MouseArea>

Cheers
Karol

EDIT;
My apologies , I omitted the "Update" section in the above code box .
It has now been added .
 
Last edited:
Messages
10,088
Country
us-arizona
Many thanks, Karol. I have a couple of questions on the code. I work with FS9 code, so this is slightly difficult for me to translate. I know the core code is the same, but I see some things I havent seen before;

1.
<Script>@TIMER_EVAL(2)</Script>
@TIMER_ENG(1) (L:LayerCompass) ++ 2 % (&gt;L:LayerCompass) (second one that I do not understand)

This has a (2) in it. What does this signify?

2.
4 (&gt;L:Switch_Timer, number) @1 (&gt;L:Switch_Number, number)

What does the @1 signify?

Sorry for the questions.


Bill
 
Messages
10,088
Country
us-arizona
UREKA! Got it... Thanks to Dwight for the ancient code back in the Epic LT days.

When clicked in that zone, the 'something you want to show up' will appear for 5 seconds. Change the - 5 &lt; to something like - 10 for 10 seconds, etc, to change timing.

Posting it for future users of FS9 XML code...

Code block....
Code:
    <Element>
    <Visible> (P:Absolute time, seconds) (L:CRS CLICK START, seconds) - 5 &lt; </Visible>
         <Position X="225" Y="17"/>
       <Image Name="SYROS_PFD_PAGEONE.bmp"/>
     </Element>

Mouse Click Zone.....
Code:
      <Area Left="1" Right="937" Top="1" Bottom="309">
         <Tooltip>CRS LEFT</Tooltip>
            <Cursor Type="DownArrow"/>
             <Click Repeat="Yes"> (P:Absolute time, seconds) (&gt;L:CRS CLICK START, seconds) </Click>
      </Area>


Does not require a section in the Update zone at the top of the gauge.


Bill
LHC
 
Messages
10,088
Country
us-arizona
I just wonder how might one incorporate a way to make it also an on/off... like, if you wished to turn it off before its assigned time passes?

Can you set seconds and tell it its over on seconds? Like command zero seconds into the timer? Push command?

This was a try...

Code:
      <Area Left="1" Right="937" Top="1" Bottom="309">
     <Visible> (&gt;L:CRS CLICK START, seconds) 0 &lt; </Visible>
         <Tooltip>PAGE TWO</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> (P:Absolute time, seconds) (&gt;L:CRS CLICK START, seconds) </Click>
      </Area>

      <Area Left="1" Right="937" Top="1" Bottom="309">
     <Visible> 1 5 (&gt;L:CRS CLICK START, seconds) rng </Visible>
         <Tooltip>PAGE TWO</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> 0 (&gt;L:CRS CLICK START, seconds) </Click>
      </Area>

The idea was a visible click zones. One shows up with timer running, one shows up when timer is off. Click it to turn it on... starts running. Click again, new click zone 'turns off' the timer. But... Can you turn off a timer? and how would you write that?
 
Messages
10,088
Country
us-arizona
Eureka @(2)

This creates a timer window which will auto-close out after 10 seconds. You can click on it again to turn it off and it resets.

Code:
    <Element>
    <Visible> (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) - 11 &lt; and </Visible>
         <Position X="1000" Y="0"/>
       <Image Name="RadiosBackground.bmp"/>
     </Element>

    <Element>
          (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:COMMS WINDOW ACTIVE, bool) }
     </Element>


Click zone.....

Code:
     <!-- COMMS WINDOW //////////////////////////////////////////// -->
      <Area Left="1000" Right="1500" Top="1" Bottom="140">
         <Tooltip>COMMS</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> (P:Absolute time, seconds) (&gt;L:COMMS CLICK START, seconds)
                                              (L:COMMS WINDOW ACTIVE, bool) ! (>L:COMMS WINDOW ACTIVE, bool)
             </Click>
      </Area>


For those that are not code sharp, like me, what this does is put a secondary condition into the mix, an on/off, that must be in the dual check system. You turn off the on/off and the window blinks out as it needs both conditions to function.
But, if you let the timer run out, the on/off switch remains on, so you need a new Element that will turn off (reset) the on/off switch when that timer for that window reaches zero. So that is what the second Element does.
 
Messages
10,088
Country
us-arizona
I am editing the above gauge by trading out the secondary code block and moving that to an Update section at the top of the gauge.

So you would now have this at the top;

Code:
<Update>
          (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) 0 &lt; and
               if{ 0 (>L:COMMS WINDOW ACTIVE, bool) }
</Update>

This is the code block in the stack order inside the gauge;

Code:
    <Element>
    <Visible> (L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) - 11 &lt; and </Visible>
         <Position X="1000" Y="0"/>
       <Image Name="RadiosBackground.bmp"/>
     </Element>


And this is the click zone for on and off modes;

Code:
     <!-- COMMS WINDOW //////////////////////////////////////////// -->
      <Area Left="1350" Right="1500" Top="1" Bottom="140">
         <Tooltip>COMMS CONSOLE</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> (P:Absolute time, seconds) (&gt;L:COMMS CLICK START, seconds)
                                              (L:COMMS WINDOW ACTIVE, bool) ! (>L:COMMS WINDOW ACTIVE, bool)
             </Click>
      </Area>


I can now use this code as a 'visibility' code for component Element sections that show up when this (above) is active;

(L:COMMS WINDOW ACTIVE, bool) 1 ==

When this is off, those elements labeled with this visibility will then disappear with that window when the timer goes off, shuts down, goes invisible, leaves this universe and dimension as we know it...


EDIT: The code is now requiring to be clicked twice to restart the page view. It turns off, and you click it, nothing happens. You click it again, it boots up. I'll need to see if I can figure out whats going on there. I moved the string of code from Update section back to the Elements section, that made no difference.
 
Last edited:
Messages
10,088
Country
us-arizona
And again, note that this appears for 11 seconds, and if you click on the click zones again, it disappears and clears itself... OR..... or you can just let the timer ride it out and it auto-shuts off and clears itself.
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
Shouldn't this line:

Code:
(L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) 0 &lt; and

Have a - sign subtracting the P: and L: variable? Like this?

Code:
(L:COMMS WINDOW ACTIVE, bool) 1 == (P:Absolute time, seconds) (L:COMMS CLICK START, seconds) - 0 &lt; and
 
Messages
10,088
Country
us-arizona
Many thanks Tom. I tried it, but nothing happened. Same issue with requiring another click. The 'appearance' function is working great though, now. It just will not reset properly. It needs to be clicked twice to 'restart' the 'appearance' mode.


Bill
 
Messages
10,088
Country
us-arizona
Can someone suggest a way to create a 'visibility' for this code? I have been working on a way and nothing I am doing seems to work.

This is one of my versions;

Code:
     <!-- COMMS WINDOW //////////////////////////////////////////// -->
      <Area Left="1385" Right="1450" Top="10" Bottom="74">
         <Tooltip>COMMS CONSOLE</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes"> 
                  (P:Absolute time, seconds) (&gt;L:COMMS CLICK START, seconds) 
                  (L:COMMS WINDOW ACTIVE, bool) ! (>L:COMMS WINDOW ACTIVE, bool)
                  (L:COMMS WINDOW ACTIVE, bool) 1 == 
                        if{ 1 (>L:COMMS WINDOW MOUSE FLAG, bool) }
                      els{ 0 (>L:COMMS WINDOW MOUSE FLAG, bool) }
             </Click>
      </Area>


   <Area Left="1280" Right="1444" Top="50" Bottom="137">
                  <Visible>(>L:COMMS WINDOW MOUSE FLAG, bool) 1 ==</Visible>
           <Tooltip>COM Decimal Inc</Tooltip>
                <Cursor Type="UpArrow"/>
           <Click>(>K:COM_RADIO_FRACT_INC)</Click>
   </Area>

I have tried using all of these as flags, but nothing is working. On this one, I created a third string that is activated just for the 'visibility' click zones, which go active when the COMMS zone is active. This keeps the click zones for the radios from being on the screen unless the console is up.

Any idea's are most welcome.


Bill
 
Messages
10,088
Country
us-arizona
Well, that partially worked.

Oddly, once you have clicked on the Timer command, it needs to be clicked again (a second time) to clear out the 'visible' click zones.
1. The timer turns on
2. Click zones become active/visible
3. Timer turns off (epires) or you click and turn it off
4. Click zones still active
5. Click the click zone for the timer window and the invisible visible clickzones disappear.

Does this mean the timer is still running?
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
You have overlapping mouse rectangles, perhaps this is confusing you or FS?
 
Messages
10,088
Country
us-arizona
Hey Tom,

Negative. I do have overlapping zones, but I am clicking on the right area.

I tried re-writing new versions of the codes and they all did the same thing. They only work if I click on the main, first code I did, the timer window. If that is active, then I can click on the other two and they work fine. I had even created a new version, then redid it again, and it still did this. The COMMS window must be running for the others to work.
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
We'd need to see all of the code for the gauges involved to check if there is some kind of loop generated between gauges.
 
Messages
10,088
Country
us-arizona
Tom, I sent you a link via IM.

If anyone else wants to give it a look over to see if you can figure it out, let me know. I'll send you a link.


Bill
 
Messages
10,088
Country
us-arizona
Tom, I think I have a better solution.

I redid Fr. Bill's 'Bootup screen' (page) code with timer and it resets properly and so far, its not interfering.

Here is my newest working code for a timer window visibility.
I must have been dealing with a string that is locking up things with a loop. This is totally custom font, not using the P:Absolute Time... code. So this must go around that issue.


Code:
<!-- AI SCREEN -->
     <!-- Initialize all variables when power is OFF -->
    <Element>
       <Select>
        <Value>
        (L:AI WAKEUP Switch,bool) 0 == if{
        0 (>L:3307AIScreen,enum)
        0 (>L:3307AITime,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Start timer and increment when both battery and avionics are ON -->
    <Element>
       <Select>
        <Value>
        (L:AI WAKEUP Switch,bool) 1 == (L:3307AITime,enum) 250 &lt;= and
        if{ (L:3307AITime,enum) ++ (>L:3307AITime,enum) 1 (>L:3307AIScreen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Stop timer after 20 seconds -->
    <Element>
       <Select>
        <Value>
        (L:3307AITime,enum) 74 > if{ 0 (>L:3307AIScreen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Reset Wakeup when timer is turned off -->
    <Element>
       <Select>
        <Value>
                            (L:AI WAKEUP Switch,bool) 1 ==
        (L:3307AITime,enum) 74 > and
                                  if{ 0 (>L:AI WAKEUP Switch,bool) }
        </Value>
       </Select>
    </Element>

     <!-- While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
        <Visible>(L:3307AIScreen,enum) 1 == </Visible>
         <Position X="0" Y="0"/>
        <Image Name="SYROSaiFACEpanel.bmp" ImageSizes="1500,681" Bright="Yes">
        </Image>
    </Element>


// MOUSE SECTION

     <!-- AI WINDOW TEST TEST //////////////////////////////////////////// -->
      <Area Left="1" Right="150" Top="400" Bottom="499">
         <Tooltip>AWAKEN AI SYSTEM</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes">
                  (L:AI WAKEUP Switch,bool) ! (>L:AI WAKEUP Switch,bool)
             </Click>
      </Area>

I am going to rebuild all the timer window sections with this code and test it.
 
Messages
10,088
Country
us-arizona
Yep... This system is much nicer. No issues. The on/off cancel before it shuts down also works brilliant, and no need to 'second click' it to get it to go back up again.

Please excuse my weak coding capabilities. I bend poly's and paint them. This is not easy for me.
 
Top