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

FS2004 Atc flight number

Messages
206
Country
unitedkingdom
Hi folks,

Just a quick question: assuming that it contains only numbers, can the ATC FLIGHT NUMBER variable be manipulated in XML - ie, extracted into one ( or several ) numerical variables? Also, if it is possible, could it still work if there was a lettering there - I would just want to ignore that and extract the number...

Thanks on advance,

Geoff
 
There is a simple 2D gauge out there and it will display and update what ever
the user sets for his aircraft id. So should not be hard to make ATC flight display. I actually still can't write too many string variables. I have only
a few samples, but they are digital clocks and nav radios.

If you can find the gauge i am talking about, then you can easily convert it...
 
Regarding the extraction of digits, is there any functional difference between calling a position outside of the length of the input, or finding a zero in the number?

Eg for a value of 120

@ExtDigit(lVar,2,0) returns 2*;
@ExtDigit(lVar,3,0) returns ..? <---
@ExtDigit(lVar,4,0) and up returns 0

Then, what happens if it finds 268S as the number... Will S be a zero, some indication of null, or will it just crash the gauge / sim?

Also, is there a simple way to return the length of a string? Manipulations of the ATC_FLIGHT_NUMBER would become very simple if I could know whether it is 3, 4 or 5 characters in length...

Geoff
 
Also, is there a simple way to return the length of a string? Manipulations of the ATC_FLIGHT_NUMBER would become very simple if I could know whether it is 3, 4 or 5 characters in length...

Try the string operator slen. It will return a number.

'ABCD123' slen returns 7.

Agree ... you might need to know how many characters first.

You also might be able to do everything you want with a combination of slen and ssub and not require the number extraction macros.

See if this works for you:

'ABCD123' slen returns 7
123456 slen returns 6

'ABCD123' 2 4 ssub returns the string CD12
'ABCD123' 2 5 ssub returns the string CD123
'ABCD123' 2 6 ssub also returns the string CD123

123456 3 3 ssub returns the number 456
123456 3 4 ssub also returns the number 456

Bob
 
Last edited:
Thanks very much for your help. I now have what I wanted:

Flight numbers are always shown as four digits. Suffix letters are removed and the remaining characters are 'bulked' with leading zeros when required.

Code:
(A:atc flight number, string) slen s0 

(A:atc flight number, string) 0 1 ssub s1 
(A:atc flight number, string) 1 1 ssub s2 
(A:atc flight number, string) 2 1 ssub s3 
(A:atc flight number, string) 3 1 ssub s4 
(A:atc flight number, string) 4 1 ssub s5 

l0 5 == l5 ord 48 &lt; l5 ord 57 &gt; || &amp;&amp; if{ l0 1 - 0 max s0 } 
l0 4 == l4 ord 48 &lt; l4 ord 57 &gt; || &amp;&amp; if{ l0 1 - 0 max s0 } 
l0 3 == l3 ord 48 &lt; l3 ord 57 &gt; || &amp;&amp; if{ l0 1 - 0 max s0 } 
l0 2 == l2 ord 48 &lt; l2 ord 57 &gt; || &amp;&amp; if{ l0 1 - 0 max s0 } 
l0 1 == l1 ord 48 &lt; l1 ord 57 &gt; || &amp;&amp; if{ l0 1 - 0 max s0 } 

l0 0 == if{ '0' s10 '0' s11 '0' s12 '0' s13 } 
l0 1 == if{ '0' s10 '0' s11 '0' s12 l1 s13 } 
l0 2 == if{ '0' s10 '0' s11 l1 s12 l2 s13 } 
l0 3 == if{ '0' s10 l1 s11 l2 s12 l3 s13 } 
l0 3 &gt; if{ l1 s10 l2 s11 l3 s12 l4 s13 } 

<String>%( l10 )%!s! %( l11 )%!s! %( l12 )%!s! %( l13 )%!s!%</String>

Examples of use:

Flight number => Output
"" => 0 0 0 0
244 => 0 2 4 4
99K => 0 0 9 9

It will not handle things like 90G8 (ie an embedded letter) nor a prefix letter (like K998) but then I don't expect it to encounter such an odd input in normal use!!

Geoff
 
Back
Top