• 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 XML Coding Problem

Messages
967
Country
us-northcarolina
Please help! I am trying to create an xml gauge for the AN/ARC34 Radio to select ADF frequencies. I know just about enough xml coding learned with a lot of help from you guys here to get myself in over my head but I want to do it anyway. I am doing it for someone else who in his admission hasn't a clue where to begin. I am using Nick Pike's tutorials I have used in the past. I have been able to place the knobs where they belong on the background bitmap but

1. Position of the arcknob bitmaps. Unless I am mistaken, if the knob bitmaps are all on the same Y plane they should all have the same value, right? They don't. All four Y values are radically different making no sense to me Why? I understand that the X values will be different because of different positions from the left of the background bitmap, but the Y values??? I was able by an hour of experimentation to get them placed. See the code and the bitmap.



2. Now onto rotation: Nick says that the Axis X and Y values are one half of the size of the bitmap. Bitmap is 80 pixels wide and 80 pixels high. Therefore, the <Axis X="40" Y="40"/> right? NO! See what happens when I write that code also below: To position it back where it belongs, I had to code it: <Axis X="80" Y="80"/> If I want to have a chance at creating this I have to be able to follow the tutorial but around every corner I have a problem. If this keeps up I feel like chucking the project.
Code:
<Gauge Name="ARC34bkgd" Version="1.0">
<Image Name="ARC34bkgd1.bmp"/>

<Element>
<Position X="52" Y="49"/>
 <Image Name="arcknob0.bmp"/>

<Element>
<Position X="144" Y="0"/>
<Image Name="arcknob0.bmp"/>

<Element>
<Position X="194" Y="49"/>
<Image Name="arcknob0.bmp"/>

<Element>
<Position X="283" Y="11"/>
<Image Name="arcknob0.bmp"/>

</Element>

  <Mouse>
        <Tooltip>fake</Tooltip>
   </Mouse>

  </Gauge>

Misplaced Axis.jpg
 
Messages
967
Country
us-northcarolina
can't these be stacked or does each <Element> need to be closed separately? I had perfectly placed arcknob#.bmp's like this but questioning why the Y values which should be the same required them to be totally different to center the knobs over the "holes" When I open up FSX and try to callup the gauge it just blinked but when I put the </element> as you said it now appears on the 2D panel and the Popup but the knobs are now not correct either in FSX or in Panel Studio so I am going back and entering new X and Y values with the same Y's to see if it works properly now. Thank you. Below is the code for the radian rotation I tried and got the bmp of the panel above. No matter what value I make the and Y in the Axis code the knob bmp still sits in the top left corner of the background bitmap. I experimented and removed the Axis line and resaved the gauge code and it places the knob where it belongs BUT it does not rotate when clicked with the mouse in the aircraft. More help please.

Code:
<Gauge Name="ARC34bkgd" Version="1.0">
<Image Name="ARC34bkgd1.bmp"/>

<Element>

<Position X="52" Y="49"/>

 <Image Name="arcknob0.bmp">
 
   <Axis X="80" Y="80"/>
 
</Image>

<Rotate>
  <Value>(G:Var1)2 / 3.14159*</Value>
 
  </Rotate>

</Element>

<Mouse>
<Cursor Type="Hand"/>
<Click>10050(&gt;K:PANEL_ID_TOGGLE)</Click>
</Mouse>

   </Gauge>
 
Last edited:
Messages
967
Country
us-northcarolina
After correcting the code adding the</Element> to each, I went back in and corrected the Y values to 49 and all four are aligned. I am in the process of repossitioning the X values for each of the bitmaps. Is there a way to calculate the values precisely say in Adobe Photoshshop on the bitmap?
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
They are usually the pixel location in the background bitmap of the upper left pixel of the knob bitmap.
 
Messages
967
Country
us-northcarolina
They are usually the pixel location in the background bitmap of the upper left pixel of the knob bitmap.
Thanks, Tom, I figured that out after reading the tutorial AND hours of experimenting between Notepad++ and FS Panel Studio and FSX. My question is now that I have them properly placed can I calculate these in Photoshop or Paintshop Pro using a ruler on the background bmp so I don't have to spend hours between programs or is it like MDCx?
 
Messages
967
Country
us-northcarolina
I need help in coding the rotation because Nick's tutorial is not helping me. I understand using radians but the Axis coding is the problem. It doesn't work the way I understand it in Nick Pike's tutorial.

I want to be able to click the arcknob and have it rotate in 36 degree increments so that each click will advance the adf strip up or down from 0-9 in the window above once for each click left or right clicks to select an adf frequency of from 190 to 1750 so that it is international. In the USA adf frequencies are only from 190 to 535. This is what I want the gauge to do on top when the handle has selected ADF on the right. That is the goal.

I didn't just come here and ask you to create the gauge without spending hours trying myself. I can see in the tutorials everything that needs to be done and I am patient to take one step at a time. I read about masks for the strips to only show one number in the window. I also saw in an adf digital gauges that each window will have to represent a value of 1, 10 or 100 from the gauge. So I am asking for help here please. I learn from you as I do this. I can do all of SODE stuff now I learned here and have six airports with SODE objects in them now. Thanks to Bushpilot. Besides other gauges you helped with in other panels. I just need ya'all again.
 
Last edited:
Messages
205
Country
netherlandsantilles
one less elegant way I have solve these is by blitting the knob bitmap with the position you want it to be with certain value.
you can use a case statement for that, if that is what you want anyway not sure I understand exactly what you want.
Also besides a case statement you need to define mouse area for the knobs and their animation code.

there are other more elegant solutions like these:

go here and study chapter 2 for mouse area creation etc:

Im a bit lazy and rusty to go into the details , best of luck with your project.
 
Messages
967
Country
us-northcarolina
thank you adino. I have to go out for a bit but I will try and use degrees. I know how to use multiple bmp's from programming switches and buttons but rotary buttons are new to me. If degrees works for the knobs then I will go to the next stage of adding the strips to the windows and masks for them I am doing knobs one at a time.
 
Messages
967
Country
us-northcarolina
OK this is supposed to be valid code, no errors according to my Xml Online checker. It shows up perfectly in FS Panel Studio. I used P3D SDK to finally get the explanation of the <Axis X= Y=> and determined how to get pixels on the guides in Adobe Photoshop. The arcknob0.bmp is exactly located where it should be. Then when I open up the aircraft with it in the panel.cfg there is NO GAUGE either on the 2D panel or in the Popup. Here is the code. Help please!
Code:
<Gauge Name="ARC34bkgd" Version="1.0">
<Image Name="ARC34bkgd1.bmp"/>

<Element>

<Position X="52" Y="49"/>

 <Image Name="arcknob0.bmp">
 <Axis X="90" Y="90"/>
 
</Image>

<Rotate>
         <Value Minimum="0" Maximum="9">(L:ADF_100_INC,enum)</Value>
         <Nonlinearity>
            <Item Value="0" Degrees="360"/>
            <Item Value="1" Degrees="036"/>
            <Item Value="2" Degrees="072"/>
            <Item Value="3" Degrees="108"/>
            <Item Value="4" Degrees="144"/>
            <Item Value="5" Degrees="180"/>
            <Item Value="6" Degrees="216"/>
            <Item Value="7" Degrees="252"/>
            <Item Value="8" Degrees="288"/>
            <Item Value="9" Degrees="324"/>
            
            
          </Nonlinearity>
          
      </Rotate>
   </Element>
  
   <Mouse>
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">
        (M:Event) 'LeftSingle' scmp 0 == (M:Event) 'WheelUp' scmp 0 == or if{ (L:ADF_100_INC,enum) ++ 7 % (>L:AirConSel, enum) }
        (M:Event) 'RightSingle' scmp 0 == (M:Event) 'WheelDown' scmp 0 == or if{ (L:ADF_100_INC,enum) -- d 0 &lt; 7 * + (L:ADF_100_INC,enum) }
      </Click>
   </Mouse>
</Gauge>
 
Messages
495
Country
austria
At the mouse section there is missed an area.

XML:
    <Area Left="1" Top="1" Right="22" Bottom="17">

    </Area>

e.g.

XML:
  <Mouse>
    <Area Left="1" Top="1" Right="22" Bottom="17">
    <Cursor Type="Hand"/>
    <Click Kind="LeftSingle+RightSingle">
    (M:Event)
      'LeftSingle' scmp 0 ==
      if{

        }

      (M:Event)
      'RightSingle' scmp 0 ==
      if{

        }
    </Click>
    </Area>
  </Mouse>
 
Messages
150
Country
england
I found this was easier for me to understand using the ‘other’ method

<Area Left="117" Top="130" Width="20" Height="20">

Area left and top, are the X and Y pos of the top left corner of where the click area is to be, width is how many pixels wide that area is too be, as is height.

so the above will make a 20x20 pixel click area.
 
Messages
967
Country
us-northcarolina
Thank you both for your help. I have added it to the gauge hoping it would solve the arcknob problem but it didn't. Why without the rotate degrees commands the axis command puts the arcknob0 exactly where it belongs but with the rotate-degrees it is in t he upper left corner like there IS no axis code. In FS Panel Studio it is correctly located with all the code above BUT in the panel in FSX it is in the upper left corner. I am so frustrated with this gauge coding It is much more complex than I have ever done but I wanted to learn a lot with it but not bang my head against the monitor every time I add a litte more code. Thanks for the mouse help. How/if can you explain this problem with the location please.
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
I have never used the Degrees method for NonLinearity. I have used this format with success:

XML:
<Item Value="0" X="166" Y="21"/>

The numbers are the pixel coordinates of the background bitmap that you want the knob image to point to.
 
Messages
967
Country
us-northcarolina
The degrees is much easier to understand and create than pixel coordinates to me That does not answer the question of why it is positioned in FS Panel studio correctly with the <AXIS X="90" Y="90" /> and not in FSX on the panel but in the upper left corner like there is no Axis or its improperly coded which is what I was doing for awhile.
 
Last edited:
Messages
150
Country
england
Not sure if this example of a rotating knob helps you.

XML:
 <Element>
      <Position X="272" Y="404"/>    
      <Image Name="Alt_knobMarked3.bmp" PointsTo="WEST">
         <Axis X="101" Y="101"/>
      </Image>
      <Rotate>
         <Value Minimum="0" Maximum="80">(L:AltLvar,percent)</Value>
         <Nonlinearity>
        <Item Value="0" Degrees="-150"/>  
            <Item Value="40" Degrees="0"/>
            <Item Value="80" Degrees="150"/>
         </Nonlinearity>
      </Rotate>      
   </Element>

mouse
XML:
<Area Left="169" Top="360" Height="207" Width="54">
       <Tooltip>ALTITUDE DECREASE</Tooltip>      
        <Cursor Type="DownArrow"/>
       
        <Click Repeat="Yes">(L:AltLvar,percent) 1 - s0 0 &lt; if{ 0 } els{ l0 } (&gt;L:AltLvar,percent)</Click>

      </Area>

      <Area Left="369" Top="346" Height="207" Width="54">
     <Tooltip>ALTITUDE INCREASE</Tooltip>
         <Cursor Type="UpArrow"/>
             
       <Click Repeat="Yes">(L:AltLvar,percent) 1 + s0 80 &gt; if{ 80 } els{ l0 } (&gt;L:AltLvar,percent)</Click>

I use the simple Microsoft paint and the pencil. Choose a bright colour and click the area you want the 'Position' info for:

40x40 is yellow pixel

22.jpg

Push a pin through your 'axis' and place it in 'position'
 
Messages
967
Country
us-northcarolina
Thank you. I will use your code and substitute my bmp names and see if it works. Axis I actually figured how to calculate in Adobe Photoshop by changing the guides to pixels which I found online and then in the P3D SDK, FSX not being as much help as it should be. This is still frustrating that didn't work either. The knob disappeared completely with your code.
 
Last edited:
Messages
967
Country
us-northcarolina
I already posted that I am not working on it any longer at soh. Administrator please close this post.
 
Top