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

MSFS Unable to override a template parameter

Messages
527
Country
france
Hello,

In the interior model XML file, I am trying to override the SET_STATE_EXTERNAL parameter. In fact, I use the ASOBO_AUTOPILOT_Knob_Heading_Template for my heading knob, which is defined in Autopilot_Subtemplates.xml, and I would like to change the code that is executed when the knob is rotated.
In the template, it is defined like this:
Code:
<SET_STATE_EXTERNAL>1 -1 p0 0 &gt; ? sp0 #HEADING_INDEX# (A:AUTOPILOT HEADING LOCK DIR:#HEADING_INDEX#, degrees) 1 l0 * + dnor (&gt;K:2:HEADING_BUG_SET)</SET_STATE_EXTERNAL>

For my heading knob, I would like to have a different code, so in my definition, I redefined this with my own code, something like:
Code:
<SET_STATE_EXTERNAL>p0 0 &gt; if{ (&gt;K:HEADING_BUG_INC) } els{ (&gt;K:HEADING_BUG_DEC) }</SET_STATE_EXTERNAL>

As it didn't work, I tried to override the template definition by setting the default parameters that are used in the template, something like:
Code:
<Parameters Type="Default">
    <SET_STATE_EXTERNAL>p0 0 &gt; if{ (&gt;K:HEADING_BUG_INC) } els{ (&gt;K:HEADING_BUG_DEC) }</SET_STATE_EXTERNAL>
</Parameters>

It doesn't work either.
Can you please help me having my code overriding the SET_STATE_EXTERNAL ?

Thanks,
Eric
 
Messages
982
Country
australia
I think the code you are looking at is for push/pull functions of the knob and not for changing what happens when the knob is rotated. Are you sure you need to adjust SET_STATE_EXTERNAL because it doesn't look to me like that is the right code?

I think CLOCKWISE_CODE and ANTICLOCKWISE_CODE might be what you need for the actual knob functions but of course, these actually call Preset B events so you shouldn't really mess with them. At this point I lost interest in digging down through the rats nest of code.

Bottom line, I don't know exactly where the knob rotation code is written. This is why I don't use MSFS templates and prefer to code it all myself.
 
Messages
242
Country
unitedkingdom
This is why I don't use MSFS templates and prefer to code it all myself
Blimey, I thought that was only me. TBH I do use the 'Component' structure, with templates Asobo_GT_Anim and Asobo_GT_Update (sp?) as that auto-generates the GUIDs and allows the use of 'local' O: variables but otherwise Code and Lag become Anim_Code and Anim_Lag so pretty clean.
 
Messages
527
Country
france
You're right >Anthony, this is the first thing I thought about and I wrote something like this:
Code:
<CLOCKWISE_CODE>(&gt;K:HEADING_BUG_INC)</CLOCKWISE_CODE>
<ANTICLOCKWISE_CODE>(&gt;K:HEADING_BUG_DEC)</ANTICLOCKWISE_CODE>
But it didn't work, I saw that HEADING_BUG_INC and _DEC were never triggered, and HEADING_BUG_SET was triggered instead. This is why my conclusion was that the code in SET_STATE_EXTERNAL was used.
 
Messages
527
Country
france
I finally solved the problem by following your advice: I stopped using the Asobo templates, or by using only basic ones.
It now works as expected.

Thanks for your help.
 
Top