FS2004 Triggering a timer window with events? FS9 code

#1
Hey all,

I have a timer window (Message Center) in a PFD screen. Works excellent. Appears for the amount of time I need.

I want to have the window popup when events happen, like 'gear up and locked', or flaps percent 1 > etc.

I setup my flags in the Update section, link them to trigger my Message Center switch...

and.....................

nothing... Nothing happens.

What might I be doing wrong?

This is what I have;

Code:
     <!-- Start timer and increment when both battery and avionics are ON -->
    <Element>
       <Select>
        <Value>
        (L:MESSAGE CENTER Switch,bool) 1 == (L:3303MESSAGE CENTER Time,enum) 250 &lt;= and
        if{ (L:3303MESSAGE CENTER Time,enum) ++ (>L:3303MESSAGE CENTER Time,enum) 1 (>L:3303MESSAGE CENTER Screen,enum)
                                 4 (>L:TIER2 CLICK LAYER,enum) }
        </Value>
       </Select>
    </Element>
The above works fine. The trigger is L:MESSAGE CENTER Switch,bool

This below is the update center section for this system;

Code:
<Update>
(A:GEAR RIGHT POSITION, percent) 100 ==
             if{ 4 (>L:MESSAGE CENTER Switch,bool) }
(A:GEAR RIGHT POSITION, percent) 0 ==
             if{ 4 (>L:MESSAGE CENTER Switch,bool) }
(A:SPOILERS LEFT POSITION, percent) 100 ==
             if{ 4 (>L:MESSAGE CENTER Switch,bool) }
(A:FLAPS HANDLE PERCENT,percent) 1 &gt; 
             if{ 4 (>L:MESSAGE CENTER Switch,bool) }

</Update>
There are other parts in the Update that do not relate to this, so I left those out for simplicity.

The Message Center Switch should trigger, right? What might I be doing wrong?

What happens is the switch on the screen locks up, the screen (message popup window) doesnt show up when events happen, nor can I bring it up with the Update section having these active.

Do I need a secondary switch in the mix?
 
#2
I changed bool to enum in the Update center flags. But... The switch system is locked.

This is the revised Update section;

Code:
(A:GEAR RIGHT POSITION, percent) 100 ==
             if{ 1 (>L:MESSAGE CENTER Switch,bool) }
(A:GEAR RIGHT POSITION, percent) 0 ==
             if{ 1 (>L:MESSAGE CENTER Switch,bool) }
(A:SPOILERS LEFT POSITION, percent) 100 ==
             if{ 1 (>L:MESSAGE CENTER Switch,bool) }
(A:FLAPS HANDLE PERCENT,percent) 1 &gt;
             if{ 1 (>L:MESSAGE CENTER Switch,bool) }
 
#3
I gave this a try, a trick to keeping the window open, resetting the timer while its running to extend its time, but of course it needs to be active. Thought I would at least give it a shot.

Code:
(A:GEAR RIGHT POSITION, percent) 100 ==
             if{ 0 (>L:3303MESSAGE CENTER Time,enum) }
(A:GEAR RIGHT POSITION, percent) 0 ==
             if{ 0 (>L:3303MESSAGE CENTER Time,enum) }
(A:SPOILERS LEFT POSITION, percent) 100 ==
             if{ 0 (>L:3303MESSAGE CENTER Time,enum) }
(A:FLAPS HANDLE PERCENT,percent) 1 &gt;
             if{ 0 (>L:3303MESSAGE CENTER Time,enum) }
 
#4
This is the message center section, which again, runs excellent without my newest addition to the Updates section to try to flag it on with events.

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

     <!-- Start timer and increment when both battery and avionics are ON -->
    <Element>
       <Select>
        <Value>
        (L:MESSAGE CENTER Switch,bool) 1 == (L:3303MESSAGE CENTER Time,enum) 250 &lt;= and
        if{ (L:3303MESSAGE CENTER Time,enum) ++ (>L:3303MESSAGE CENTER Time,enum) 1 (>L:3303MESSAGE CENTER Screen,enum)
                                 4 (>L:TIER2 CLICK LAYER,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Stop timer after 20 seconds -->
    <Element>
       <Select>
        <Value>
        (L:3303MESSAGE CENTER Time,enum) 200 > if{ 0 (>L:3303MESSAGE CENTER Screen,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Reset Wakeup when timer is turned off -->
    <Element>
       <Select>
        <Value>
                            (L:MESSAGE CENTER Switch,bool) 1 ==
        (L:3303MESSAGE CENTER Time,enum) 200 > and
                                  if{ 0 (>L:MESSAGE CENTER Switch,bool) }
        </Value>
       </Select>
    </Element>

     <!-- While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
          <Element>
                       <Visible>(L:3303MESSAGE CENTER Screen,enum) 1 == </Visible>
              <Position X="526" Y="0"/>
    <Element>
       <Image Name="MessageCenter.bmp"/>
    </Element>
        <Element Name="OVERSPEED ALERT MESSAGE">
              <Position X="0" Y="100"/>
        <FormattedText X="500" Y="200" Length="6" Multiline="Yes" Fixed="Yes" Font="SpaceOutExtended" FontSize="20" Color="#43EAF0" Adjust="Center" Bright="Yes" >
           <Color Value="Yellow"/>
           <Color Value="Red"/>
           <Color Value="#8dff3b"/>
               <String>%((A:BRAKE PARKING INDICATOR,bool))%{if}PARK BRAKE ON\n%{end}
                             %((A:AIRSPEED INDICATED, knot) @VNE &gt; )%{if}OVERSPEED\n%{end}
                       \{clr2}
                             %((A:Exit Open:0,bool) 1 == )%{if}REAR CANOPY OPEN\n%{end}
                             %((A:Exit Open:1,bool) 1 == )%{if}FRONT CANOPY OPEN\n%{end}
                       \{clr3}
                             %((A:PITOT HEAT,bool) !)%{if}PITOT HT OFF\n%{end}
                             %((A:FLAPS HANDLE PERCENT,percent) 1 &gt;)%{if}STOL MODE ACTIVE\n%{end}
                             %((A:SPOILERS LEFT POSITION,percent) 1 &gt;)%{if}AIR BRAKE DEPLOYED\n%{end}
                       \{clr4}
                             %((A:GEAR RIGHT POSITION,percent) 100 ==)%{if}GEAR DOWN LOCKED\n%{end}
                             %((A:GEAR RIGHT POSITION,percent) 0 ==)%{if}GEAR UP LOCKED\n%{end}
               </String>
              </FormattedText>
            </Element>
         </Element>
When something happens, like flaps, I wish to have the screen popup, show you the message, then hide again. The timer does it well, but the automatic popup without clicking the message icon is what is messing
 
#5
Ok... Got her to popup, but... it stays on. Its over-riding the timer which I had a feeling it might. The timer should automatically kill the switch, which it normally does, but I have the switch in the updates now also. Probably a flooding issue.

This is the working revised code in the Updates section that now brings up the window.

Code:
(A:GEAR RIGHT POSITION, percent) 100 ==
             if{ (L:MESSAGE CENTER Switch,bool) ! (>L:MESSAGE CENTER Switch,bool) }
(A:GEAR RIGHT POSITION, percent) 0 ==
             if{ (L:MESSAGE CENTER Switch,bool) ! (>L:MESSAGE CENTER Switch,bool) }
(A:SPOILERS LEFT POSITION, percent) 100 ==
             if{ (L:MESSAGE CENTER Switch,bool) ! (>L:MESSAGE CENTER Switch,bool) }
(A:FLAPS HANDLE PERCENT,percent) 1 &gt;
             if{ (L:MESSAGE CENTER Switch,bool) ! (>L:MESSAGE CENTER Switch,bool) }
 
#6
I see what its doing now. It throws the switch and keeps it locked on. I click a different command (flaps down) and it turns the screen back off. I hit the spoiler and it comes back on.

hmmm... dang circuits...
 

Heretic

Resource contributor
#7
It's not as easy as you'd like it to be. You need to pop up the message center when a status change is detected, not when a system has a certain status. And you can directly write to the timer (as you did before) to keep the message center open when something changes.

The flap handle is a bit of an exception since I figure that any change might warrant a popup, not just the initial deployment.

Code:
(A:GEAR RIGHT POSITION, percent) 100 == (L:GEAR RIGHT POSITION LAST, number) 100 != and if{ 200 (>L:3303MESSAGE CENTER Time,enum) (A:GEAR RIGHT POSITION, percent) (>L:GEAR RIGHT POSITION LAST, number) }
(A:GEAR RIGHT POSITION, percent) 0 == (L:GEAR RIGHT POSITION LAST, number) 100 != and if{ 200 (>L:3303MESSAGE CENTER Time,enum) (A:GEAR RIGHT POSITION, percent) (>L:GEAR RIGHT POSITION LAST, number) }
(A:SPOILERS LEFT POSITION, percent) 100 == (L:SPOILERS LEFT POSITION LAST, number) 100 != and if{ 200 (>L:3303MESSAGE CENTER Time,enum) (A:SPOILERS LEFT POSITION, percent) (>L:SPOILERS LEFT POSITION LAST, number) }
(A:FLAPS HANDLE PERCENT,percent) 1 &gt; (L:FLAPS HANDLE POSITION LAST, number) != and if{ 200 (>L:3303MESSAGE CENTER Time,enum) (A:FLAPS HANDLE PERCENT,percent) (>L:FLAPS HANDLE POSITION LAST, number) }

The popup timer will be treated as a countdown, therfor...

Code:
     <!-- Start timer and increment when both battery and avionics are ON -->
    <Element>
       <Select>
        <Value>
       (L:3303MESSAGE CENTER Time,enum) 1 &gt; if{ (L:3303MESSAGE CENTER Time,enum) -- (>L:3303MESSAGE CENTER Time,enum) 1 (>L:3303MESSAGE CENTER Screen,enum) 4 (>L:TIER2 CLICK LAYER,enum) }
        </Value>
       </Select>
    </Element>

     <!-- Stop timer after 20 seconds - Remove this entire section!-->
    <Element>
       <Select>
        <Value>
        <!-- Remove this entire section! -->
        </Value>
       </Select>
    </Element>
 
#8
It's not as easy as you'd like it to be. You need to pop up the message center when a status change is detected, not when a system has a certain status. And you can directly write to the timer (as you did before) to keep the message center open when something changes.
Many thanks Bjoern. I'll check this out right now.
 
#9
This would work better for my other popup windows, like the radios adjustments page, where every time you 'click' on the panel popup, it extends the time it is showing.

I would be able to have variable time rates...
 

Heretic

Resource contributor
#10
Variable timing can be done by simply incrementing your timer variable by a certain number of cycles each time an event happens.

Code:
(A:GEAR RIGHT POSITION, percent) 100 == (L:GEAR RIGHT POSITION LAST, number) 100 != and if{ (L:3303MESSAGE CENTER Time,enum) 36 + (>L:3303MESSAGE CENTER Time,enum) (A:GEAR RIGHT POSITION, percent) (>L:GEAR RIGHT POSITION LAST, number) }
...etc...
 
Top