• 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 case in <eventid>

Messages
92
Country
poland
Hi everyone.

I heave a question:
I created this Animation/button pressing code:

Code:
<Animation name="Vanship_thrust_direction_lever" guid="2290990d-e913-4751-8919-15e7e4dbb8b1" type="Sim" typeParam="AutoPlay" length="100" typeParam2="Vanship_thrust_direction_lever" />

<PartInfo>
    <Name>Vanship_thrust_direction_lever</Name>
    <AnimLength>100</AnimLength>
    <Animation>
        <Parameter>
            <Code>(L:Mode,number) 2 - abs 50 *</Code>
            <Lag>100</Lag>
        </Parameter>
    </Animation>
    <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>thrust direction lever mode - %((L:Mode,number))%!f!</TooltipText>
                <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
        <EventID>TOGGLE_TAIL_HOOK_HANDLE AP_PANEL_HEADING_HOLD TOGGLE_TAIL_HOOK_HANDLE 3 (L:Mode,number) case</EventID>
    </MouseRect>
</PartInfo>

What I want it to do:
The (L:Mode,number) variable gives me 0, 1, or 2.
Depending on that I want to animate a switch - that part works fine.
When I click on that switch I want to have a <eventID> but different depending on (L:Mode,number) variable value:

if 0-> TOGGLE_TAIL_HOOK_HANDLE
if 1 -> AP_PANEL_HEADING_HOLD
if 2 -> TOGGLE_TAIL_HOOK_HANDLE

As you can see I tried to use case inside <eventid>, but it doesn't work, is there any other way to do that, or maybe I did something wrong.
 
Don't use <EventID> tags for conditional expressions. They're only to be used for single events.

Code:
<PartInfo>
<Name>Vanship_thrust_direction_lever</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:Mode,number) 2 - abs 50 *</Code>
<Lag>100</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>thrust direction lever mode - %((L:Mode,number))%!f!</TooltipText>
<MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
<CallbackCode>
(L:Mode,number) 0 ==
if{ (>K:TOGGLE_TAIL_HOOK_HANDLE) }
(L:Mode,number) 1 ==
if{ (>K:AP_PANEL_HEADING_HOLD) }
(L:Mode,number) 2 ==
if{ (>K:TOGGLE_TAIL_HOOK_HANDLE) }
</CallbackCode>
</MouseRect>
</PartInfo>
 
Thanks for the tip!

Unfortunately that doesn't fully work:
When (L:Mode,number) have value 0 it do toggle TOGGLE_TAIL_HOOK_HANDLE,
but both when it is 1 and 2 it does nothing.
Like if it is ignoring other 2 lines inside <CallbackCode>.
 
Code:
<CallbackCode>
(L:Mode,number) 0 ==
if{ (>K:TOGGLE_TAIL_HOOK_HANDLE) }
els{ (L:Mode,number) 1 ==
       if{ (>K:AP_PANEL_HEADING_HOLD) }
       els{ (L:Mode,number) 2 ==
              if{ (>K:TOGGLE_TAIL_HOOK_HANDLE) } } }
</CallbackCode>

Maybe that will work.



If it won't, introduce a new variable and let a controller gauge do the evaluation expression. Something like this:

Switch...
Code:
<CallbackCode>
(L:Switch Variable, bool) ! (>L:Switch Variable, bool)
</CallbackCode>

A controller gauge (in a 3D model) is a small box or single polygon hidden somewhere in your model (you can apply any of your materials to it and leave it unmapped) with a simple visibility script. In your case:
Code:
<PartInfo>
<Name>Switch Controller</Name>
<Visibility>
<Parameter>
<Code>
(L:Mode,number) 0 ==
(L:Switch Variable, bool) and
if{ (>K:TOGGLE_TAIL_HOOK_HANDLE) }
(L:Mode,number) 1 ==
(L:Switch Variable, bool) and
if{ (>K:AP_PANEL_HEADING_HOLD) }
(L:Mode,number) 2 ==
(L:Switch Variable, bool) and
if{ (>K:TOGGLE_TAIL_HOOK_HANDLE) }
</Code>
</Parameter>
</Visibility>
</PartInfo>

You can assign code for any other stuff you want to control on your model to the controller gauge. I think you can add about 100 lines of code to each controller (found by experimentation). If you run out of lines on one controller, just add another.
 
The first option worked!
Thank you so much!

And thanks for that other solution, I bet I put it do good use.
 
Back
Top