FS2004 (SOLVED) Popup PFD Window (COMS) on Timer; open, close, delay options

#1
Hey all,

I am doing a COMS windows (frequencies) which popups up. It is on a timer and disappears after a moment so you do not have to click to close it.

Its terribly sophisticated. I am wondering if I can simplify it.

I would like to add some options. I tried doing some things to keep the timer going, like when you change a Frequency setting, the window continues to stay open, but my efforts didnt work. I would also like to have a 'close' button (small x at the top corner of the popup outline) so that you can clear out the area to see past it.

So... My question is, can I....
* Have a timer
* Have it 'add time' to the timer or do I need a alternate system that clicks in, like 'turn off that' turn on this'?
* Have a kill switch that turns off the timer?

Here is my 'adapted' popup code. Its from the Garmin bootup code I use that Bill Leaming did for me like 10+ years ago. Its the only thing I could get to work. (Yep, I am still bad a code. I bend polys best).


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

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

     <!-- Stop timer after 20 seconds -->
    <Element>
       <Select>
        <Value>
                            (L:3307COMMS Time,enum) 222 > if{ 0 (>L:3307COMMS Screen,enum) }
        </Value>
       </Select>
    </Element>

<!--                         // (L:3307COMMS Time,enum) 222 > if{ 0 (>L:3307COMMS Screen,enum) } -->

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

     <!-- While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
        <Visible>(L:3307COMMS Screen,enum) 1 == </Visible>
                               <Position X="1000" Y="0"/>
        <Image Name="RadiosBackground.bmp" ImageSizes="1500,681" Bright="Yes">
        </Image>
    </Element>
 
#2
absolutely yes. unfortunately I do the function in C++. this step
1. use mouse click and mouse release
2. made 1 function for timer and visibility var ( I think in XML it only need 1 function <Element> </Element>)
3. function will do: when time timer reach target value, then the visibility bool var will execute to off ( false). with visibility var false it will trigger reset the timer to 0.
4. mouse click for trigger animation, sound and 1 bool var (true) for visibility
5. mouse release for trigger time timer to start
6. function mouse release is: if switch is on hold ( by mouse click), timer will never start

in C++ it only need a few lines for function.
 

n4gix

Resource contributor
#4
That's simple enough Bill. Just reset the timer on every mouse click: 0 (>L:3307COMMS Time,enum) }
 
#5
Thanks Bill. I experimented with it and had a massive revelation. I saw how the darn thing works. All these years later and I finally understand how those many blocks of code function, lol... The entire department for that boot screen is based solely on only 3 strings;
* Switch
* Timer
* Effect (Object or Effect or Page)

With that understanding, I can do quite a bit. Doors opened. Many thanks... And thanks for this code many years ago. It has done a great deal over the years. Good to finally understand it.


Bill
 
#6
For those that might see this later in the future, here is a 'terminate window' code that closes the popup timer window if you want to close it early. The 'terminate' command uses a 'visibility' clickzone that only works when the window is open/up.

Code:
     <!-- COMMS WINDOW TERMINATE //////////////////////////////////////////// -->
      <Area Left="1385" Right="1450" Top="1" Bottom="74">
          <Visible>(L:3307COMMS Screen,enum) 1 == </Visible>
         <Tooltip>CLOSE COMMS CONSOLE</Tooltip>
            <Cursor Type="Hand"/>
             <Click Repeat="Yes">
        0 (>L:COMMS WAKEUP Switch,bool)
        0 (>L:3307COMMS Screen,enum)
        0 (>L:3307COMMS Time,enum)
             </Click>
      </Area>
Basically all you are doing is resetting all values back to zero for 'everything' in that Element block.

For the 'Add Time to Timer', it basically is the same as the regular timer. I havent extended the length from its original setting, only reset it as Bill Leaming suggested. I havent tried to change the max time setting. I would like to know if that can be done though without an argument in the code.

Code:
            </Area>  
             <Area Left="1280" Right="1444" Top="160" Bottom="226">
                  <Visible>(L:COMMS WAKEUP Switch,bool) 1 == </Visible>
                    <Tooltip>COM Decimal Dec</Tooltip>
                          <Cursor Type="UpArrow"/>
                    <Click>(>K:COM2_RADIO_FRACT_INC)
                            0 (>L:3307COMMS Time,enum)
                    </Click>
         </Area>
Note that this one also has a 'visibility' so the click zone which is only present when the window is open/running/active can be clicked on. Otherwise is goes silent/invisible.

Thanks for the help and input.



Bill
 
Top