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

Pilot oxygen mask visibility XML ( SOLVED )

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Hi folks, I'm trying to get my Reporter crew's oxygen masks to appear / disappear when passing through 10,000ft altitude using XML and FSX variables. I think I'm missing something in the coding or using a variable that doesn't respond to visibility code - could someone point me in the right direction?

<PartInfo>
<Name>Mask_vis</Name> <!-- show part only when aircraft is above 10,000 feet -->
<Visibility>
<Parameter>
<Code>
(A:INDICATED ALTITUDE,feet) 10000 &lt;= or if{ 1 } els{ 0 }
</Code>
</Parameter>
</Visibility>
</PartInfo>

I used coding generously offered by Mjahn successfully to open an engine bay based on the Exit 2 bool command, so FSDS is responding correctly and I've added mask_vis as required in the necessary FSDS folders, so things are working fine there. It's my inexperience with this that I think is causing the issue.
 

Heretic

Resource contributor
Messages
6,830
Country
germany
a) Wrap all code in [code][/code] tags., Makes it easier to read.

b) Why is there an "or" in the evaluation?
 
Messages
683
Country
us-california
Try this...

Code:
<!-- Show part only when aircraft is above 10,000 feet-->
<PartInfo> 
  <Name>Mask_vis</Name>
     <Visibility>
        <Parameter>
           <Code>(A:INDICATED ALTITUDE,feet) 10000 &gt; if{ 1 } els{ 0 }</Code>
         </Parameter>
     </Visibility>
</PartInfo>
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Thanks guys. Heretic - I'm literally a noob with XML so having tried some basic stuff I mimicked the seasonal visibility codes to see if something like that would work.

Robert, I tried your code but nothing happened. I wonder if I'm perhaps trying to run before I can walk here. I'm going to try my existing ( and working ) visibility code to make sure it's not something else I'm doing wrong at my end first, and will report back shortly.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Okay, I think this is something to do with FSDS itself, as some tinkering with the model.def file and FSDS part names file resulted in me losing the previously fine engine bay visibility. The program seems sensitive to alterations. I'll post back again once I figure this out, but it may be that your code, Robert, is fine and the software is to blame. I know that FSDS suffers from this so I'll try to figure it out.
 
D

Deleted member 1281

Guest
Robert's version definitely looks okay. Be very careful with any modeldef changes because even a single typo can invalidate the whole set. Best make a backup before each change. And yes, the error probably rests with FSDS's odd handling of registering any modeldef update.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Robert's version definitely looks okay. Be very careful with any modeldef changes because even a single typo can invalidate the whole set. Best make a backup before each change. And yes, the error probably rests with FSDS's odd handling of registering any modeldef update.

I was just about to reply when your message appeared mjahn!

OK, error was my using of an upper case title for the animation. Mask_vis should have been mask_vis / spinner_vis, and likewise in FSDS part names file. The visibility on the engine bay is restored.

However, as a test I set Robert's mask_vis to also be controlled by the second exit function, but again the mask remained in place. The mask is parented to an animated object ( the pilot's head, which moves as an ambient animation ). I wonder if that perhaps might block a visibility code? The mask also has an oxygen hose that is parented to it - I might see if joining the parts fixes the issue.
 
D

Deleted member 1281

Guest
No the head animation shouldn't block the visibility condition, and it seems logical that you would make the mask a child of the head and the hose a child of the mask. Animations and vis conditions are inherited by the children, so you wouldn't have to repeat the vis code for the hose --- at least that's how we would do it in Max and gmax etc. Again, can't say anything about FSDS's handling of such linkages or dependencies, so better make sure of that first.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
I did a couple of quick tests. FSDS heirachies work the same - child parts vanish along with parent parts as expected. I joined the mask and hose into one part and re-compiled, but sadly no joy. I might perhaps set them to match a key stroke for something, maybe a tailhook command, and see if they can be switched off to make them disappear. I could then add a tool-tip line to teh code to read "Oxygen system on" or similar for a switch in the cockpit perhaps...?
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Could Robert's code need an extra line or detail that renders the mask invisible above 10,000ft rather than just stating the altitude?
 
D

Deleted member 1281

Guest
He isn't just stating the altitude, what he is saying is IF altitude is greater than 10000 THEN show the object, which is what you want isn't it?

BTW, to test it you could just temporarily reduce the critical height to some lower number, or even ever so quickly SLEW your plane to the specified height (using F4) to see whether the code does its thing.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Yes, that's what I want. I've checked each time by doing just that and slewing up to 10,000ft just to make sure that the mask doesn't disappear at 10,000ft or something, indicating that at least something is happening. Nothing happens though. It must be something about FSDS or my model but I can't think what at the moment. Will keep plugging away at it.

As a check I altered Robert's code briefly and used the variable for Exit 3 instead, mimicking your own visibility code for the engine panel. The mask stubbornly refused to disappear whereas the panel does so just fine. Very odd - the joys of modelling! :)
 
D

Deleted member 1281

Guest
I just verified in FSX that Robert's code is indeed working as advertised. I tested it on an exterior model (not sure if you have a pilot figure for the interior). If you tag a part with the vis condition it will only show at altitudes greater than 10K.

Perhaps quote or attach the intermediate file that tells FSDS that there is such a condition. Maybe there's something that strikes the eye one way or another.
 
Last edited by a moderator:

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
I just verified in FSX that Robert's code is indeed working as advertised. I tested it on an exterior model (not sure if you have a pilot figure for the interior). If you tag a part with the vis condition it will only show at altitudes greater than 10K.

Perhaps quote or attach the intermediate file that tells FSDS that there is such a condition. Maybe there's something that strikes the eye one way or another.

Thanks Mjahn. This must be something to do with FSDS and the way it reads the model.def file, something I've come across before. I'll investigate and post the solution here when I figure it out. FSDS simply has a Partnames file - once a new code is added to modeldef, the code name is added in partnames and all works ( as with your code ). The issue comes with the order in which FSDS reads the codes, requiring model.def to be altered so FSDS can "see" everything. I think that's what's going on here.
 

Deano1973

Resource contributor
Messages
384
Country
unitedkingdom
Updating everyone here who might encounter a similar problem.

I could not convince FSDS to "see" the new XML code no matter what I tried, but I could tag the relevant parts with the correct name. The solution was to ignore FSDS entirely, then load the model into ModelCoverterX. By selecting the mask_vis parts, I could then assign the visibility condition to them within MCX instead. I compiled the model and checked it out, and hey presto the masks appear as if by alchemy passing through 10,000ft indicated! :cool:

Many thanks Robert, Mjahn Heretic! Another lesson learned...
 
Top