FSXA Delay part visibility

#1
Hi all,
Just a quick question, I am having a bit of trouble with a Landing light part. I want to delay its visibility by about 5 seconds or so. Is there any simple way of doing this? (note the part is not animated, I just want to control when it becomes visible after (A:LIGHT LANDING, bool) 1)
Regards, TJ
 
Last edited:
#4
What I would do is create an visibility tag for the part. Then have an invisible gauge that had a 'what if' statement that 'activated' when a set of scenarios surfaced. When that occurs, the invisible gauge says 'bingo!' and that bingo statement flags your part. Your part would have 'Bingo!' as the trigger to show up. When Bingo is true, this is visible. Have the invisible gauge 'command' be in a refreshing state via putting it in an 'Update' section. This way, when the scenario of flags falls apart (something is turned off, etc), then the visibility flag (something like Bingo! ) then the part disappears again.
 
#5
What I would do is create an visibility tag for the part. Then have an invisible gauge that had a 'what if' statement that 'activated' when a set of scenarios surfaced. When that occurs, the invisible gauge says 'bingo!' and that bingo statement flags your part. Your part would have 'Bingo!' as the trigger to show up. When Bingo is true, this is visible. Have the invisible gauge 'command' be in a refreshing state via putting it in an 'Update' section. This way, when the scenario of flags falls apart (something is turned off, etc), then the visibility flag (something like Bingo! ) then the part disappears again.
Thanks Bill thats what I am trying to achieve, just struggling with the XML. Have tried P: Elapsed time but no luck. Brain not working of late.
 
#7
OK Bill, so far all I have tried is adapting the universal timer XML in the Wiki to see if I can delay the visibility of the part. One of the conditions is that the landing lights must be switched on. Code as follows..
XML:
  <PartInfo>
    <Name>Landing_Light_Timer_vis</Name>
    <Visibility>
      <Parameter>
        <Code>
              (A:LIGHT NAV, bool);
            (P:Absolute time,seconds) 1.0 > !
              and
              if{ 100 }
              els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
Now I have also tried various permutations of the numbers but nothing seems to work. The universal timer in the Wiki was so easy to apply and worked so well, I am struggling to understand how a simple elapsed timer should be so much more complicated. If possible, I would like to stay away from the use of a control gauge as they don't seem to like me very much.

Many thanks for taking the time to help Bill.
 
#8
I think I see your issue. You are trying to do this all in the part and I think its too much for the model.

You need a gauge that is in the sim, outside of the model, that tells the part when to work.

You need a several-section Element gauge that manages the timer;
** Setup the timer, also called Reset, when the sim starts
** Starts the timer when the events trigger it
** Turns on the 'something' part
** Turns off the 'something' part if the events trigger loses one or more of its needed events
** Reset under certain conditions (timer goes back to zero).

Then, in the model 'Part Info' section, all you need is the 'visibility' function to have the proper L:var which is what your gauge will yell out to it when the events occur.

Sounds complicated, and if you dont know what it all is, then its like cold fusion equations.... (At least it is to me).

Here is a gauge code that Bill Leaming showed me which works my boot screen. I use it often for similar situations...

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:3306BootScreen,enum)
        0 (>L:3306BootTime,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:3306BootTime,enum) 320 &lt;= and
        if{ (L:3306BootTime,enum) ++ (>L:3306BootTime,enum) 1 (>L:3306BootScreen,enum) }
        </Value>
       </Select>
    </Element>

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

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

     <!-- CCC While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
        <Visible>(L:3306BootTime,enum) 230 &lt;</Visible>
         <Position X="0" Y="0"/>
        <Image Name="BootModelNumber.bmp" ImageSizes="1500,681" Bright="Yes">
        </Image>
    </Element>

     <!-- CCC While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
       <Select>
        <Value>
                    (A:Avionics Master Switch,bool) (A:Electrical Master Battery,bool) and (L:3306BootTime,enum) 179 == and
                                  if{ 1 (>L:XMLSND192,bool) }
        </Value>
       </Select>
    </Element>


     <!-- CCC While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
        <Visible>(L:3306BootTime,enum) 165 &lt;</Visible>
         <Position X="0" Y="0"/>
        <Image Name="BootCodeIntro.bmp" ImageSizes="1500,681" Bright="Yes">
        </Image>
    </Element>

     <!-- BBB While the "bootscreen" variable is ON and battery is ON, display the bootscreen bitmap -->
    <Element>
        <Visible>(L:3306BootTime,enum) 70 &lt;</Visible>
         <Position X="0" Y="0"/>
        <Image Name="SyrosScreenOff.bmp" ImageSizes="1500,681" Bright="Yes">
        </Image>
    </Element>

Note that this code pack has screens that turn on and off during the timer 'run', and also a voice flag (sound file) also activates.

The very top part is 'Startup or Reset'.
The very bottom sections are commands that make the things happen.
Parts in the middle are management of the timer.

Just mull this over, check out how it works... The 320 is the timer amount that it goes to, its max count. That isnt seconds, and I forget the 'timer frequency count'. Someone will chime in on that. I just adjust it to be more or less, run it in the sim and when its right, I lock it in.

You could use a similar one, figure out the timing length, create a L:var string name, like 'L:mypartvisible,enum' (or bool) and Voila, you are good to go.

Do you know how to create the XML out of a Notebook file?
 

n4gix

Resource contributor
#9
XML:
  <PartInfo>
    <Name>Landing_Light_Timer_vis</Name>
    <Visibility>
      <Parameter>
        <Code>
              (A:LIGHT NAV, bool);
            (P:Absolute time,seconds) 1.0 > !
              and
              if{ 100 }
              els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
Error:
(A:LIGHT NAV, bool); - Wrong A:var and the semi-color should not be used here
 
#12
OK Bill, I'm back and forgive me but I'm having a bit of a 'slow-brain year' so far. It is very much like cold fusion equations to me. I barely have a grip on simple XML let alone what you guys take as 'simple code'. Anyway, I did some simple analysis of what you said and ended up trying to adapt what you kindly shared to suit my purposes but to no avail. Can you tell me if I'm on the right track please.
I created a visibility tag in the modeldef as follows:
XML:
  <PartInfo>
    <Name>Landing_Light_Timer_vis</Name>
    <Visibility>
      <Parameter>
        <Code>
              (A:LLS, bool)
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
I then edited your ode as follows:
XML:
<Gauge Name="light control" Version="1.0">


    <Element>
       <Select>
        <Value>
        (A:LIGHT LANDING, bool) 0 == || if{
        0 (A:LLS, bool)
        0 (>L:3306BootTime,enum) }
        </Value>
       </Select>
    </Element>

    <Element>
       <Select>
        <Value>
        (A:LIGHT LANDING, bool) and (L:3306BootTime,enum) 320 &lt;= and
        if{ (L:3306BootTime,enum) ++ (>L:3306BootTime,enum) 1 (A:LLS, bool) }
        </Value>
       </Select>
    </Element>

    <Element>
       <Select>
        <Value>
        (L:3306BootTime,enum) 320 > if{ 0 (A:LLS, bool) }
        </Value>
       </Select>
    </Element>

    <Element>
        <Visible>(A:LLS, bool) 1 == </Visible>
    </Element>

    <Element>
        <Visible>(L:3306BootTime,enum) 230 &lt;</Visible>
    </Element>

    <Element>
       <Select>
        <Value>
                    (A:LIGHT LANDING, bool) and (L:3306BootTime,enum) 179 == and
                                  if{ 1 (>L:XMLSND192,bool) }
        </Value>
       </Select>
    </Element>

    <Element>
        <Visible>(L:3306BootTime,enum) 165 &lt;</Visible>
    </Element>

    <Element>
        <Visible>(L:3306BootTime,enum) 70 &lt;</Visible>
    </Element>

</Gauge>
I did this as I only needed the part to show when the landing lights were switched on, but I got nothing. The part does not even show up in the sim. What am I doing wrong?
And to answer your question, no I do not know how to create code from a notebook file.
 

tgibson

Resource contributor
#13
According to my FSX SDK, there is no such variable as A:LLS. You cannot add extra A: variables - they have been defined by MS and you can't change that. If you want to create your own variable you must use an L: variable and define its value.

Hope this helps,
 
#14
Hey Terrence,

I happened to stumble on this code and it just might be what you are looking for...



Code:
  <PartInfo>
    <Name>gizmo_thing</Name>
       <Visibility>
         <Parameter>
            <Code>
          (P:Absolute Time, minutes) (L:PartTimer, minutes) 0 == if{ d (>L:PartTimer, minutes) } (L:PartTimer, minutes) - 3 &gt;
            </Code>
         </Parameter>
       </Visibility>
  </PartInfo>
Note that this one has minutes assigned. You will want to change that to seconds and put in your own time.

I totally forgot about this. My apologies.

It is good though to have visibilities controllable via XML gauges so you can 'tune' the parts management. I do this often.
 
#15
Here is a part that appears/disappears, L:var... (L:vars are custom codes which we are doing here).


Code:
<PartInfo>
    <Name>lhc_headphones_appear</Name>
      <Visibility>
        <Parameter>
        <Code>(L:LHC HEADPHONES, bool) 0 &gt; if{ 0 } els{ 1 }</Code>
        </Parameter>
    </Visibility>
</PartInfo>
 
#16
OK Bill, I'm back and forgive me but I'm having a bit of a 'slow-brain year' so far. It is very much like cold fusion equations to me. I barely have a grip on simple XML let alone what you guys take as 'simple code'. Anyway, I did some simple analysis of what you said and ended up trying to adapt what you kindly shared to suit my purposes but to no avail. Can you tell me if I'm on the right track please.
I created a visibility tag in the modeldef as follows:
XML:
  <PartInfo>
    <Name>Landing_Light_Timer_vis</Name>
    <Visibility>
      <Parameter>
        <Code>
              (A:LLS, bool)
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>
I then edited your ode as follows:
XML:
<Gauge Name="light control" Version="1.0">


    <Element>
       <Select>
        <Value>
        (A:LIGHT LANDING, bool) 0 == || if{
        0 (A:LLS, bool)
        0 (>L:3306BootTime,enum) }
        </Value>
       </Select>
    </Element>

    <Element>
       <Select>
        <Value>
        (A:LIGHT LANDING, bool) and (L:3306BootTime,enum) 320 &lt;= and
        if{ (L:3306BootTime,enum) ++ (>L:3306BootTime,enum) 1 (A:LLS, bool) }
        </Value>
       </Select>
    </Element>

    <Element>
       <Select>
        <Value>
        (L:3306BootTime,enum) 320 > if{ 0 (A:LLS, bool) }
        </Value>
       </Select>
    </Element>

    <Element>
        <Visible>(A:LLS, bool) 1 == </Visible>
    </Element>

    <Element>
        <Visible>(L:3306BootTime,enum) 230 &lt;</Visible>
    </Element>

    <Element>
       <Select>
        <Value>
                    (A:LIGHT LANDING, bool) and (L:3306BootTime,enum) 179 == and
                                  if{ 1 (>L:XMLSND192,bool) }
        </Value>
       </Select>
    </Element>

    <Element>
        <Visible>(L:3306BootTime,enum) 165 &lt;</Visible>
    </Element>

    <Element>
        <Visible>(L:3306BootTime,enum) 70 &lt;</Visible>
    </Element>

</Gauge>
I did this as I only needed the part to show when the landing lights were switched on, but I got nothing. The part does not even show up in the sim. What am I doing wrong?
And to answer your question, no I do not know how to create code from a notebook file.
Sorry Tom, it was approaching midnight and I was typing by hand not copying and pasting as I should have done. Meant L:LLS
 
#17
Hey Terrence,

I happened to stumble on this code and it just might be what you are looking for...



Code:
  <PartInfo>
    <Name>gizmo_thing</Name>
       <Visibility>
         <Parameter>
            <Code>
          (P:Absolute Time, minutes) (L:PartTimer, minutes) 0 == if{ d (>L:PartTimer, minutes) } (L:PartTimer, minutes) - 3 &gt;
            </Code>
         </Parameter>
       </Visibility>
  </PartInfo>
Note that this one has minutes assigned. You will want to change that to seconds and put in your own time.

I totally forgot about this. My apologies.

It is good though to have visibilities controllable via XML gauges so you can 'tune' the parts management. I do this often.
Bill, thank you. That might just be exactly what I am looking for. Will try it in a bit. Just could not think of how to approach the problem. Thanks again.
Regards, TJ
 
#19
Success Bill, it works perfectly thank you. One more question if I may please (sorry for being a pest). I want the the part to appear 3-5 seconds after every time I hit the landing light switch, but the code needs to reset when I turn off the landing lights and re-start when I turn them on again. So far I have the following in the modeldef:
XML:
  <PartInfo>
    <Name>Landing_Light_Timer_vis2</Name>
       <Visibility>
         <Parameter>
            <Code>
              (A:LIGHT LANDING, bool)
                (P:Absolute Time, seconds) (L:PartTimer, seconds) 0 == if{ d (>L:PartTimer, seconds) } (L:PartTimer, seconds) - 3 &gt;
              and
            </Code>
         </Parameter>
       </Visibility>
    <MouseRect>
      <Cursor>UpArrow</Cursor>
      <CallbackCode>
          (>K:LANDING_LIGHTS_TOGGLE)
          (P:Absolute Time, seconds) (L:PartTimer, seconds)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
Can you suggest any way I might be able to reset the timer?
Many many thanks again for the code.
Regards, TJ
 

n4gix

Resource contributor
#20
XML:
            <Code>
              (A:LIGHT LANDING, bool)
                (P:Absolute Time, seconds) (L:PartTimer, seconds) 0 == if{ d (>L:PartTimer, seconds) } (L:PartTimer, seconds) - 3 &gt;
              and

              <!-- RESET TIMER -->
              (A:LIGHT LANDING, bool) !
              if { 0 (>L:PartTimer, seconds) }
            </Code>
 
Top