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

FSX help with M:X and a 3 input, left drag knob?

Messages
35
Country
unitedstates
I have a 3 way knob, with state_0, state_1, state_2 (State 1 is in the middle)

I have 3 inputs, key events for those states 0_on, 1_on, 2_on

I want to be able to left mouse drag the knob to the right through the states, and left drag to the left to return.

Possible? Here's what I think I need but it doesn't work. I don't understand how the M:X position works in 3d.

Assuming this switch starts at 1... and I leftclick drag to the left for 0 and left click drag to the right for 2. This is mostly pseudo code. I also realize this code would only work for the starting position atm.

EDIT: I think i need to define the beginning of the drag with left click event, using an example not making sense yet :) ..added to code.

Code:
<MouseFlags>LeftSingle+LeftDrag</MouseFlags>
    <CallbackCode>
         (M:Event) 'LeftSingle' scmi 0 == if{ (M:X) (&gt;L:Click) }
         (M:Event) 'LeftDrag' scmi 0 ==
            if { (M:X) ( L:Click) "left or right of it?";
                if { (&gt; K:0_on ) }
                els { (&gt; K:2_on) } }
    </CallbackCode>

last edit: the lever_fuel_selector_LOR is what I want now I found that example I think I got it...
 
Last edited:
Messages
35
Country
unitedstates
Thanks Heretic, that's a good post to reference.

I didn't get the fuel selector working yet but moved on at the moment to a new switch.

The tricky part is understanding how the fuel selector has these numbers for the cases. There are 3 states, and not sure how the extra 1 figures in, and the 4 is the number of states?

2 0 1 1 4

and this boggle me a bit, wish I had a breakpoint!

Code:
 els{ (M:X) (G:Var1) - 40 / int (G:Var2) + 0 max 2 min s0 2 0 1 1 4 (A:FUEL TANK SELECTOR:1, enum) case !=
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Is 1,2,3,4 referencing left, right, both and off per chance?
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
your case expression is returning:

1 when (A:FUEL TANK SELECTOR:1, enum) is 0 - OFF
1 when (A:FUEL TANK SELECTOR:1, enum) is 1 - ALL
0 when (A:FUEL TANK SELECTOR:1, enum) is 2 - LEFT
2 when (A:FUEL TANK SELECTOR:1, enum) is 3 - RIGHT

Is this OK to your needs?

Tom
 
Messages
35
Country
unitedstates
So, I was able to use the lever_fuel_selector_LOR as a template and get what I needed.

In my case, I don't need case statements to re order the inputs like the lever_fuel_selector.

I'm not sure why "40" is picked still as the number to divide by. But this works :)

Code:
(M:Event) 'LeftSingle' scmp 0 =
if{ (M:X) (&gt;G:Var1) (A:state, enum) (&gt;G:Var2) }
els{ (M:X) (G:Var1) - 40 / int (G:Var2) + 0 max 2 min s0 (A:state,enum) !=
    if{l0 0 == if{ (&gt;K:0_on) } l0 1 == if{ (&gt;K:1_on) } 10 2 == if{ (&gt;2_on) } }
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
The number "40" is used as a scalar for the "number of pixels" for each unit of increase.

In simpler words, it determines how far your mouse cursor has to move before increasing/decreasing your variable.
 
Messages
10,088
Country
us-arizona
Orswell,

Could you post the Code section of this? I am trying to do the same thing but vertical.

I didn't think of using point 2 or enum 2 as the middle. I was starting at middle as 1 which made me have to zigzag through 2 to get to 3 Down then up, to go up.

I am going to try to adapt this as a template. Man, how I have struggled with this....
 
Top