• 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 Engine Switch and Lock

Messages
106
Country
germany
Hi,
i have a very big problem. I have a two-way engine-switch (Engine_Start) and his lock (lockl).
the switch may only be moved when the lock is open and the lock may go only if the switch is minimum on 1.
I`ve tried many different types of solutions, but all was wrong way.
I hope you can help me.

Here are the codes

two-way-switch

Code:
<PartInfo>
        <Name>Switch_Idle1</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:Engine_Start,bool) 50 *
                </Code>
                <Lag>200</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <HelpID>HELPID_GAUGE_SWITCH_IDLE1</HelpID>
            <TooltipText>ENGINE_SWITCH_1_MODE_MOUSE_L/R</TooltipText>		
            <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
	(M:Event) 'RightSingle' scmp 0 == if{ (L:Engine_Start,bool) -- 0 max (&gt;L:Engine_Start,bool) } (M:Event) 'LeftSingle' scmp 0 == if{ (L:Engine_Start,bool) ++ 2 min (&gt;L:Engine_Start,bool) } } 1 (&gt;L:push_1,enum)
      </CallbackCode>
        </MouseRect>
</PartInfo>

Lock

Code:
<Name>switch_idle_riegel_l</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:lockl,bool) 50 *
                </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <HelpID>HELPID_CAUTION MASTER</HelpID>
            <TooltipText>IDLE LOCK 1</TooltipText>
            <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
	(L:lockl,bool) ! (&gt;L:lockl,bool) 1 (&gt;L:Button_press,enum)
      </CallbackCode>
        </MouseRect>
</PartInfo>
 
Boolean values are only TRUE or FALSE indicated by 1 or 0. so the statement ...2 min (&gt;L:Engine_Start,bool)... is not able to put a 2 into (&gt;L:Engine_Start,bool).
There is an extra } in the Idle1 code.
To get the permissions you want wrap the CallbackCode body as indicated in red.

Code:
<Name>Switch_Idle1</Name>
          .
          .
          .
          .
        <CallbackCode>
         [COLOR="Red"] (L:lockl,bool) 0 ==
            if{[/COLOR]	(M:Event) 'RightSingle' scmp 0 == 
                  if{ (L:Engine_Start,bool) -- 0 max (&gt;L:Engine_Start,bool) }
               (M:Event) 'LeftSingle' scmp 0 == 
                  if{ (L:Engine_Start,bool) ++ [COLOR="Magenta"]2 min (&gt;L:Engine_Start,bool)[/COLOR] } [COLOR="Magenta"]}[/COLOR] 1 (&gt;L:push_1,enum)
             [COLOR="Red"] }[/COLOR]
         </CallbackCode>

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

Code:
<Name>switch_idle_riegel_l</Name>
          .
          .
          .
        <CallbackCode>
        [COLOR="Red"](L:Engine_Start,bool) 1 == 
          if{[/COLOR] (L:lockl,bool) ! (&gt;L:lockl,bool) 1 (&gt;L:Button_press,enum)[COLOR="Red"] }[/COLOR]
        </CallbackCode>
 
Thanks. Very good. but only goes to half. When switch is on idle and the lock is on, i can`t switch to flight. It would be better to use a different code.

I have no idea of it yet. It`s my first project.
 
Oddly enough, the "units" of a custom L:var are completely ignored by the sim's XML parsing engine.

There is no effective different between these for example:

  1. (L:MyVar,bool)
  2. (L:MyVar,enum)
  3. (L:MyVar,number)
  4. (L:MyVar,fred)
  5. (L:MyVar,ginger)
  6. (L:MyVar, )

The only requirement is that there must BE a "unit" specified. Note that example #6 is a blank space!

On the other hand, as a programmer by profession, I do stick to "proper" unit designations for my own sanity.
 
How far does that go?
Would
Code:
<Value>100 50 25 10 5 2.5 6 (L:MapZoomStep,FredAstaire) case (&gt;L:MapZoomNM,GingerRogers)</Value>

Give the same result as:
Code:
<Value>100 50 25 10 5 2.5 6 (L:MapZoomStep,enum) case (&gt;L:MapZoomNM,enum)</Value>

Tongue in cheek question of course!

Roy
 
No reason why it wouldn't, of course.

As it happens, even (L:MyVariable,unit) will work well... :rolleyes:
 
Give it another kind of code, where one can distinguish between 0, 1 and 2?

It gives codes with 3 ways. unfortunately don`t go. That goes only once. When i will switch to the second position, it doesn`t work.
 
Back
Top