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

FSXA Radar altimeter code

Messages
471
Country
ca-ontario
Hi folks, I've spent the last day or so building my first radar altimeter and while I have most of the main parts working (needle, bug and DH knob) I'm having issues with several of the ancillary parts. Could someone look at my code and tell me where I am going wrong please. I'll list each part with its code to make things easier.

DH Lamp
I have a set of polys for the lamp ON state but they are not displaying when I hit the DH. The visibility code for them is here:

Code:
    <PartInfo>  
    <Name>Mallard_DH_lamp</Name>
    <Visibility>
      <Parameter>
       <Code>
         (A:DECISION HEIGHT, feet)
         (A:ELECTRICAL MASTER BATTERY, bool)
         and
       </Code>
      </Parameter>
    </Visibility>
    </PartInfo>

Test Button and Lamp
I have a test button and lamp which uses a different set of polys to the DH lamp above (but they are co-located). The button animates but the polys are not displaying when I push the button. Here is the visibility code for the test lamp polys:

Code:
<PartInfo>  
    <Name>Mallard_DH_test_lamp</Name>
    <Visibility>
      <Parameter>
        <Code>
        (L:DH_test, bool) 0 &gt; if{ 1 } els{ 0 }
        (A:ELECTRICAL MASTER BATTERY,bool)
        and
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

The button animation code which is tied to the above is here:

Code:
 <PartInfo>
  <Name>Mallard_DH_test_button</Name>
   <AnimLength>100</AnimLength>
   <Animation>
    <Parameter>
     <Code>
       (L:DH_test, bool) 100 *
     </Code>
     <Lag>100</Lag>
    </Parameter>
   </Animation>
     <MouseRect>
     <TooltipText>DH Test</TooltipText>
      <MouseFlags>LeftSingle</MouseFlags>
      <Cursor>Hand</Cursor>
         <CallbackCode>
         (L:DH_test, bool) ! (&gt;L:DH_test, bool)
         </CallbackCode>
     </MouseRect>
    </PartInfo>

The button moves in on the first click and out when you click again but it would be nice if it popped out on it's own when you released it and the lamp illuminated only while you had the button pushed.

Power Off Flag
The gauge has a flag which pops out when power is removed (i.e. the master battery is OFF) but it is not animating at all, it is always in the out position.

This is the code for the power flag:

Code:
<PartInfo>
    <Name>Mallard_rad_alt_pwr_flag</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:ELECTRICAL MASTER BATTERY:0,bool)</Code>
      </Parameter>
    </Animation>
    </PartInfo>

Any help sorting this problem out would be greatly appreciated.
 
Larry,

Maybe try these -

DH Lamp
Code:
<Code>
(A:RADIO HEIGHT, feet) (A:DECISION HEIGHT, feet) &lt;
(A:ELECTRICAL MASTER BATTERY, bool)
(A:SIM ON GROUND, bool) !
and and
</Code>

Test Lamp
Code:
<Code>
(L:DH_test, bool)
(A:ELECTRICAL MASTER BATTERY,bool)
and
</Code>

Test Lamp Button
Code:
<PartInfo>
  <Name>Mallard_DH_test_button</Name>
   <AnimLength>100</AnimLength>
   <Animation>
    <Parameter>
     <Code>
       (L:DH_test, bool) 100 *
     </Code>
     <Lag>100</Lag>
    </Parameter>
   </Animation>
     <MouseRect>
     <TooltipText>DH Test</TooltipText>
      <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
      <Cursor>Hand</Cursor>
         <CallbackCode>
         (M:Event) 'LeftSingle' scmp 0 == if{ 1 (&gt;L:DH_test, bool) }
        (M:Event) 'LeftRelease' scmp 0 == if{ 0 (&gt;L:DH_test, bool) }
         </CallbackCode>
     </MouseRect>
    </PartInfo>

Power Off Flag
Code:
<Code>(A:ELECTRICAL MASTER BATTERY, bool) if{ 100 } els{ 0 }</Code>
 
Last edited:
Thanks for your help Roman. Your code fixed the DH lamp, and I got the power off flag working with your code plus the addition of a 'lag' of 150 to slow down the animation as it jumped right from the start position to the finish position instantly.

The test lamp/button works as a once only shot, you press the button and it sticks in and the lamp remains on constantly. I cannot get the button to come out again short of reloading the aircraft! :eek:
 
Larry,

Try this for the test button, outside of this I would have no clue why it wouldn't work.

Code:
<PartInfo>
  <Name>Mallard_DH_test_button</Name>
   <AnimLength>100</AnimLength>
   <Animation>
    <Parameter>
     <Code>
       (L:DH_test, bool) 100 *
     </Code>
     <Lag>100</Lag>
    </Parameter>
   </Animation>
     <MouseRect>
     <TooltipText>DH Test</TooltipText>
      <MouseFlags>LeftSingle+LeftRelease</MouseFlags>
      <Cursor>Hand</Cursor>
         <CallbackCode>
         (M:Event) 'LeftSingle' scmp 0 == if{ 1 (&gt;L:DH_test, bool) } els{ 0 (&gt;L:DH_test, bool) }       
         </CallbackCode>
     </MouseRect>
    </PartInfo>
 
Thanks Roman, that callback code works perfectly now. I did remove the lag as it looks better as a fast acting button, the gauge is so far away from the pilot that it's hard to see the animation anyway.
 
Back
Top