October 1, 20241 yr Greetings! I wonder if this is the right place to look for this kind of help. MSFS2020 entertains a legacy simulation variable (A:AI TRAFFIC STATE, String). The string contains a description of the various flight stages in capital letters separated by the underscore character. I’m trying to display the contents of this variable on my Streamdeck mobile App. Because of the length, the Streamdeck reduces the font to fit the entire contents onto the button. There is an option to split the contents into multiple lines. But this works when the string contains spaces separating the words. I’m old, insinuating I have poor eyesight and therefore, wish for a result with the text underneath one another, thereby bigger so see without squinting. The following is the RPN I’m trying to achieve this with. The idea is to go through each character and check if it is an underscore. Change it to a space when so, and whalah! My expected result does not meet my wish. (A:AI·TRAFFIC·STATE,·String)·ss0 '' ss0·slen·0· iterate{ ss0·(0)·chr·95·==·if{·'·'·}·els{·chr·} ss1· ss1 } ss1·(>L:RLE-TFC-PHASE,·String) Does the iterate{} function work like this, or is here something I am overlooking? Below is another approach if attempted, but also just produces the original string. (A:AI·TRAFFIC·STATE,·String)·ss0 '' ss0·slen·0 iterate{ ss0·(p0)·chr·ds·95·==·if{··}·els{·ps·} ss1· ss1 } ss1·(>L:RLE-TFC-PHASE,·String) I will appreciate any help. Ralph
October 1, 20241 yr Commercial Member Personally, I would use JScript to do this, not RPN. It is similar enough to Javascript that manipulations like these shouldn't pose a problem. If you want to stick to RPN, I would recommend using either the "(REGEXSPLIT:" command or the "asplit" operator. In both cases the result is a STRARR string array that you can query on the StreamDeck 'ABC_DEF_GHI' '_' 'mystrarr' asplit 1 hour ago, Aerojock said: (A:AI TRAFFIC STATE, String). The string contains a description of the various flight stages in capital letters separated by the underscore character. Are you sure about that? Normally, this variable contains only one specific state - the one that a certain AI aircraft is currently in. In SimConnect, you would query this variable using the current object ID of the AI aircraft. This information is then used in the various traffic map/board and AI traffic control apps. In AAO, this variable doesn't make a lot of sense, because you can only query it for your own aircraft (AAO doesn't provide features to query variables on other objects than your own vehicle). IMHO the result is undefined, we are not meant to use it on ourselves. Quoting the legacy SDK documentation, section "AI Traffic" Quote AI TRAFFIC STATE English string describing an AI object's state. If the object is an aircraft under ATC control the string will be one of: "init" "sleep" "flt plan" "startup" "preflight support" "clearance" "push back 1" "push back 2" "pre taxi out" "taxi out" "takeoff 1" "takeoff 2" "T&G depart" "enroute" "pattern" "landing" "rollout" "go around" "taxi in" "shutdown" "postflight support" If the AI object is not an aircraft under ATC control, the string is one of: "Sleep" "Waypoint" "Takeoff" "Landing" "Taxi" Edited October 1, 20241 yr by Lorby_SI LORBY-SI
October 1, 20241 yr Author Thank you so much for your reply. My journey to understand this fascinating world is driven by the excitement and wrought by the unknowns. So, to further elaborate; the (A:AI TRAFFIC STATE, String) I plan to use this as a governor to display (A:AI TRAFFIC ASSIGNED RUNWAY, String), and (A:AI TRAFFIC ASSIGNED PARKING, String) only during certain stages of the flight. MSFS ATC does not appear to divulge the Parking Bay when instructed to go to a general area. Knowing the bay number when assigned in my view is helpful information. To answer your question, I am sure about it in the context I view it. From filing a flight plan to shutting down at the destination, the AI Traffic States change. Not all the ones listed are applied during the flight, some of them are. For me this is early days. Like I mentioned, it is a journey and thank you for your assistance by stretching my abilities. It is late, and there is a long weekend coming up. More time to mess with this then. Thx again, Ralph
October 2, 20241 yr Commercial Member 9 hours ago, Aerojock said: More time to mess with this then. Sorry, I didn't get the part about replacing the underscore. That you can do with the "srep" operator (A:AI TRAFFIC STATE, String) '_' ' ' (>L:MyState, String) (L:MyState, String) will then contain the state where the underscores have been replaced with spaces. You have three options on the StreamDeck - TextGauge: 1. Create the script above in AAO then set it as the "Autoscript" in the TextGauge (that option is way down, in the "Button settings" section. Use the resulting LVar as "Variable 1". 2. Or select type "S:" on "Variable 1" of the TextGauge and put this in the box: "(A:AI TRAFFIC STATE, String) '_' ' ' srep". With S: the TextGauge will send the code to AAO for processing and displays the result. 3. Create the script above in AAO and run it as an Automated Script every 5 seconds. The difference is, that "3" is a lot less performance intensive, because the calculation is only done every 5 seconds. "2" is the most performance intensive, as the script is executed at least 10 times a second. Edited October 2, 20241 yr by Lorby_SI LORBY-SI
October 3, 20241 yr Author I found the MS documentation in this case deviates. The values for (A:AI TRAFFIC STATE, String) in my case contained the following: STATE_IFR_CLEARANCE STATE_PUSH_BACK_BEGIN STATE_PUSH_BACK_CONTINUE STATE_ENGINE_START STATE_WAITING_FOR_ENGINE_START STATE_PRE_TAXI_FOR_TAKEOFF STATE_TAXI_FOR_TAKEOFF STATE_TAXI_ONTO_RUNWAY STATE_TAKEOFF STATE_ENROUTE_AS_FILED STATE_FLY_UNTIL_NEXT_EVENT STATE_TRAFFIC_PATTERN STATE_TAXI_TO_PARKING STATE_WAIT_FOR_ENGINE_SHUTDOWN STATE_SUPPORT_POSTFLIGHT
Create an account or sign in to comment