XML for Newbies Part 10 - Advanced Visibilty Code

The Tutorials forum section is the place where you can learn the various techniques that go into the creation of AI traffic packages.
Post Reply
User avatar
Firebird
MAIW Admin
MAIW Admin
Posts: 12137
Joined: 11 Aug 2006, 21:04
Version: FS9
Location: EGLL

XML for Newbies Part 10 - Advanced Visibilty Code

Post by Firebird »

There is a nice little visibility option that you can employ to enable the user to change the visual of a mdl.
This is using the aircraft title from the aircraft.cfg file.

a) Example 1 - simple additional visibility part

<part>
<name>vis_conformal_tanks</name>
<visible_in_range>
<parameter>
<code>(A:TITLE,string) 'CFT' sstr 0 &gt; if{ 1 } els{ 0 }</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

Now in this case if the uses the string ‘CFT’ anywhere in the aircraft title the parts with the visibility condition vis_conformal_tanks will appear in game.

Finally, you select the part or parts that you want a visibility condition to apply to. And ensure that the visibility condition is set to the same as the part name.

The result in this specific case is that the conformal fuel tanks on the upper surface of the F-16 fuselage will appear.

If the user does not use the string ‘CFT’ in the title then no tanks will tank. Gives the user some control on how the aircraft looks.

This can equally be used for some aerials that are on some variants for some forces but not others. In this case the best way to approach it is to determine which is the most common. Do most forces have it/them or not?

If twenty nations have the antennae and two do not it makes more sense to nest the check for two forces rather than the twenty. That is a lot of xml code that can go wrong.

b) Example 2 - In the case of the minority having the additional feature(s)

<part>
<name>vis_antennae_1</name>
<visible_in_range>
<parameter>
<code>
(A:TITLE,string) 'FACh' sstr 0 &gt;
(A:TITLE,string) 'HAF' sstr 0 &gt; or
if{ 1 } els{ 0 }</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

In this case if the title contains ‘FACh’ or ‘HAF’ then the variable part(s) appear.

c) Example 3 - In the case of the majority having the additional feature(s)

Now in the case that the majority have the antennae then you reverse the if els conditions like so: -

<part>
<name>vis_antennae_1</name>
<visible_in_range>
<parameter>
<code>
(A:TITLE,string) 'FACh' sstr 0 &gt;
(A:TITLE,string) 'HAF' sstr 0 &gt; or
if{ 0 } els{ 1 }</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>


In this case the variable part(s) WILL be seen UNLESS the title contains ‘FACh’ or ‘HAF’.

Two things that you have to take into account when you use this approach.

Firstly, the string that you search for must be selective enough. You couldn’t for example create an F-16 with a single cockpit section and a dual cockpit section and have them dependent upon ‘C’ or ‘D’ being in the title. Way too common to find those individual letters in the title.

Using the F-16, as an example, you could though create two different intake and engine sections and have them dependent upon whether ‘-50’ or -52’ are in the aircraft title. A far better chance of being narrow enough. You should either use an obscure enough combination of characters or a longer string.

Secondly, you must always remember that when using this approach, that the area that this is most likely to fall down on is the user. Two factors here one is the SUE (Stupid User Error) and the fact that humans do not like to read instructions.

When you employ this feature, you must make the options as plain and upfront as possible to try and eliminate user induced problems. You can’t assume that they will leave the aircraft titles untouched.
Steve
_______________________________________________________
Image
Quid Si Coelum Ruat
_______________________________________________________
Post Reply