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

FSX ExtDigit Macro and rotating numbers with a decimal

Dave_W

Resource contributor
Messages
185
I have a three digit DME that displays the distance with tenths when it is less than 99.9 miles.

I'm trying to follow the Extracting Digits Wiki for the following:

"Rotating Drum Example

To simulate a Rotating Drum number using a value of three integer digits (for example (L:Var, number) = 135) where the preceding number starts to rotate at 90% of the number to its right:

-for the first rightmost integer digit (5) = (L:Var, number) 1 % @ExtDigit((L:Var, number),1,0) +
-for the second rightmost digit (3) = (L:Var, number) 10 % s1 9 >= l1 9 - * @ExtDigit((L:Var, number),2,0) +
-for the third rightmost digit (1) = (L:Var, number) 100 % s1 99 >= l1 99 - * @ExtDigit((L:Var, number),3,0) +"

I have no experience working with stacks and registers, so I don't understand the "mechanics" of this "s1 9 >= l1 9 - *" part of the example code.

In addition to my confusion over the 90% example, I am more lost with the 80% example "s1 8 >= l1 8 - 2 / *". Why does this example have the division in it?

Apparently it is a computer math thing that I am not seeing, or don't know.

So, what if one wanted 70 or 75 percent, what would change in that part of the statement?

I haven't been able to get the tens digit of my DME working correctly. I'm not sure about the ones digit but, it appears to work OK.

My tens digit is doing this:

Inbound at 9.9 miles, the tens digit is still showing a one and then it starts to decrement. It decrements probably 10% for every tenth of a mile, until it reads zero when you are at 9 miles. Outbound, the tens digit starts to increment in a similar way when you hit 9.0 miles.

I hope that the following is all the relevant code and that someone can see the obvious error(s) in it:

Besides the ExtDigit macro, I also use:

Code:
<Macro Name="Distance">
  (A:NAV DME:1, nmiles)
</Macro>

<!--Tenths-->
<Value>(L:RMI 1 Select, enum) 1 == @Distance 99.9 &lt; &amp;&amp; if{ @Distance 0.1 % 10 * @ExtDigit(@Distance,1,1) + }</Value>

<!--Ones-->
<Value>(L:RMI 1 Select, enum) 1 ==  @Distance 99.9 &lt; &amp;&amp;  if{ @Distance 1 % s1 0.9 >= l1 0.9 - * @ExtDigit(@Distance,2,1) + }</Value>

<!--Tens-->
 <Value>(L:RMI 1 Select, enum) 1 == @Distance 99.9 &lt; &amp;&amp; if{ @Distance 10 % s1 9 >= l1 9 - * @ExtDigit(@Distance,3,1) + }</Value>

TIA
 
Hi,

The rotating drum example says:

Rotating Drum Example To simulate a Rotating Drum number using a value of three integer digits (for example (L:Var, number) = 135)...

I assume this means the code is limited to just that - integer digits. You are using it with a decimal, something it may not be designed to accommodate.

So the first thing I would try is to create a different first macro called @Distance_X_10 that multiplies the current distance by 10. That will convert your three digits to integers. Then use that instead of @Distance in your actual code. That way you can use the code directly from the Wiki, and not have to modify it for your decimal example.

Hope this helps,
 
Tom Gibson said:
Hope this helps

It did!

You got me to change the way I was thinking about it.

It still took a long time to get it through my thick head how to do it.

After a quick test, it looks like I finally got what I wanted.

I'll post my code tomorrow.
 
This is the code I ended up with.

I left the Distance macro as it is in the OP.

The tenths code is also the same as in the OP. In it, I get the hundredths value and add it to the tenths value so that it doesn't always display the exact tenths value.

The ones code starting rotation at 85% is:
Code:
       <Value>(L:RMI 1 Select, enum) 1 ==  @Distance 99.9 &lt; &amp;&amp; 
              if{ @Distance 0.1 % 10 * @ExtDigit(@Distance,1,1) +  s1 8.5 >= l1 8.5 - 2 / * @ExtDigit(@Distance,2,1) + }
      </Value>

The tens code starting rotation at 80% is:
Code:
       <Value>(L:RMI 1 Select, enum) 1 == @Distance 99.9 &lt; &amp;&amp;
              if{ @Distance 10 %  10 * s1 98 >= l1 98 - 2 / * @ExtDigit(@Distance,3,1) + }
      </Value>

I haven't done much testing with it, but it appears that it works the way I want it to.
 
Back
Top