• 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 2D cockpit side views

Messages
495
Country
austria
I played a litle bit around...
Now it switches back to front view and prevents permanent firing an event!

Code:
<Gauge Name="Fixed_Window.xml" Version="1.0">

<Comment>
Check XMLKeys_reference.txt for other HAT values.

POV         Point of view switch (often called the         0 facing ahead
        hat switch).                      4500 forward right               
                                9000 right
                                13500 rear right
                                18000 rear
                                22500 rear left
                                27000 left
                                31500 forward left
</Comment>

<Update Frequency="18"/>

    <Macro Name="k">C:XMLKEYS</Macro>

    <Macro Name="KeyDisable">
        @1 (>@k:KeyName,string) (>@k:KeyCaptureOff,bool)
    </Macro>

    <Macro Name="KeyEnable">
        @1 (>@k:KeyName,string) (>@k:KeyCaptureOn,bool)
    </Macro>

    <Macro Name="KeyName">
        @1 (>@k:KeyName,string)
    </Macro>

    <Macro Name="KeyConfig">
        @1 (>@k:KeyName,string) '@2' (>@k:KeyString,string)
    </Macro>

    <Macro Name="JoyStickHAT">
      (L:HAT_Number,number) s0

      l0 0 ==     if{ (>K:VIEW_FORWARD)       (L:FrontView,number) 1 + (&gt;L:FrontView,number) }
      l0 4500 ==  if{ (>K:VIEW_FORWARD_RIGHT) (L:FrontRightView,number) 1 + (&gt;L:FrontRightView,number) }
      l0 9000 ==  if{ (>K:VIEW_RIGHT)         (L:RightView,number) 1 + (&gt;L:RightView,number) }
      l0 13500 == if{ (>K:VIEW_REAR_RIGHT)    (L:RearRightView,number) 1 + (&gt;L:RearRightView,number) }
      l0 18000 == if{ (>K:VIEW_REAR)          (L:RearView,number) 1 + (&gt;L:RearView,number) }
      l0 22500 == if{ (>K:VIEW_REAR_LEFT)     (L:RearLeftView,number) 1 + (&gt;L:RearLeftView,number) }
      l0 27000 == if{ (>K:VIEW_LEFT)          (L:LeftView,number) 1 + (&gt;L:LeftView,number) }
      l0 31500 == if{ (>K:VIEW_FORWARD_LEFT)  (L:FrontLeftView,number) 1 + (&gt;L:FrontLeftView,number) }

      (L:HAT_Number,number) (&gt;L:HAT_Number_PRV,number)
    </Macro>

    <Update Hidden="Yes">
      (L:XMLKeysInit,bool) !
      if{
        <!-- Joystick HAT's custom behavior -->
        @KeyConfig('joystick:0:POV',@JoyStickHAT)

        <!--  Enable joystick HAT's capture  -->
        @KeyEnable('joystick:0:POV')
        1 (>L:XMLKeysInit,bool)
        }

     <!--  HAT's captured value  -->
      @KeyName('joystick:0:POV')
      (@k:KeyValue,number) (>L:HAT_Number,number)



<!-- prevents permanent events -->
      (L:HAT_Number,number) (L:HAT_Number_PRV,number) !=
      if{
        @JoyStickHAT   <!-- added -->
        (L:HAT_Number,number) (&gt;L:DBG_HAT_Number,number)
        }

      4500 31500 (L:HAT_Number,number) rng
      if{
        0 (&gt;L:FixdW_Front_ViewSet,bool)
        }

      4500 31500 (L:HAT_Number,number) rng !
      (L:FixdW_Front_ViewSet,bool) !
      &amp;&amp;
      if{
        (>K:VIEW_FORWARD)       (L:FrontView,number) 1 + (&gt;L:FrontView,number)
        1 (&gt;L:FixdW_Front_ViewSet,bool)
        }
    </Update>


<!-- at the moment off -->
<!--
  <Keys>
    <On Event="VIEW_RESET">
      (L:FrontView,number) 1 + (&gt;L:FrontView,number)
    </On>
    <On Event="VIEW_FORWARD">
      (L:FrontView,number) 1 + (&gt;L:FrontView,number)
    </On>
    <On Event="VIEW_WINDOW_TO_FRONT">
      (L:FrontView,number) 1 + (&gt;L:FrontView,number)
    </On>
    <On Event="VIEW_FORWARD_LEFT">
      (L:FrontLeftView,number) 1 + (&gt;L:FrontLeftView,number)
    </On>
    <On Event="VIEW_FORWARD_RIGHT">
      (L:FrontRightView,number) 1 + (&gt;L:FrontRightView,number)
    </On>
    <On Event="VIEW_LEFT">
      (L:LeftView,number) 1 + (&gt;L:LeftView,number)
    </On>
    <On Event="VIEW_RIGHT">
      (L:RightView,number) 1 + (&gt;L:RightView,number)
    </On>
    <On Event="VIEW_REAR_LEFT">
      (L:RearLeftView,number) 1 + (&gt;L:RearLeftView,number)
    </On>
    <On Event="VIEW_REAR_RIGHT">
      (L:RearRightView,number) 1 + (&gt;L:RearRightView,number)
    </On>
    <On Event="VIEW_REAR">
      (L:RearView,number) 1 + (&gt;L:RearView,number)
    </On>
  </Keys>
  -->

</Gauge>

But never the less is there a code for the neutral position of the HAT???

Edi



-----------------------------------------------------------------------
60 minutes later!!
I changed the code - also here!!
And central position of the HAT gives -1 !!
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
Edi,

I'm glad that you got it working.

Now, the code can be much simpler, and all VIEW events can be avoided as well:

Code:
<Gauge Name="Fixed_Window.xml" Version="1.0">

  <Comment>
    Check XMLKeys_reference.txt for other HAT values.

     POV Point of view switch (often called the 0 facing ahead hat switch).
     4500 forward right
     9000 right
     13500 rear right
     18000 rear
     22500 rear left
     27000 left
     31500 forward left
  </Comment>

  <Macro Name="k">C:XMLKEYS</Macro>

  <Macro Name="KeyDisable">
    @1 (>@k:KeyName,string) (>@k:KeyCaptureOff,bool)
  </Macro>

  <Macro Name="KeyEnable">
    @1 (>@k:KeyName,string) (>@k:KeyCaptureOn,bool)
  </Macro>

  <Macro Name="KeyName">
    @1 (>@k:KeyName,string)
  </Macro>

  <Macro Name="KeyConfig">
    @1 (>@k:KeyName,string) '@2' (>@k:KeyString,string)
  </Macro>

  <Macro Name="JoyStickHAT">
    (L:HAT_Number,number) sp0
     0 (>L:FrontView,number)
     0 (>L:FrontRightView,number)
     0 (>L:FrontView,number)
     0 (>L:RightView,number)
     0 (>L:RearRightView,number)
     0 (>L:RearView,number)
     0 (>L:RearLeftView,number)
     0 (>L:LeftView,number)
     0 (>L:FrontLeftView,number)
     l0 0 == if{ 1 (>L:FrontView,number) }
     l0 4500 == if{  1 (>L:FrontRightView,number) }
     l0 9000 == if{  1 (>L:RightView,number)  }
     l0 13500 == if{ 1 (>L:RearRightView,number) }
     l0 18000 == if{ 1 (>L:RearView,number) }
     l0 22500 == if{  1 (>L:RearLeftView,number) }
     l0 27000 == if{ 1 (>L:LeftView,number) }
     l0 31500 == if{ 1 (>L:FrontLeftView,number) }
  </Macro>

  <Update Hidden="Yes">
    (L:XMLKeysInit,bool) !
    if{
         <!-- Joystick HAT's custom behavior -->
         @KeyConfig('joystick:0:POV',@JoyStickHAT)

         <!-- Enable joystick HAT's capture -->
         @KeyEnable('joystick:0:POV')

         1 (>L:XMLKeysInit,bool)
      }

   <!-- HAT's captured value -->
   @KeyName('joystick:0:POV')
   (@k:KeyValue,number) (>L:HAT_Number,number)

  <!-- Example taken from your code --> 
  (L:RearRightView, number) 1 ==
   if{
        (L:window_status_05, bool) 0 == if{ 10005 (>K:PANEL_ID_OPEN) 10004 (>K:PANEL_ID_CLOSE) 10003 (>K:PANEL_ID_CLOSE) 10002  (>K:PANEL_ID_CLOSE) 10001 (>K:PANEL_ID_CLOSE) 0 (>K:PANEL_ID_CLOSE) }
      }

  </Update>

</Gauge>

I removed wrong duplicated @JoyStickHAT call and other unnecessary code.

Not tested, but should work as is or perhaps with minor adjustments.

Tom
 
Messages
495
Country
austria
Yes, Tom,
it's a dirty and very slow going on code!!!

At the moment i'm not able to open the side views. Funny thing..

Edi
 
Messages
495
Country
austria
Tom,
it seems that if you capture the HAT you have to add a View - Key event!!??

Did you look into post 22??
With this code i get (L:HAT_Number,number) -1. So i can use (L:HAT_Number,number) 0 for view forward up.

Edi
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi Edi,

I did a test and made minor changes on these pieces of code:

Code:
<Macro Name="JoyStickHAT">
  (L:HAT_Number,number) sp0
  0 (>L:FrontView,number)
  0 (>L:FrontRightView,number)
  0 (>L:FrontView,number)
  0 (>L:RightView,number)
  0 (>L:RearRightView,number)
  0 (>L:RearView,number)
  0 (>L:RearLeftView,number)
  0 (>L:LeftView,number)
  0 (>L:FrontLeftView,number)
  l0 0 l0 -1 or == if{ 1 (>L:FrontView,number) }
  l0 4500 == if{ 1 (>L:FrontRightView,number) }
  l0 9000 == if{ 1 (>L:RightView,number) }
  l0 13500 == if{ 1 (>L:RearRightView,number) }
  l0 18000 == if{ 1 (>L:RearView,number) }
  l0 22500 == if{ 1 (>L:RearLeftView,number) }
  l0 27000 == if{ 1 (>L:LeftView,number) }
  l0 31500 == if{ 1 (>L:FrontLeftView,number) }
</Macro>
...
...
...
  <!-- Joystick HAT's custom behavior -->
  @KeyConfig('joystick:0:POV', )
.....
.....
  <!-- HAT's captured value -->
  @KeyName('joystick:0:POV')
  (@k:KeyValue,number) (>L:HAT_Number,number)
  @JoyStickHAT <!-- actually goes here and NOT in @KeyConfig macro -->

Now it show work as expected.

Tom
 
Messages
495
Country
austria
Thanks, Tom!
The joystick code works like a charm!! That's not the problem at moment.
Btw i use (L:HAT_Number,number) 0 for view_forward_up!

But i have big troubles to open the proper BMP and the proper view!!
I seems i found a way to do it correct! Let's see..

I'm a big upset about the MS boy!! Totally senseless to kill the sideviews and leave the cockpit alife.

If you fill bored - must probably not!! - maybe you could go ahead with some code opening sideviews and bmp.

Edi
 
Messages
495
Country
austria
Tom,
luckily i got it to work!
Code cleaning has to be done!
Thanks for you help!!

Edi
 
Messages
495
Country
austria
Tom,
i read your XMLKEYS reference and XMLKeysHandler description!!
But i do not get it to read the x - or y - axis!
Could you help me?? Thanks in advance!!

Edi
 
Messages
495
Country
austria
Tried it again and found an typo!!
So again i can block my controls if there is no hydraulic!!

Edi
 
Messages
495
Country
austria
That's it what i was looking for !!!

My test gauge if someone should be interested in playing with the joystick axis.

Code:
<!-- ************************************************************************* -->

    <Macro Name="k">C:XMLKEYS</Macro>

    <Macro Name="KeyDisable">
        @1 (>@k:KeyName,string) (>@k:KeyCaptureOff,bool)
    </Macro>

    <Macro Name="KeyEnable">
        @1 (>@k:KeyName,string) (>@k:KeyCaptureOn,bool)
    </Macro>

    <Macro Name="KeyName">
        @1 (>@k:KeyName,string)
    </Macro>

    <Macro Name="KeyConfig">
        @1 (>@k:KeyName,string) '@2' (>@k:KeyString,string)
    </Macro>


  <Element>
    <Select>
      <Value>

      (L:XMLControl_Init,bool) !
      if{
        <!-- Joystick Axis -->
        @KeyConfig('joystick:0:XAxis', )
        @KeyConfig('joystick:0:YAxis', )
        @KeyConfig('joystick:0:RzAxis', )

        <!--  Enable joystick Axis -->
        @KeyEnable('joystick:0:XAxis')
        @KeyEnable('joystick:0:YAxis')
        @KeyEnable('joystick:0:RzAxis')

        0 (&gt;L:AxisX_Number,number)
        0 (&gt;L:AxisY_Number,number)
        0 (&gt;L:AxisRz_Number,number)

        1 (&gt;L:XMLControl_Init,bool)
        }


      @KeyName('joystick:0:XAxis')
      (@k:KeyValue,number) (&gt;L:AxisX_Number,number)

      @KeyName('joystick:0:YAxis')
      (@k:KeyValue,number) (&gt;L:AxisY_Number,number)

      @KeyName('joystick:0:RzAxis')
      (@k:KeyValue,number) (&gt;L:AxisRz_Number,number)


      (L:CORE1_UpdateL_Init_Panel,number) 60 &lt;
      if{
        (L:AxisRz_Number,number) 4 / (&gt;K:RUDDER_SET)
        }

      (L:CORE1_UpdateL_Init_Panel,number) 60 ==
      if{
        @KeyDisable('joystick:0:XAxis')
        @KeyDisable('joystick:0:YAxis')
        @KeyDisable('joystick:0:RzAxis')

        0 (&gt;L:AxisX_Number,number)
        0 (&gt;L:AxisY_Number,number)
        0 (&gt;L:AxisRz_Number,number)
        }

      </Value>
    </Select>
  </Element>

Output
Code:
      %L:AxisX_Number,num\t%((L:AxisX_Number,number))%!6.3f!\n
      %L:AxisY_Number,num\t%((L:AxisY_Number,number))%!6.3f!\n
      %L:AxisRz_Number,num\t%((L:AxisRz_Number,number))%!6.3f!\n

Great job, Tom!!:)

Thanks!!
 
Messages
495
Country
austria
Tom,
i would like to read to read the capture status of an axis in a L:variable

for e.g.

Code:
      @KeyName('joystick:0:XAxis')
     (@k:KeyCaptureOff,bool) (&gt;L:DBG_Status,bool)

I am helpless:confused:
Edi
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Edi,
KeyCaptureOff and KeyCaptureOn are write only (check the documentation). To know the status of a given axis, you can use:

Code:
<!-- Enable joystick Axis -->
@KeyEnable('joystick:0:XAxis')
1 (>L:DBG_Status,bool)
....
....
(L:CORE1_UpdateL_Init_Panel,number) 60 ==
if{
     @KeyDisable('joystick:0:XAxis')
     0 (>L:DBG_Status,bool)
....
....
....

Tom
 
Messages
495
Country
austria
Using a L:Var was my first solution.
So i was intersted if i can read the var!
At the moment i have so much to read. Sorry for missing some parts.
Thanks!

Edi
 
Top