• 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 Conditional visibility question

Messages
468
Country
ca-ontario
I know I've seen a post by Fr. Bill which covered my current issue but deep searches (here and at FFDS) haven't brought it to the surface (probably due to my incorrect search terms) so I will explain what I am trying to do in the hope that someone has an answer.

I have two sets of parts that I want to be able to swap out based on a mouse click. The idea is much like Bill's excellent 'show/hide yoke' code and I had intended to use that as my basis to work from but the difference in my case is that I want one set of parts visible and then replace them with a different set of parts when the user clicks on a suitable model part. i.e. Parts A, B, C are visible on initial start-up of the sim but click in a certain spot and Parts A, B, C disappear and are replaced by Parts X, Y, Z. Obviously the parts would need to reverse when the 'clickable object' is clicked again.

I know I can get Parts A, B, C to disappear using Bill's yoke code it's getting Parts X, Y, Z to appear in their place that has me stumped at the moment (probably because I am trying to make it more complicated than it needs to be).

Here are the parts of Bill's yoke code I was planning on using as the basis for my code:

Code:
  <Animation name="hide_pilots_yoke" guid="54647385-cff7-679c-a657-9b9cd33e4f12" length="100" type="Sim" typeParam2="hide_pilots_yoke" typeParam="AutoPlay" />
    <Animation name="yoke_pilot" guid="54577386-cff7-679c-a658-ab9cd33e4f13" length="100" type="Sim" typeParam2="yoke_pilot" typeParam="AutoPlay" />

<!--     END Custom Animations  -->


<!--          Citation II XML Code  -->
   <PartInfo>
	<Name>hide_pilots_yoke</Name>
		<MouseRect>
			<Cursor>Hand</Cursor>
			<TooltipText>Hide Pilot's Yoke</TooltipText>
			<CallbackCode>
				(L:YokePilot,bool) ! (&gt;L:YokePilot,bool)
			</CallbackCode>
		</MouseRect>
   </PartInfo>

   <PartInfo>
   	<Name>yoke_pilot</Name>
    	<Visibility>
           	<Parameter>
      		<Code>(L:YokePilot,bool) 0 &gt; if{ 0 } els{ 1 }</Code>
           	</Parameter>
    	</Visibility>
   </PartInfo>

Can anyone suggest what I need to add to make my idea work (i.e show Parts X, Y, Z when Parts A, B, C hide)?
 
As an aside, I often find Google a better searcher of FSDeveloper posts to find what I want. :o
 
Parts A,B,C:
Code:
   <PartInfo>
   	<Name>yoke_pilot</Name>
    	<Visibility>
           	<Parameter>
      		<Code>(L:YokePilot,bool) 0 == if{ 1 } els{ 0 }</Code>
           	</Parameter>
    	</Visibility>
   </PartInfo>

Visible when (L:YokePilot, bool) is 0...


Parts X,Y,Z:
Code:
   <PartInfo>
   	<Name>yoke_pilot2</Name>
    	<Visibility>
           	<Parameter>
      		<Code>(L:YokePilot,bool) 0 != if{ 1 } els{ 0 }</Code>
           	</Parameter>
    	</Visibility>
   </PartInfo>

...and visible when (L:YokePilot, bool) is NOT 0.
 
Thanks Bjoern, I take it I still need Bill's first part (below) to provide the 'click spot' to show/hide the parts?

Code:
 <Animation name="hide_pilots_yoke" guid="54647385-cff7-679c-a657-9b9cd33e4f12" length="100" type="Sim" typeParam2="hide_pilots_yoke" typeParam="AutoPlay" />
    <Animation name="yoke_pilot" guid="54577386-cff7-679c-a658-ab9cd33e4f13" length="100" type="Sim" typeParam2="yoke_pilot" typeParam="AutoPlay" />


   <PartInfo>
	<Name>hide_pilots_yoke</Name>
		<MouseRect>
			<Cursor>Hand</Cursor>
			<TooltipText>Hide Pilot's Yoke</TooltipText>
			<CallbackCode>
				(L:YokePilot,bool) ! (&gt;L:YokePilot,bool)
			</CallbackCode>
		</MouseRect>
   </PartInfo>
 
Last edited:
As an aside, I often find Google a better searcher of FSDeveloper posts to find what I want. :o
I will bear that in mind in future searches Tom. I find the search function here to be quite good if you can find the correct specific search terms but general searches are not so good.
 
Yes, you still need to provide a mouse area on which to click...

...although for your purposes it might be best that this area not be parts A,B,C or X,Y,Z...

Also, you can simplify the <Code> conditions by simply using:

<Code>(L:YokePilot,bool) !</Code> (* will be seen by default *)

and

<Code>(L:YokePilot,bool)</Code> (* will be seen when mouse area is clicked *)
 
Yes, you still need to provide a mouse area on which to click...

...although for your purposes it might be best that this area not be parts A,B,C or X,Y,Z...

I was going to use a non-related part as the 'click spot'.

Also, you can simplify the <Code> conditions by simply using:

<Code>(L:YokePilot,bool) !</Code> (* will be seen by default *)

and

<Code>(L:YokePilot,bool)</Code> (* will be seen when mouse area is clicked *)

Thanks Bill, I will play with all the code shortly and see what I can get working (hopefully all of it! ;) ).
 
Back
Top