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

Adding switches

Messages
13
Country
unitedkingdom
I want to change the way a switch works in my cockpit setup. I have some addon software that adds a panel. This panel has rotary switches that are mouse click driven as well as keyboard combination switchable.
I have added a physical switch and mapped it to the keyboard combination. This drives the switch one notch at each switch click. I would like to change the physical switch in my cockpit to a rotary encoder and have the ability to rotate the switch both CW and ACW using the physical encoder switch. This would obviously mean seting an additional switch input so one switch inc's the dial while the other dec's the dial (and follow on screen).
Is it possible to change the .xml code to do this? I have tried looking for an example to give me some clues as to how to do this (like a radio frequency for example) but I can not find anything.

Here is an example of what I have from the original software, I have added the second line to include the joystick input, but this just rotates in one direction for each click. e.g the radar range is selectable between 5,10,20,50 miles using this input. In this mode it goes from 5 to 10 to 20 to 50 and then back to 5 again.

<!-- HUD mode selector switch -->
<Action name="rangeSw" control="Ctrl+0" />
<Action name="rangeSw" control="joystick:2:button:8" />

Any help or clues would be most welcomed.

Regards

Pete
 
Post the XML code for the switch so we can help your alter it to work like you want! Without a XML code there is not much you can do.
 
Hi delivery guy,

This is the code as it appears in the xml file that defines the operation using the mouse on the panel bitmap. The code already given in the last post is what defines the switches used.

I hope this makes sense to what I am looking for.
</MouseArea>
- <MouseArea id="RadRng_L">
<FloatPosition>1840.000,64.000</FloatPosition>
<Size>84,168</Size>
<CursorType>LeftArrow</CursorType>
- <MouseClick id="MouseClick">
<Script>( L:CSG_RdrRange, position) 1 - (> L:CSG_RdrRange, position) (L:CSG_RdrRange, position) 0 < if{ 0 (>L:CSG_RdrRange, position) }</Script>
<ClickType>LeftSingle</ClickType>
</MouseClick>
</MouseArea>
- <MouseArea id="WpnMode_Dn">
<FloatPosition>600.000,165.000</FloatPosition>
<Size>30,85</Size>
<CursorType>DownArrow</CursorType>
- <MouseClick id="MouseClick">
<Script>( L:CSG_WpnSelect, position) 1 + (> L:CSG_WpnSelect, position) (L:CSG_WpnSelect, position) 3 > if{ 3 (>L:CSG_WpnSelect, position) }</Script>
<ClickType>LeftSingle</ClickType>
</MouseClick>
</MouseArea>
 
By using a left and right click we can design 1 switch. You posted 2 switches. Why? And can i create a code using just the first code RadRng_L?
I am confused why there is another code using down arrow.
And if yes i will design it to work like a radio knob using left and right click.
 
By using a left and right click we can design 1 switch. You posted 2 switches. Why? And can i create a code using just the first code RadRng_L?
I am confused why there is another code using down arrow.
And if yes i will design it to work like a radio knob using left and right click.
Thanks for the reply again.

I did not create this code and appology for confusing things. There are a number of switches that all currently work by using the mouse on screen to move the dial +/- or by using a single key press it just increments the dial position and when it gets to the last position it just jumps back to the begining again. What I want to do is replicate the up/down selection but using a rotary encoder and 2 switch inputs to drive different directions. As I see things I need to create or add some code to do what the mouse is doing. So I need the existing key press to be mapped as moving the rotary dial on screen in one direction and a second key press to be created to make the dial go in the other direction. I need 4 dials in total to do this action.

Pete
 
So far you sent me the mouse events. Do you have the code for the visual animation since it too will need to be coded to match the mouse event. Without the visual code i can't alter just the mouse event. Let's only re design 1 switch for now if since you need 4. Send the visual xml code and the mouse event that goes with it.
 
Hi again,

Thanks for sticking with this I do appreciate it. Is this what you need? I have 2 .xml code files, one defines the hardware switches as well as other bits. Another section of code is in the gauges section, this I assume is what you are asking for.

From the .xml that is in each aircraft folder to define switches.

<Action name="rangeSw" control="Ctrl+0" />
<Action name="rangeSw" control="joystick:2:button:8" />
<!-- Radar range selector switch -->

-------------------------------------------------------------------------------------------------------------------------------------

The code from the main gauge file
-------------------------------------------------------------------------------------------------------------------------------------

<ClickType>LeftSingle</ClickType>
</MouseClick>
</MouseArea>
<MouseArea id="RadRng_L">
<FloatPosition>1840.000,64.000</FloatPosition>
<Size>84,168</Size>
<CursorType>LeftArrow</CursorType>
<MouseClick id="MouseClick">
<Script>( L:CSG_RdrRange, position) 1 - (&gt; L:CSG_RdrRange, position) (L:CSG_RdrRange, position) 0 &lt; if{ 0 (&gt;L:CSG_RdrRange, position) }</Script>
<ClickType>LeftSingle</ClickType>
</MouseClick>
</MouseArea>

Please let me know if I have got this wrong or you need something more.

Pete
 
Take this code and hit ctrl F so you can find the visual code. There must be a long xml code that uses this L:var i posted below. Without that code i am not sure i can help you!

( L:CSG_RdrRange, position)
 
Take this code and hit ctrl F so you can find the visual code. There must be a long xml code that uses this L:var i posted below. Without that code i am not sure i can help you!

( L:CSG_RdrRange, position)
Hi again,

On further investigation I have found other occurances of this string. Each one is quite small. Can you PM me and I can send you the whole file, it maybee easier that way than me sending snippets.

peterlane550@btinternet.com

Thanks

Pete
 
Sounds to me it's just not worth fixing as i am super busy and it seems that L:var is going to be in many locations and it will take hours of writing and testing to make the switch work the way you would like. What aircraft is this and maybe the original developer can do an update. Sorry to bummer but i see this being too much work as we both do not know the entire XML code very well.
 
Sounds to me it's just not worth fixing as i am super busy and it seems that L:var is going to be in many locations and it will take hours of writing and testing to make the switch work the way you would like. What aircraft is this and maybe the original developer can do an update. Sorry to bummer but i see this being too much work as we both do not know the entire XML code very well.
No problem, I am not sure of how .xml works so can offer no input.

Thanks for taking the time anyway.

Pete
 
Back
Top