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

FSXA Converting FS9 XML to FSXA Help

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
I have converted 712 lines of FS9 code but that leaves just a few things I do not have examples for on the FSX native code side:

1) tooltip_text
2) minvalue and maxvalue expressions
3) and unsure of any computational or comparison formats/expressions need to be changed


Is there definitive help somewhere for all the typical code used for custom xml for models?

Here are some examples of yet to be completed as stated above (in RED):

Code:
    <MouseRect>
        <Cursor>Hand</Cursor>
        <tooltip_text>"Canopy Curtain"</tooltip_text>
        <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
        <CallbackCode>
            (M:Y) 0 max 100 min (&gt;L:Havoc_Curtain, number)
        </CallbackCode>
    </MouseRect>

Code:
<PartInfo>
<Name>yoke_vis</Name>
 <Visibility>
    <Parameter>
        <Code>
            (L:yoke_vis, bool) 0 ==
        </Code>
    </Parameter>
   <minvalue>1</minvalue>
 </Visibility>
</PartInfo>

Code:
<PartInfo>
<Name>door_cargo_BBopen_15</Name>
    <AnimLength>
        <Parameter>
            <Code>
(L:vis_bbexcl, number) 2 == (L:vis_bbexcl, number) 1 == || if{ 0 } els{ (A:EXIT OPEN:1, percent) }
            </Code>
        </Parameter>
    </AnimLength>
</PartInfo>

Any guidance immensely appreciated.

Thanks
 

Paul Domingue

Resource contributor
Messages
1,530
Country
us-california
On the tool tip,

<Tooltiptext>Canopy Curtain</Tooltiptext>

The other stuff looks correct but I'm no expert that's for sure.
 

Paul Domingue

Resource contributor
Messages
1,530
Country
us-california
I'm not sure about the proper use. The FSX SDK refers to Bit Operators min and max. (Example: 5 2 min = 2) (Example: 5 2 max = 5). I'll leave it to better heads to correct me. :rolleyes:
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Milton,

Code:
                <MinValue>-16384</MinValue>
                <MaxValue>16384</MaxValue>
Code:
<PartInfo>
<Name>yoke_vis</Name>
 <Visibility>
    <Parameter>
        <Code>
            (L:yoke_vis, bool) 0 ==
        </Code>
    </Parameter>
   <MinValue>1</MinValue>
 </Visibility>
</PartInfo>
Truthfully though, I've never had to use <MinValue> in my scripts for simple <Visibility> conditions.
Code:
  <PartInfo>
    <Name>yoke_pilot</Name>
    <Visibility>
      <Parameter>
        <Code>(L:YokePilot,bool) 0 &gt; if{ 0 } els{ 1 }</Code>
      </Parameter>
    </Visibility>
  </PartInfo>
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Thanks Bill; I prefer your way too; much simpler. :)

Okay, I now have all the changes done; now to setup the other components for Modeldef. Thanks a bunch! :)
 
Last edited:

tgibson

Resource contributor
Messages
11,327
Country
us-california
I assume you are doing this to make it compatible with that new flight sim I can't remember the name of? It isn't required for FSX or P3D.
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
I assume you are doing this to make it compatible with that new flight sim I can't remember the name of? It isn't required for FSX or P3D.

Doing what? Converting FS9 xml to FSX native xml?

What is not required for FSX/P3D?

Sorry, am not clear on what "this" and "It" refers to.
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
Sorry, I thought I was in the Gauges forum. Senior moment...
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
I have 3 switches that do not work and I believe its because of the FS9 xml style mouse code. Should this use "CallbackJumpDragging" instead of "CallbackCode".

Code:
<!-- INERTIA SWITCH -->
<!-- 50 Frames, 0 = Up, 25 = Mid, 50 = Down -->
<PartInfo>
    <Name>inertia_switch</Name>
    <AnimLength>
        <Parameter>
            <Code>
(L:Sw_Inertia, number) 1 == if{ 0 } els{ (L:Sw_Inertia, number) -1 == if{ 50 } els{ 25 } }
            </Code>           
        </Parameter>
    </AnimLength>
    <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>Inertia - Left Click = Left On/Off, Right Click = Right On/Off</TooltipText>
        <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
(M:Event) 'LeftSingle' scmp 0 == if{ (L:Sw_Inertia, number) 0 == if{ 1 (>L:Sw_Inertia, number) } els{ 0 (>L:Sw_Inertia, number) } }
(M:Event) 'RightSingle' scmp 0 == if{ (L:Sw_Inertia, number) 0 == if{ -1 (>L:Sw_Inertia, number) } els{ 0 (>L:Sw_Inertia, number) } }
        </CallbackCode>
    </MouseRect>
</PartInfo>
 

Vitus

Resource contributor
Messages
1,480
Country
newzealand
Hello Milton,

remember that you need to use &gt; to assign values in the modeldef. The rest looks fine to me.
Try this:
Code:
<!-- INERTIA SWITCH -->
<!-- 50 Frames, 0 = Up, 25 = Mid, 50 = Down -->
<PartInfo>
    <Name>inertia_switch</Name>
    <AnimLength>
        <Parameter>
            <Code>
(L:Sw_Inertia, number) 1 == if{ 0 } els{ (L:Sw_Inertia, number) -1 == if{ 50 } els{ 25 } }
            </Code>           
        </Parameter>
    </AnimLength>
    <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>Inertia - Left Click = Left On/Off, Right Click = Right On/Off</TooltipText>
        <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
(M:Event) 'LeftSingle' scmp 0 == if{ (L:Sw_Inertia, number) 0 == if{ 1 (&gt;L:Sw_Inertia, number) } els{ 0 (&gt;L:Sw_Inertia, number) } }
(M:Event) 'RightSingle' scmp 0 == if{ (L:Sw_Inertia, number) 0 == if{ -1 (&gt;L:Sw_Inertia, number) } els{ 0 (&gt;L:Sw_Inertia, number) } }
        </CallbackCode>
    </MouseRect>
</PartInfo>
 

Vitus

Resource contributor
Messages
1,480
Country
newzealand
Oh no, wait. There's something wrong in the animation section as well:
Code:
    <AnimLength>50</AnimLength>
    <Animation>
        <Parameter>
            <Code>
(L:Sw_Inertia, number) 1 == if{ 0 } els{ (L:Sw_Inertia, number) -1 == if{ 50 } els{ 25 } }
            </Code>           
        </Parameter>
    </Animation>

Also think about if you want to switch to the type enum for your variable to avoid wrong interpretation by FSX. Since Sw_Inertia seems to contain an integer enum would be the better type.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
"enum" and "number" are synonyms. In the context of assigning an (L:vars,unit) values either &gt; or > will work just fine.

This is how I script three position switches:
Code:
  <PartInfo>
    <Name>T38_HSI_SourceSwitch</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:T38_HSI_SourceSwitch,enum) 25 *
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle'  scmi 0 ==
        (M:Event) 'WheelDown'   scmi 0 == or
          if{ (L:T38_HSI_SourceSwitch,enum) -- 0 max (>L:T38_HSI_SourceSwitch,enum) }
        (M:Event) 'RightSingle' scmi 0 ==
        (M:Event) 'WheelUp'     scmi 0 ==  or
          if{ (L:T38_HSI_SourceSwitch,enum) ++ 2 min (>L:T38_HSI_SourceSwitch,enum) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
Just to make things clear to me I use enum for variables that will only have integer values (1, 2, 3, etc.) and number for floating point numbers (2.46343).
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Tom, I actually follow the same practice myself, but truth be known, you could use "fred" or "ginger" as unit names and it will still work... at least I've found this to be the case. :laughing:
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
I have heard both things:

1. You can use anything and they will still be in the same format (double float or something like that).
2. Using valid units does make a difference to FS.

I don't know which one is correct.
 
Top