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

XML - Scripts for Mechanical (Drum) Xpdr Code Display

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
The following are four XML scripts for controlling/displaying a transponder code with mechanical (drum) type displays.

Each drum is keyframe animated from 0 to 9 (10 steps). Since the transponder code is returned from FS in BCD16 format, we need to strip out each of the four digits of the number so we can animate each drum individually.

The prototype for this is:

(A:TRANSPONDER1 CODE, BCO16) nn >> 15 &

where nn represents the 4 bytes we wish to be returned. The highest 4 bytes would be 12, the next 4 bytes would be 8, the next 4 bytes would be 4, and the final 4 bytes would be 0 (or nothing at all).

I've also set up the mouse to work for left/right click and the wheel.

Code:
  <PartInfo>
    <Name>T38_Xpdr_1000s</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:TRANSPONDER1 CODE, BCO16) 12 >> 15 &amp;
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_TRANSPONDER_ID</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>
      <CallbackCode>
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (>K:XPNDR_1000_INC) }
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (>K:XPNDR_1000_DEC) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (>K:XPNDR_1000_INC) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (>K:XPNDR_1000_DEC) }
        1 (>L:XMLSND1,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>

  <PartInfo>
    <Name>T38_Xpdr_100s</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:TRANSPONDER1 CODE, BCO16) 8 >> 15 &amp;
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_TRANSPONDER_ID</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>
      <CallbackCode>
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (>K:XPNDR_100_INC) }
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (>K:XPNDR_100_DEC) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (>K:XPNDR_100_INC) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (>K:XPNDR_100_DEC) }
        1 (>L:XMLSND1,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>

  <PartInfo>
    <Name>T38_Xpdr_10s</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:TRANSPONDER1 CODE, BCO16) 4 >> 15 &amp;
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_TRANSPONDER_ID</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>
      <CallbackCode>
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (>K:XPNDR_10_INC) }
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (>K:XPNDR_10_DEC) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (>K:XPNDR_10_INC) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (>K:XPNDR_10_DEC) }
        1 (>L:XMLSND1,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>

  <PartInfo>
    <Name>T38_Xpdr_1s</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:TRANSPONDER1 CODE, BCO16) 15 &amp;
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_TRANSPONDER_ID</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>
      <CallbackCode>
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (>K:XPNDR_1_INC) }
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (>K:XPNDR_1_DEC) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (>K:XPNDR_1_INC) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (>K:XPNDR_1_DEC) }
        1 (>L:XMLSND1,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
just starting to try and learn xml.....examining examples...especially nice neat ones...is a great help....ta very much....jim
 
I'm confused about something. I thought transponder codes only use the digits 0-7. :confused:
 
I'm confused about something. I thought transponder codes only use the digits 0-7. :confused:

That's correct. I should have been more clear, but...

Because one can use the same "drum texture" for multiple "drums" (such as an altimeter, kohlsman, etc.), it's easier to have one texture with the digits 0 through 9.

Since these drums "snap" from number to number, the script takes care of everything, so for the xpdr drums only digits 0-7 will ever be seen. :wizard:
 
I have been studying the code in the first post with a view to using it on my 3D transponder but, as usual, I find I have some questions. :rolleyes:

1. If I made a drum with flat sides as opposed to being a cylinder would I need to have 8 or 10 sides for it to work? I currently have drums with 8 sides but the code seems to be implying 10 sides given the 10 frames used in the animation.

2. It appears that this code moves the display drums themselves and the user would mouse over them and either click or use the mouse-wheel to change the readings. What would I need to change if I wanted to control the drum movement via the control knobs on the front of the transponder unit?

Thanks for any help.
 
Larry, you wouldn't need to change anything at all except the <AnimLength> from 10 to 8 frames...

Since the mouse control is only active if you tag the object with the Attachpoint tool, you can use the same script for both the "drum" and it's associated "knob." In fact, if you animate the "knobs" with the script as well as tag them for mouse control, the knobs will rotate right along with their drums! :D
 
Thanks for the reply Bill, I was obviously thinking it was harder than it actually was!

I love KISS!
 
Back
Top