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

MSFS20 Template AP Button Naming Question

Messages
10,158
Country
us-arizona
Hey all,

How is the button name derived from this Template? This is for Altitude button on a regular small plane. This is the MSFS SDK Template for the button;

Code:
    <Template Name="ASOBO_AUTOPILOT_Push_Altitude_Template">
        <DefaultTemplateParameters>
            <DEFAULT_NAME>Altitude</DEFAULT_NAME>
            <HELPID>HELPID_AUTOPILOT_ALTITUDE_HOLD</HELPID>
            <TOOLTIPID>%((A:AUTOPILOT ALTITUDE LOCK, bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_ALT_ON%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_ALT_OFF%{end}</TOOLTIPID>
            <ON_ALTITUDE_MODE_SWITCH></ON_ALTITUDE_MODE_SWITCH>
        </DefaultTemplateParameters>
        <UseTemplate Name="ASOBO_AUTOPILOT_Push_Template">
            <Switch Param="TYPE">
                <Case Value="B747">
                    <LEFT_SINGLE_CODE>(&gt;H:B747_8_FMC_1_AP_ALT_HOLD)</LEFT_SINGLE_CODE>
                    <EMISSIVE_CODE_ACTIVE>(L:AP_ALT_HOLD_ACTIVE)</EMISSIVE_CODE_ACTIVE>
                </Case>
                <Case Value="AS01B">
                    <LEFT_SINGLE_CODE>(&gt;H:AS01B_FMC_1_AP_ALT_HOLD)</LEFT_SINGLE_CODE>
                    <EMISSIVE_CODE_ACTIVE>(L:AP_ALT_HOLD_ACTIVE)</EMISSIVE_CODE_ACTIVE>
                </Case>
                <Default>
                    <LEFT_SINGLE_CODE>(&gt;K:AP_ALT_HOLD) #ON_ALTITUDE_MODE_SWITCH#</LEFT_SINGLE_CODE>
                    <EMISSIVE_SIMVAR_ACTIVE>AUTOPILOT ALTITUDE LOCK</EMISSIVE_SIMVAR_ACTIVE>
                </Default>
            </Switch>
        </UseTemplate>
    </Template>

Would it be ASOBO_AUTOPILOT_Push_Altitude_AS01B_1 ? does it need a 1?
 
I found them. Thanks to Benjamin at Asobo. The names for the part ID's and animation names are at the top of the KAP140.XML file.

Sample: AUTOPILOT_Push_Heading_1


Now to figure out how to enter the Template data (transfer) to the Model XML.... :S

Bill
 
Hey, Bill

Have a look at the DA62 sample - it gives a better representation of using templates than any other sample.

I have Notepad++ and the added json plugin.

As an example the interior.xml has the engine master.

1609175425505.png



if you use notepad++ you will see the json file from the DA62_INTERIOR_LOD00.gltf file.

1609175498816.png
 
Many thanks, Ron.
I believe I have successfully found all the animation and parts names. But I couldnt find the ARM, BARO, UP, and Down, and dual part ALT knob sections. The sections arent fully there. They are split. So I am kind of stuck. The rest of the buttons on the AP are good and running though. Screen is working, etc. If only they didnt split up the sections, or explain how to bring in, or link to, the documents for Autopilot...

What I need is the Cessna Skylane Classic cockpit interior XML. That would show how the buttons are linked. But its hidden. You can see the G1000 version Cessna model XML, but not the Classic with steam gauges and radio stack.

Its nice and easy when the components are easily in one neat location. I wish this was like that... :S
 

Attachments

  • Screenshot 2020-12-28 201027.jpg
    Screenshot 2020-12-28 201027.jpg
    35.5 KB · Views: 237
The AP might be broke, by the way, on the Cessna 172 Classic. Its not behaving properly in flight. At least on my computer. ARM doesnt work, UP DOWN causes a nose climb with stall. Might still have bugs.

Good detective work finding that data on the JSON file! Nice one....
 
Ya the classic Cessna is DRM. SO you can't look at the code. Will try the review the KAP140 and see what we find.
 
I just got the AP UP/DOWN buttons to work in the Cessna. (not the Trinidad.. yet... ). So that does work.
 
Have you looked at the javascript and html css files for the KAP?

F:\MSFS\Official\OneStore\asobo-vcockpits-instruments-generic\html_ui\Pages\VCockpit\Instruments\Generic\Autopilots\KAP140

What are you not getting - with the templates you should not need too much.

<Component ID="#KNOB_1000_NODE_ID#" Node="#KNOB_1000_NODE_ID#">
<UseTemplate Name="ASOBO_GT_Knob_Infinite">
.....
<CLOCKWISE_CODE>(&gt;H:#KEY_PREFIX#_Knob_Inner_INC)</CLOCKWISE_CODE>
<ANTICLOCKWISE_CODE>(&gt;H:#KEY_PREFIX#_Knob_Inner_DEC)</ANTICLOCKWISE_CODE>


the KEY_PREFIX is KAP140 - so the KAP140_Knob_Inner_INC

<KNOB_100_NODE_ID>AUTOPILOT_Knob_Altitude_100#SUFFIX_ID#</KNOB_100_NODE_ID>
<KNOB_100_ANIM_NAME>AUTOPILOT_Knob_Altitude_100#SUFFIX_ID#</KNOB_100_ANIM_NAME>
<KNOB_1000_NODE_ID>AUTOPILOT_Knob_Altitude_1000#SUFFIX_ID#</KNOB_1000_NODE_ID>
<KNOB_1000_ANIM_NAME>AUTOPILOT_Knob_Altitude_1000#SUFFIX_ID#</KNOB_1000_ANIM_NAME>

SUFFIX is 1

<DefaultTemplateParameters>
<ID>1</ID>
</DefaultTemplateParameters>
<UseTemplate Name="ASOBO_GT_Helper_Suffix_ID_Appender">
<TEMPLATE_TO_CALL>ASOBO_KAP140_SubTemplate</TEMPLATE_TO_CALL>
</UseTemplate>
 
I now have the Baro and Arm buttons working. Baro is actually FLC mode and ARM is VS mode, lol... I should know this.

Now to get Up, Down, and the two Altitude knobs working. I was close. I think I had the Up/Down buttons working and everything crashed. Erased my AP settings and rebuilt things.

I guess you learn more when you keep messing up, lol... ACK!
 
I wonder if we should re-write some of these, adding in the proper names of the nodes and animations, without all the # symbols?
I did try that last night, but it didnt work. Maybe I did it wrong?
A new day... Hopefully today I get the up, down, and altitude adjustment knobs all working... and the Transponder!
 
The # means they are variables that you setup. Think of the templates as macros from before. You k\just have to match you gltf file with the names in the KAP140.xml file.

The beauty of this is your code is small (From the cessna 150)

<Component ID="TRANSPONDER">
<UseTemplate Name="ASOBO_5Knobs_Transponder_Template">
<DONT_APPEND_ID>True</DONT_APPEND_ID>
<ANIM_LAG>500</ANIM_LAG>
</UseTemplate>
</Component>

In the above - the <ANIM_LAG>500</ANIM_LAG> is used to replace wherever #ANIM_LAG is - so #ANIM_LAG = 500. The template ASOBO_5Knobs_Transponser_Template contains all the code to make it work. PM me if you want.
 
Ah soooo... Interesting... Many thanks, Ron.
I am still finishing up on the AP, then on to the Transponder.

I found out today from Dean that I need to fill out the things like Animations, taking out the # symbols. So I was right in that we need to lightly edit these before they fully function.

This is the AP knob, one of two;


Code:
<!-- Knob have different functions based on context -->
        <Component ID="#KNOB_100_NODE_ID#" Node="#KNOB_100_NODE_ID#">
            <UseTemplate Name="ASOBO_GT_Knob_Infinite">
                <ANIM_NAME>#KNOB_100_ANIM_NAME#</ANIM_NAME>
                <CLOCKWISE_CODE>(&gt;H:#KEY_PREFIX#_Knob_Inner_INC)</CLOCKWISE_CODE>
                <ANTICLOCKWISE_CODE>(&gt;H:#KEY_PREFIX#_Knob_Inner_DEC)</ANTICLOCKWISE_CODE>
                <WWISE_EVENT>autopilot_altitude_100_knob</WWISE_EVENT>
                <COUNT>36</COUNT>
                <ANIMREF_ID>0</ANIMREF_ID>
                <ANIMCURSOR_MIN>-1</ANIMCURSOR_MIN>
                <ANIMCURSOR_MAX>-1</ANIMCURSOR_MAX>
                <ANIMTIP_0_ON_CURSOR>TurnLeft</ANIMTIP_0_ON_CURSOR>
                <ANIMTIP_1_ON_CURSOR>TurnRight</ANIMTIP_1_ON_CURSOR>
                <ANIMTIP_0>%((L:KAP140_BARO_Display, Bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_BARO_KNOB_DECREASE%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_ALT_DECREASE%{end}</ANIMTIP_0>
                <ANIMTIP_1>%((L:KAP140_BARO_Display, Bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_BARO_KNOB_INCREASE%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_ALT_INCREASE%{end}</ANIMTIP_1>
            </UseTemplate>
        </Component>

100' and 1000' feet adjuster knobs for ALT setting.
The name given in the code that I have is
AUTOPILOT_Knob_Altitude_100_1
AUTOPILOT_Knob_Altitude_1000_1

Will make some changes and see if this will work.
 
Do you have a mix of old modeldef code and template code. These names are correct.

AUTOPILOT_Knob_Altitude_100_1
AUTOPILOT_Knob_Altitude_1000_1

but you did not have to make up any code yourself, that's what I mean. But you do have to name everything the same as ASOBO does for the parts.

H: ?? your guess is as good as mine. HTML gauge key event id
 
Ron, can you tell me why both of these knobs animate/cause a 100 increment effect of settings for ALT?
One should be 100 ALT, and the other should be 1000 ALT.



Code:
<Component ID="AUTOPILOT_Knob_Altitude_Hundred" Node="AUTOPILOT_Knob_Altitude_Hundred_1">
        <UseTemplate Name="ASOBO_AUTOPILOT_Knob_Altitude_Template">
            <INCREMENT>100</INCREMENT>
            <NODE_ID>AUTOPILOT_Knob_Altitude_Hundred_1</NODE_ID>
            <ANIM_NAME_KNOB>AUTOPILOT_Knob_Altitude_Hundred_1</ANIM_NAME_KNOB>
        </UseTemplate>
        </Component>
        <Component ID="AUTOPILOT_Knob_Altitude_Thousand" Node="AUTOPILOT_Knob_Altitude_Thousand_1">
        <UseTemplate Name="ASOBO_AUTOPILOT_Knob_Altitude_Template">
            <INCREMENT>1000</INCREMENT>
            <NODE_ID>AUTOPILOT_Knob_Altitude_Thousand_1</NODE_ID>
            <ANIM_NAME>AUTOPILOT_Knob_Altitude_Thousand_1</ANIM_NAME>
        </UseTemplate>
        </Component>

They both use the same Template. That might be my problem. Thats the only Template I could find that is a knob in the Autopilot.XML.

I double checked all animations and part names in Blender. Everything is correct.

At least now I have progress. Both have Mouserect, I think they were turning (Animating), and they talk to the AP screen, causing change in VS setting.


Bill.. of the shiny gray eyebrow people...
 
All working. :D Whew........ THREE DANG DAYS TO GET THEM WORKING! Man..... Not good.
Code:
        <!-- AUTOPILOT ######################################-->

        <Component ID="AUTOPILOT">

    <!-- KAP 140 -->
    <Template Name="ASOBO_KAP140_Template">
        <DefaultTemplateParameters>
            <ID>1</ID>
        </DefaultTemplateParameters>
        <UseTemplate Name="ASOBO_GT_Helper_Suffix_ID_Appender">
            <TEMPLATE_TO_CALL>ASOBO_KAP140_SubTemplate</TEMPLATE_TO_CALL>
        </UseTemplate>
    </Template>

            <DefaultTemplateParameters>
                <CIRCUIT_ID>26</CIRCUIT_ID>
                <EMISSIVE_CODE>0.1</EMISSIVE_CODE>
            </DefaultTemplateParameters>
            <Component ID="AUTOPILOT_Decals" Node="AUTOPILOT_Decals_1">
                <UseTemplate Name="ASOBO_GT_Emissive_Gauge">
                    <EMISSIVE_CODE>(A:CIRCUIT ON:#CIRCUIT_ID#, Bool) #EMISSIVE_CODE# *</EMISSIVE_CODE>
                </UseTemplate>
            </Component>
            <!-- ENGAGE/DISENGAGE ------------------------------------------------------------------------------->
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Autopilot_Template">
                <ON_AP_MASTER_SWITCH>
                    (A:AUTOPILOT MASTER, Bool) if{
                        (A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, Bool) ! if{
                            1 (&gt;K:TOGGLE_FLIGHT_DIRECTOR)
                        }
                    }
                </ON_AP_MASTER_SWITCH>
            </UseTemplate>
            <!-- HEADING ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Heading_Template">
            </UseTemplate>
            <UseTemplate Name="ASOBO_AUTOPILOT_Knob_Heading_Template">
                <PUSH/>
            </UseTemplate>
            <!-- BANK ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Bank_Template">
                <REVERSE_ACTIVE_CONDITION>True</REVERSE_ACTIVE_CONDITION>
            </UseTemplate>
            <!-- APPROACH ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Approach_Template">
            </UseTemplate>
            <!-- BACKCOURSE ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_BackCourse_Template">
                <ID>1</ID>
            </UseTemplate>
            <!-- FLIGHT DIRECTOR ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_FlightDirector_Template">
                <FD_TOGGLE_CONDITION>(A:AUTOPILOT MASTER, Bool) !</FD_TOGGLE_CONDITION>
            </UseTemplate>
            <!-- YAW DAMPER ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_YawDamper_Template">
            </UseTemplate>
            <!-- ALTITUDE ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_FlightLevelChange_Template">
            </UseTemplate>
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Altitude_Template">
            </UseTemplate>
            <!-- NAV ------------------------------------------------------------------------------->  
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Navigation_Template">
            </UseTemplate>
        <!-- ARM -->
        <Component ID="VerticalNavigation">
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_Vertical_Navigation_Template">
                    <NODE_ID>AUTOPILOT_Push_VerticalSpeed_1</NODE_ID>
                <ANIM_NAME>AUTOPILOT_Push_VerticalSpeed_1</ANIM_NAME>
                                     <LEFT_SINGLE_CODE>(&gt;H:AS01B_FMC_1_AP_VNAV)</LEFT_SINGLE_CODE>
                <TOOLTIPID>%((L:AP_VNAV_ARMED))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_VNAV_ON%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_VNAV_OFF%{end}</TOOLTIPID>
            </UseTemplate>
        </Component>

        <!-- UP -->
        <Component ID="VerticalSpeed_Up">
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_VerticalSpeed_Direction_Template">
                    <NODE_ID>AUTOPILOT_Push_VerticalSpeed_Up_1</NODE_ID>
                <ANIM_NAME>AUTOPILOT_Push_VerticalSpeed_Up_1</ANIM_NAME>
                    <LEFT_SINGLE_CODE>(&gt;K:AP_VS_VAR_INC) (&gt;H:AP_DN)</LEFT_SINGLE_CODE>
                <TOOLTIPID>%((A:AUTOPILOT VERTICAL HOLD, Bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_VS_INCREASE%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_ALTITUDE_HOLD_REFERENCE_DECREASE%{end}</TOOLTIPID>
            </UseTemplate>
        </Component>

        <!-- DN -->
        <Component ID="VerticalSpeed_Down">
            <UseTemplate Name="ASOBO_AUTOPILOT_Push_VerticalSpeed_Direction_Template">
                    <NODE_ID>AUTOPILOT_Push_VerticalSpeed_Down_1</NODE_ID>
                <ANIM_NAME>AUTOPILOT_Push_VerticalSpeed_Down_1</ANIM_NAME>
                    <LEFT_SINGLE_CODE>(&gt;K:AP_VS_VAR_DEC) (&gt;H:AP_UP)</LEFT_SINGLE_CODE>
                <TOOLTIPID>%((A:AUTOPILOT VERTICAL HOLD, Bool))%{if}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_VS_DECREASE%{else}TT:COCKPIT.TOOLTIPS.AUTOPILOT_PANEL_ALTITUDE_HOLD_REFERENCE_DECREASE%{end}</TOOLTIPID>
            </UseTemplate>
        </Component>

  <Component ID="AUTOPILOT_Knobs">
        <UseTemplate Name="ASOBO_AUTOPILOT_Knob_Altitude_Template">
            <INCREMENT>100</INCREMENT>
            <NODE_ID>AUTOPILOT_Knob_Altitude_Hundred_1</NODE_ID>
            <ANIM_NAME_KNOB>AUTOPILOT_Knob_Altitude_Hundred_1</ANIM_NAME_KNOB>
        </UseTemplate>
        </Component>
        <Component ID="AUTOPILOT_Knob_Altitude_Thousand" Node="AUTOPILOT_Knob_Altitude_Thousand_1">
        <UseTemplate Name="ASOBO_AUTOPILOT_Knob_Altitude_Template">
            <INCREMENT>1000</INCREMENT>
            <NODE_ID>AUTOPILOT_Knob_Altitude_Thousand_1</NODE_ID>
            <ANIM_NAME>AUTOPILOT_Knob_Altitude_Thousand_1</ANIM_NAME>
        </UseTemplate>
  </Component>

  </Component>
 
Last edited:
Nice Bill.

See how small all this is. You are using a bunch of "macros" => templates to get the code behind all this working.

One thing is you are missing a

</Component>

right at the end - last line. to match the

<Component ID="AUTOPILOT">

at the beginning.

Thanks for sharing - learning all this new stuff too!
 
oops... I thought I had that in there. I erased it a couple of times, which crashes the compiler. I edited it and corrected the code.
I must have not copied low enough down and missed the last /Container line.

Brackets brackets brackets...
Containers, Knobs, Pushes... ACK!

I am wondering if there is a way to make an App that reads all these. Probably not as many of the Templates are written in a 'fill in the blank' manner. They have to completed. So probably not.

It would be nice for newbe beginner developers to have a program like 'Animation Manager' that can generate the proper names, and a copy/paste set of code blocks for ones model XML(s).


Bill... of the strange, massive gray eyebrow people...
 
Back
Top